Skip to content

Commit 4affb1f

Browse files
committed
chore: rename
1 parent bfe690f commit 4affb1f

File tree

2 files changed

+11
-10
lines changed

2 files changed

+11
-10
lines changed

lint/typescript-service-api-rule.ts renamed to lint/typescript-services-types-rule.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
// @tsslint-disable typescript-service-api
1+
// @tsslint-disable typescript-services-types
22
import { defineRule } from '@tsslint/config';
33
import type * as ts from 'typescript';
44

55
/*
6-
* service api list: https://github.com/microsoft/TypeScript/blob/38d95c8001300f525fd601dd0ce6d0ff5f12baee/src/services/types.ts
6+
* services types list: https://github.com/microsoft/TypeScript/blob/38d95c8001300f525fd601dd0ce6d0ff5f12baee/src/services/types.ts
77
* commit: 96acaa52902feb1320e1d8ec8936b8669cca447d (2025-09-25)
88
*/
9-
const SERVICE_API: Record<string, string[]> = {
9+
const SERVICES_TYPES: Record<string, string[]> = {
1010
Node: [
1111
'getSourceFile',
1212
'getChildCount',
@@ -98,9 +98,9 @@ const SERVICE_API: Record<string, string[]> = {
9898
],
9999
};
100100

101-
const typescriptServiceApis: Map<string, Set<string>> = new Map();
102-
for (const [typeName, properties] of Object.entries(SERVICE_API)) {
103-
typescriptServiceApis.set(typeName, new Set(properties));
101+
const tsServicesTypes: Map<string, Set<string>> = new Map();
102+
for (const [typeName, properties] of Object.entries(SERVICES_TYPES)) {
103+
tsServicesTypes.set(typeName, new Set(properties));
104104
}
105105

106106
const TYPESCRIPT_PACKAGE_PATH = '/node_modules/typescript/';
@@ -144,13 +144,13 @@ export default defineRule(({ typescript: ts, file, program, report }) => {
144144
}
145145

146146
function checkAccess(target: ts.Expression, propertyName: string, start: number, end: number) {
147-
for (const [typeName, properties] of typescriptServiceApis) {
147+
for (const [typeName, properties] of tsServicesTypes) {
148148
if (!properties.has(propertyName)) {
149149
continue;
150150
}
151151
const type = typeChecker.getTypeAtLocation(target);
152152
if (isTargetType(type, typeName)) {
153-
report('TypeScript service-only API is used', start, end);
153+
report('TypeScript services types is used.', start, end);
154154
break;
155155
}
156156
}

tsslint.config.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1+
// @tsslint-disable typescript-services-types
12
import { createIgnorePlugin, defineConfig } from '@tsslint/config';
23
import { defineRules } from '@tsslint/eslint';
34
import * as path from 'node:path';
4-
import tsServiceApiRule from './lint/typescript-service-api-rule';
5+
import tsServicesTypesRule from './lint/typescript-services-types-rule';
56

67
export default defineConfig({
78
plugins: [
@@ -201,6 +202,6 @@ export default defineConfig({
201202
ts.forEachChild(node, visit);
202203
});
203204
},
204-
'typescript-service-api': tsServiceApiRule,
205+
'typescript-services-types': tsServicesTypesRule,
205206
},
206207
});

0 commit comments

Comments
 (0)