@rslint/core 0.6.2 → 0.6.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/207.js +897 -0
- package/dist/cli.js +1 -894
- package/dist/config-loader.js +33 -2
- package/dist/eslint-plugin/index.d.ts +1 -0
- package/dist/eslint-plugin/index.js +2 -1
- package/dist/eslint-plugin/lint-worker.js +2 -1
- package/dist/index.d.ts +93 -387
- package/dist/index.js +262 -140
- package/dist/internal.d.ts +135 -0
- package/dist/internal.js +167 -0
- package/dist/service.d.ts +33 -27
- package/dist/service.js +7 -20
- package/package.json +19 -21
- package/dist/34.js +0 -33
- package/dist/browser.d.ts +0 -52
- package/dist/browser.js +0 -115
package/dist/config-loader.js
CHANGED
|
@@ -1,6 +1,37 @@
|
|
|
1
1
|
import node_path from "node:path";
|
|
2
2
|
import { pathToFileURL } from "node:url";
|
|
3
|
-
|
|
3
|
+
const NATIVE_PLUGINS = [
|
|
4
|
+
"@typescript-eslint",
|
|
5
|
+
'import',
|
|
6
|
+
'jest',
|
|
7
|
+
'jsx-a11y',
|
|
8
|
+
'promise',
|
|
9
|
+
'react',
|
|
10
|
+
'react-hooks',
|
|
11
|
+
'unicorn'
|
|
12
|
+
];
|
|
13
|
+
const NATIVE_PLUGIN_DECL_ALIASES = [
|
|
14
|
+
'eslint-plugin-import',
|
|
15
|
+
'eslint-plugin-jest',
|
|
16
|
+
'eslint-plugin-jsx-a11y',
|
|
17
|
+
'eslint-plugin-promise',
|
|
18
|
+
'eslint-plugin-react-hooks',
|
|
19
|
+
'eslint-plugin-unicorn'
|
|
20
|
+
];
|
|
21
|
+
const NATIVE_PLUGIN_RESERVED_NAMES = new Set([
|
|
22
|
+
...NATIVE_PLUGINS,
|
|
23
|
+
...NATIVE_PLUGIN_DECL_ALIASES
|
|
24
|
+
]);
|
|
25
|
+
function defineConfig(config) {
|
|
26
|
+
return config;
|
|
27
|
+
}
|
|
28
|
+
function globalIgnores(ignorePatterns) {
|
|
29
|
+
if (!Array.isArray(ignorePatterns)) throw new TypeError('ignorePatterns must be an array');
|
|
30
|
+
if (0 === ignorePatterns.length) throw new TypeError('ignorePatterns must contain at least one pattern');
|
|
31
|
+
return {
|
|
32
|
+
ignores: ignorePatterns
|
|
33
|
+
};
|
|
34
|
+
}
|
|
4
35
|
function selectPluginSource(entry) {
|
|
5
36
|
if (null == entry || 'object' != typeof entry) return null;
|
|
6
37
|
const e = entry;
|
|
@@ -127,4 +158,4 @@ function collectPluginMeta(configs) {
|
|
|
127
158
|
pluginConfigs
|
|
128
159
|
};
|
|
129
160
|
}
|
|
130
|
-
export { collectPluginMeta, loadConfigFile, normalizeConfig };
|
|
161
|
+
export { collectPluginMeta, defineConfig, globalIgnores, loadConfigFile, normalizeConfig };
|
|
@@ -25554,7 +25554,7 @@ class ConfigCommentParser {
|
|
|
25554
25554
|
config: items
|
|
25555
25555
|
};
|
|
25556
25556
|
} catch {}
|
|
25557
|
-
const normalizedString = string.replace(/(?<![-a-zA-Z0-9/])([-a-zA-Z0-9/]+):/gu, '"$1":').replace(/(\]
|
|
25557
|
+
const normalizedString = string.replace(/(?<![-a-zA-Z0-9/])([-a-zA-Z0-9/]+):/gu, '"$1":').replace(/([\]0-9])\s+(?=")/u, "$1,");
|
|
25558
25558
|
try {
|
|
25559
25559
|
const items = JSON.parse(`{${normalizedString}}`);
|
|
25560
25560
|
return {
|
|
@@ -25711,6 +25711,7 @@ function createSourceCode(input) {
|
|
|
25711
25711
|
const sc = {
|
|
25712
25712
|
text,
|
|
25713
25713
|
ast,
|
|
25714
|
+
isESTree: 'Program' === ast.type,
|
|
25714
25715
|
get lines () {
|
|
25715
25716
|
if (null == _lines) _lines = text.split(LINE_TERMINATOR_RE);
|
|
25716
25717
|
return _lines;
|
|
@@ -24986,7 +24986,7 @@ class ConfigCommentParser {
|
|
|
24986
24986
|
config: items
|
|
24987
24987
|
};
|
|
24988
24988
|
} catch {}
|
|
24989
|
-
const normalizedString = string.replace(/(?<![-a-zA-Z0-9/])([-a-zA-Z0-9/]+):/gu, '"$1":').replace(/(\]
|
|
24989
|
+
const normalizedString = string.replace(/(?<![-a-zA-Z0-9/])([-a-zA-Z0-9/]+):/gu, '"$1":').replace(/([\]0-9])\s+(?=")/u, "$1,");
|
|
24990
24990
|
try {
|
|
24991
24991
|
const items = JSON.parse(`{${normalizedString}}`);
|
|
24992
24992
|
return {
|
|
@@ -25143,6 +25143,7 @@ function createSourceCode(input) {
|
|
|
25143
25143
|
const sc = {
|
|
25144
25144
|
text,
|
|
25145
25145
|
ast,
|
|
25146
|
+
isESTree: 'Program' === ast.type,
|
|
25146
25147
|
get lines () {
|
|
25147
25148
|
if (null == _lines) _lines = text.split(LINE_TERMINATOR_RE);
|
|
25148
25149
|
return _lines;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,32 +1,8 @@
|
|
|
1
|
-
export declare function applyFixes(options: ApplyFixesRequest): Promise<ApplyFixesResponse>;
|
|
2
|
-
|
|
3
|
-
export declare interface ApplyFixesRequest {
|
|
4
|
-
fileContent: string;
|
|
5
|
-
diagnostics: Diagnostic[];
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
export declare interface ApplyFixesResponse {
|
|
9
|
-
fixedContent: string[];
|
|
10
|
-
wasFixed: boolean;
|
|
11
|
-
appliedCount: number;
|
|
12
|
-
unappliedCount: number;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
1
|
/**
|
|
16
2
|
* Type-safe config helper. Returns the config array as-is (identity function).
|
|
17
3
|
*/
|
|
18
4
|
export declare function defineConfig(config: RslintConfig): RslintConfig;
|
|
19
5
|
|
|
20
|
-
export declare interface Diagnostic {
|
|
21
|
-
ruleName: string;
|
|
22
|
-
message: string;
|
|
23
|
-
messageId: string;
|
|
24
|
-
filePath: string;
|
|
25
|
-
range: Range;
|
|
26
|
-
severity?: string;
|
|
27
|
-
suggestions: any[];
|
|
28
|
-
}
|
|
29
|
-
|
|
30
6
|
/**
|
|
31
7
|
* A real ESLint plugin object, as exported by community packages
|
|
32
8
|
* (`eslint-plugin-unicorn`, etc.). Only the fields rslint consumes are
|
|
@@ -43,75 +19,6 @@ export declare interface ESLintPlugin {
|
|
|
43
19
|
[key: string]: unknown;
|
|
44
20
|
}
|
|
45
21
|
|
|
46
|
-
/**
|
|
47
|
-
* Edge in the flow graph (from antecedent to current)
|
|
48
|
-
*/
|
|
49
|
-
declare interface FlowEdge {
|
|
50
|
-
from: number;
|
|
51
|
-
to: number;
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
/**
|
|
55
|
-
* Flow graph for visualization
|
|
56
|
-
*/
|
|
57
|
-
declare interface FlowGraph {
|
|
58
|
-
nodes: FlowGraphNode[];
|
|
59
|
-
edges: FlowEdge[];
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
/**
|
|
63
|
-
* Node in the flow graph
|
|
64
|
-
*/
|
|
65
|
-
declare interface FlowGraphNode {
|
|
66
|
-
id: number;
|
|
67
|
-
flags: number;
|
|
68
|
-
flagNames?: string[];
|
|
69
|
-
nodePos?: number;
|
|
70
|
-
nodeEnd?: number;
|
|
71
|
-
nodeKindName?: string;
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
/**
|
|
75
|
-
* Control flow analysis information
|
|
76
|
-
*/
|
|
77
|
-
export declare interface FlowInfo {
|
|
78
|
-
flags: number;
|
|
79
|
-
flagNames?: string[];
|
|
80
|
-
nodeKind?: number;
|
|
81
|
-
nodeKindName?: string;
|
|
82
|
-
nodePos?: number;
|
|
83
|
-
nodeEnd?: number;
|
|
84
|
-
antecedent?: FlowInfo;
|
|
85
|
-
antecedents?: FlowInfo[];
|
|
86
|
-
graph?: FlowGraph;
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
export declare function getAstInfo(options: GetAstInfoRequest): Promise<GetAstInfoResponse>;
|
|
90
|
-
|
|
91
|
-
/**
|
|
92
|
-
* Request for AST info at a specific position
|
|
93
|
-
*/
|
|
94
|
-
export declare interface GetAstInfoRequest {
|
|
95
|
-
fileContent: string;
|
|
96
|
-
position: number;
|
|
97
|
-
end?: number;
|
|
98
|
-
kind?: number;
|
|
99
|
-
depth?: number;
|
|
100
|
-
fileName?: string;
|
|
101
|
-
compilerOptions?: Record<string, unknown>;
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
/**
|
|
105
|
-
* Response containing detailed AST information
|
|
106
|
-
*/
|
|
107
|
-
export declare interface GetAstInfoResponse {
|
|
108
|
-
node?: NodeInfo;
|
|
109
|
-
type?: TypeInfo;
|
|
110
|
-
symbol?: SymbolInfo;
|
|
111
|
-
signature?: SignatureInfo;
|
|
112
|
-
flow?: FlowInfo;
|
|
113
|
-
}
|
|
114
|
-
|
|
115
22
|
/**
|
|
116
23
|
* Define a global-ignores config entry.
|
|
117
24
|
*
|
|
@@ -134,15 +41,6 @@ export declare const importPlugin: {
|
|
|
134
41
|
};
|
|
135
42
|
};
|
|
136
43
|
|
|
137
|
-
/**
|
|
138
|
-
* Index signature information
|
|
139
|
-
*/
|
|
140
|
-
export declare interface IndexInfo {
|
|
141
|
-
keyType: TypeInfo;
|
|
142
|
-
valueType: TypeInfo;
|
|
143
|
-
isReadonly: boolean;
|
|
144
|
-
}
|
|
145
|
-
|
|
146
44
|
export declare const jestPlugin: {
|
|
147
45
|
configs: {
|
|
148
46
|
recommended: RslintConfigEntry;
|
|
@@ -167,36 +65,47 @@ export declare const jsxA11yPlugin: {
|
|
|
167
65
|
*/
|
|
168
66
|
declare type KnownPlugin = (typeof NATIVE_PLUGINS)[number];
|
|
169
67
|
|
|
170
|
-
export declare interface LanguageOptions {
|
|
171
|
-
parserOptions?: ParserOptions;
|
|
172
|
-
}
|
|
173
|
-
|
|
174
68
|
/**
|
|
175
69
|
* Language-specific configuration.
|
|
176
70
|
*/
|
|
177
|
-
declare interface
|
|
178
|
-
parserOptions?:
|
|
71
|
+
declare interface LanguageOptions {
|
|
72
|
+
parserOptions?: ParserOptions;
|
|
179
73
|
}
|
|
180
74
|
|
|
181
|
-
export declare
|
|
75
|
+
export declare interface LintMessage {
|
|
76
|
+
ruleId: string | null;
|
|
77
|
+
severity: 1 | 2;
|
|
78
|
+
message: string;
|
|
79
|
+
messageId?: string;
|
|
80
|
+
line: number;
|
|
81
|
+
column: number;
|
|
82
|
+
endLine?: number;
|
|
83
|
+
endColumn?: number;
|
|
84
|
+
fix?: LintMessageFix;
|
|
85
|
+
suggestions?: LintSuggestion[];
|
|
86
|
+
}
|
|
182
87
|
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
ruleOptions?: Record<string, string>;
|
|
188
|
-
fileContents?: Record<string, string>;
|
|
189
|
-
languageOptions?: LanguageOptions;
|
|
190
|
-
includeEncodedSourceFiles?: boolean;
|
|
88
|
+
/** A single fix edit as a flat UTF-16 offset range + replacement text (ESLint shape). */
|
|
89
|
+
export declare interface LintMessageFix {
|
|
90
|
+
range: [number, number];
|
|
91
|
+
text: string;
|
|
191
92
|
}
|
|
192
93
|
|
|
193
|
-
export declare interface
|
|
194
|
-
|
|
94
|
+
export declare interface LintResult {
|
|
95
|
+
filePath: string;
|
|
96
|
+
messages: LintMessage[];
|
|
195
97
|
errorCount: number;
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
98
|
+
warningCount: number;
|
|
99
|
+
fixableErrorCount: number;
|
|
100
|
+
fixableWarningCount: number;
|
|
101
|
+
output?: string;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
export declare interface LintSuggestion {
|
|
105
|
+
messageId?: string;
|
|
106
|
+
data?: Record<string, string>;
|
|
107
|
+
desc: string;
|
|
108
|
+
fix: LintMessageFix;
|
|
200
109
|
}
|
|
201
110
|
|
|
202
111
|
/**
|
|
@@ -209,144 +118,10 @@ export declare interface LintResponse {
|
|
|
209
118
|
*/
|
|
210
119
|
declare const NATIVE_PLUGINS: readonly ["@typescript-eslint", "import", "jest", "jsx-a11y", "promise", "react", "react-hooks", "unicorn"];
|
|
211
120
|
|
|
212
|
-
/**
|
|
213
|
-
* Detailed information about an AST node
|
|
214
|
-
*/
|
|
215
|
-
export declare interface NodeInfo {
|
|
216
|
-
id?: number;
|
|
217
|
-
kind: number;
|
|
218
|
-
kindName: string;
|
|
219
|
-
pos: number;
|
|
220
|
-
end: number;
|
|
221
|
-
flags: number;
|
|
222
|
-
flagNames?: string[];
|
|
223
|
-
text?: string;
|
|
224
|
-
fileName?: string;
|
|
225
|
-
parent?: NodeInfo;
|
|
226
|
-
name?: NodeInfo;
|
|
227
|
-
expression?: NodeInfo;
|
|
228
|
-
left?: NodeInfo;
|
|
229
|
-
right?: NodeInfo;
|
|
230
|
-
operatorToken?: NodeInfo;
|
|
231
|
-
operand?: NodeInfo;
|
|
232
|
-
condition?: NodeInfo;
|
|
233
|
-
whenTrue?: NodeInfo;
|
|
234
|
-
whenFalse?: NodeInfo;
|
|
235
|
-
thenStatement?: NodeInfo;
|
|
236
|
-
elseStatement?: NodeInfo;
|
|
237
|
-
body?: NodeInfo;
|
|
238
|
-
initializer?: NodeInfo;
|
|
239
|
-
type?: NodeInfo;
|
|
240
|
-
members?: NodeInfo[];
|
|
241
|
-
heritageClauses?: NodeInfo[];
|
|
242
|
-
typeParameters?: NodeInfo[];
|
|
243
|
-
parameters?: NodeInfo[];
|
|
244
|
-
modifiers?: NodeInfo[];
|
|
245
|
-
arguments?: NodeInfo[];
|
|
246
|
-
statements?: NodeInfo[];
|
|
247
|
-
properties?: NodeInfo[];
|
|
248
|
-
elements?: NodeInfo[];
|
|
249
|
-
declarationList?: NodeInfo;
|
|
250
|
-
declarations?: NodeInfo[];
|
|
251
|
-
importClause?: NodeInfo;
|
|
252
|
-
moduleSpecifier?: NodeInfo;
|
|
253
|
-
namedBindings?: NodeInfo;
|
|
254
|
-
exportClause?: NodeInfo;
|
|
255
|
-
incrementor?: NodeInfo;
|
|
256
|
-
statement?: NodeInfo;
|
|
257
|
-
caseBlock?: NodeInfo;
|
|
258
|
-
clauses?: NodeInfo[];
|
|
259
|
-
tryBlock?: NodeInfo;
|
|
260
|
-
catchClause?: NodeInfo;
|
|
261
|
-
finallyBlock?: NodeInfo;
|
|
262
|
-
variableDeclaration?: NodeInfo;
|
|
263
|
-
block?: NodeInfo;
|
|
264
|
-
argumentExpression?: NodeInfo;
|
|
265
|
-
equalsToken?: NodeInfo;
|
|
266
|
-
objectAssignmentInitializer?: NodeInfo;
|
|
267
|
-
head?: NodeInfo;
|
|
268
|
-
templateSpans?: NodeInfo[];
|
|
269
|
-
literal?: NodeInfo;
|
|
270
|
-
tag?: NodeInfo;
|
|
271
|
-
template?: NodeInfo;
|
|
272
|
-
questionToken?: NodeInfo;
|
|
273
|
-
dotDotDotToken?: NodeInfo;
|
|
274
|
-
exclamationToken?: NodeInfo;
|
|
275
|
-
asteriskToken?: NodeInfo;
|
|
276
|
-
equalsGreaterThanToken?: NodeInfo;
|
|
277
|
-
questionDotToken?: NodeInfo;
|
|
278
|
-
typeArguments?: NodeInfo[];
|
|
279
|
-
constraint?: NodeInfo;
|
|
280
|
-
defaultType?: NodeInfo;
|
|
281
|
-
locals?: SymbolInfo[];
|
|
282
|
-
endOfFileToken?: NodeInfo;
|
|
283
|
-
imports?: NodeInfo[];
|
|
284
|
-
isDeclarationFile?: boolean;
|
|
285
|
-
scriptKind?: number;
|
|
286
|
-
identifierCount?: number;
|
|
287
|
-
symbolCount?: number;
|
|
288
|
-
nodeCount?: number;
|
|
289
|
-
listMetas?: Record<string, NodeListMeta>;
|
|
290
|
-
}
|
|
291
|
-
|
|
292
|
-
/**
|
|
293
|
-
* NodeList metadata (Pos, End, HasTrailingComma)
|
|
294
|
-
*/
|
|
295
|
-
declare interface NodeListMeta {
|
|
296
|
-
pos: number;
|
|
297
|
-
end: number;
|
|
298
|
-
hasTrailingComma: boolean;
|
|
299
|
-
}
|
|
300
|
-
|
|
301
|
-
/**
|
|
302
|
-
* Node.js implementation of RslintService using child processes
|
|
303
|
-
*/
|
|
304
|
-
export declare class NodeRslintService implements RslintServiceInterface {
|
|
305
|
-
private nextMessageId;
|
|
306
|
-
private readonly pendingMessages;
|
|
307
|
-
private readonly rslintPath;
|
|
308
|
-
private readonly process;
|
|
309
|
-
private chunks;
|
|
310
|
-
private chunkSize;
|
|
311
|
-
private expectedSize;
|
|
312
|
-
constructor(options?: RSlintOptions);
|
|
313
|
-
/**
|
|
314
|
-
* Send a message to the rslint process
|
|
315
|
-
*/
|
|
316
|
-
sendMessage(kind: string, data: any): Promise<any>;
|
|
317
|
-
/**
|
|
318
|
-
* Handle incoming binary data chunks
|
|
319
|
-
*/
|
|
320
|
-
private handleChunk;
|
|
321
|
-
/**
|
|
322
|
-
* Handle a complete message from rslint
|
|
323
|
-
*/
|
|
324
|
-
private handleMessage;
|
|
325
|
-
/**
|
|
326
|
-
* Terminate the rslint process
|
|
327
|
-
*/
|
|
328
|
-
terminate(): void;
|
|
329
|
-
}
|
|
330
|
-
|
|
331
|
-
/**
|
|
332
|
-
* Function parameter information (deprecated - use SymbolInfo instead)
|
|
333
|
-
*/
|
|
334
|
-
export declare interface ParameterInfo {
|
|
335
|
-
name: string;
|
|
336
|
-
type?: TypeInfo;
|
|
337
|
-
optional: boolean;
|
|
338
|
-
rest: boolean;
|
|
339
|
-
}
|
|
340
|
-
|
|
341
|
-
export declare interface ParserOptions {
|
|
342
|
-
projectService?: boolean;
|
|
343
|
-
project?: string[] | string;
|
|
344
|
-
}
|
|
345
|
-
|
|
346
121
|
/**
|
|
347
122
|
* TypeScript parser options. `project` may be a single tsconfig path or a list.
|
|
348
123
|
*/
|
|
349
|
-
declare interface
|
|
124
|
+
declare interface ParserOptions {
|
|
350
125
|
/**
|
|
351
126
|
* Enable project service for typed linting (runs the TypeScript language
|
|
352
127
|
* service behind the scenes).
|
|
@@ -365,25 +140,12 @@ declare interface ParserOptions_2 {
|
|
|
365
140
|
project?: string | string[];
|
|
366
141
|
}
|
|
367
142
|
|
|
368
|
-
/**
|
|
369
|
-
* Shared types for rslint IPC protocol across all environments
|
|
370
|
-
*/
|
|
371
|
-
declare interface Position {
|
|
372
|
-
line: number;
|
|
373
|
-
column: number;
|
|
374
|
-
}
|
|
375
|
-
|
|
376
143
|
export declare const promisePlugin: {
|
|
377
144
|
configs: {
|
|
378
145
|
recommended: RslintConfigEntry;
|
|
379
146
|
};
|
|
380
147
|
};
|
|
381
148
|
|
|
382
|
-
declare interface Range {
|
|
383
|
-
start: Position;
|
|
384
|
-
end: Position;
|
|
385
|
-
}
|
|
386
|
-
|
|
387
149
|
export declare const reactHooksPlugin: {
|
|
388
150
|
configs: {
|
|
389
151
|
recommended: RslintConfigEntry;
|
|
@@ -396,6 +158,41 @@ export declare const reactPlugin: {
|
|
|
396
158
|
};
|
|
397
159
|
};
|
|
398
160
|
|
|
161
|
+
export declare class Rslint {
|
|
162
|
+
#private;
|
|
163
|
+
constructor(options?: RslintOptions);
|
|
164
|
+
/**
|
|
165
|
+
* Lint a string of code as if it lived at `filePath` (default a synthetic
|
|
166
|
+
* `.ts` path).
|
|
167
|
+
*
|
|
168
|
+
* ESLint-alignment note: if `code` begins with a UTF-8 BOM, the reported
|
|
169
|
+
* offsets (`fix.range`, `column`) are relative to the BOM-included input you
|
|
170
|
+
* passed — self-consistent within that input (result `output`, line/column,
|
|
171
|
+
* and re-applying `fix` all line up), but one unit ahead of ESLint v10, which
|
|
172
|
+
* strips a leading BOM from its in-memory source. (The overlay keeps the BOM
|
|
173
|
+
* and Go's offsets include it; lintFiles is unaffected because Go reads disk
|
|
174
|
+
* files BOM-stripped.) Strip a leading `U+FEFF` first for ESLint-identical
|
|
175
|
+
* offsets.
|
|
176
|
+
*/
|
|
177
|
+
lintText(code: string, options?: {
|
|
178
|
+
filePath?: string;
|
|
179
|
+
}): Promise<LintResult[]>;
|
|
180
|
+
/**
|
|
181
|
+
* Lint files matched by glob pattern(s), resolved against `cwd`. Results are
|
|
182
|
+
* ordered by the linted file's path (deterministic), not by glob-walk order.
|
|
183
|
+
*/
|
|
184
|
+
lintFiles(patterns: string | string[]): Promise<LintResult[]>;
|
|
185
|
+
/**
|
|
186
|
+
* Write the `output` of each result back to its file. Mirrors ESLint's
|
|
187
|
+
* guards: only when `output` is a string and `filePath` is absolute (so a
|
|
188
|
+
* lintText `<text>` result is skipped automatically).
|
|
189
|
+
*/
|
|
190
|
+
static outputFixes(results: LintResult[]): Promise<void>;
|
|
191
|
+
/** Tear down the long-lived Go `--api` process. */
|
|
192
|
+
close(): Promise<void>;
|
|
193
|
+
[Symbol.asyncDispose](): Promise<void>;
|
|
194
|
+
}
|
|
195
|
+
|
|
399
196
|
/** Top-level rslint config: an array of entries. */
|
|
400
197
|
declare type RslintConfig = RslintConfigEntry[];
|
|
401
198
|
|
|
@@ -419,7 +216,7 @@ export declare interface RslintConfigEntry {
|
|
|
419
216
|
*/
|
|
420
217
|
ignores?: string[];
|
|
421
218
|
/** Language-level configuration (parser, etc.). */
|
|
422
|
-
languageOptions?:
|
|
219
|
+
languageOptions?: LanguageOptions;
|
|
423
220
|
/**
|
|
424
221
|
* Plugins enabled for this entry. Two forms:
|
|
425
222
|
*
|
|
@@ -457,39 +254,34 @@ export declare interface RslintConfigEntry {
|
|
|
457
254
|
rules?: RulesRecord;
|
|
458
255
|
}
|
|
459
256
|
|
|
460
|
-
export declare interface
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
/**
|
|
466
|
-
* Main RslintService class that automatically uses the appropriate implementation
|
|
467
|
-
*/
|
|
468
|
-
export declare class RSLintService {
|
|
469
|
-
private readonly service;
|
|
470
|
-
constructor(service: RslintServiceInterface);
|
|
471
|
-
/**
|
|
472
|
-
* Run the linter on specified files
|
|
473
|
-
*/
|
|
474
|
-
lint(options?: LintOptions): Promise<LintResponse>;
|
|
475
|
-
/**
|
|
476
|
-
* Apply fixes to a file based on diagnostics
|
|
477
|
-
*/
|
|
478
|
-
applyFixes(options: ApplyFixesRequest): Promise<ApplyFixesResponse>;
|
|
257
|
+
export declare interface RslintOptions {
|
|
258
|
+
/** Base directory for config discovery and relative path resolution. */
|
|
259
|
+
cwd?: string;
|
|
260
|
+
/** Extra config appended after the resolved/discovered config (ESLint's overrideConfig). */
|
|
261
|
+
overrideConfig?: RslintConfigEntry | RslintConfigEntry[] | null;
|
|
479
262
|
/**
|
|
480
|
-
*
|
|
481
|
-
*
|
|
263
|
+
* `string` — use this config file (no discovery).
|
|
264
|
+
* `true` — use only `overrideConfig` (no file, no discovery).
|
|
265
|
+
* `null`/absent — auto-discover the nearest config (ESLint v10 semantics; no `false`).
|
|
482
266
|
*/
|
|
483
|
-
|
|
267
|
+
overrideConfigFile?: string | true | null;
|
|
268
|
+
/** Apply rule auto-fixes; results carry `output` (the JS side persists via outputFixes). */
|
|
269
|
+
fix?: boolean;
|
|
484
270
|
/**
|
|
485
|
-
*
|
|
271
|
+
* In-memory file overlay (path → content) for fully in-memory linting (issue
|
|
272
|
+
* #1106): put the `tsconfig.json` that `parserOptions.project` names plus any
|
|
273
|
+
* dependency files here, then lint a buffer with `lintText`. Keys resolve
|
|
274
|
+
* against `cwd` like a linted path (relative or absolute both work); a
|
|
275
|
+
* same-path `lintText` code entry wins. Inside the tsconfig (`files`) and
|
|
276
|
+
* `parserOptions.project`, use relative paths — the TS compiler resolves
|
|
277
|
+
* those, and a bare POSIX-absolute path there has no drive letter on Windows,
|
|
278
|
+
* so it won't match the overlay. rslint-only — ESLint has no in-memory file
|
|
279
|
+
* map.
|
|
280
|
+
*
|
|
281
|
+
* Give the tsconfig explicit `files`, not a broad `include` glob: a glob is
|
|
282
|
+
* expanded against the real filesystem and would scan `cwd` on disk.
|
|
486
283
|
*/
|
|
487
|
-
|
|
488
|
-
}
|
|
489
|
-
|
|
490
|
-
export declare interface RslintServiceInterface {
|
|
491
|
-
sendMessage(kind: string, data: any): Promise<any>;
|
|
492
|
-
terminate(): void;
|
|
284
|
+
virtualFiles?: Record<string, string>;
|
|
493
285
|
}
|
|
494
286
|
|
|
495
287
|
/**
|
|
@@ -524,42 +316,6 @@ declare type RuleSeverity = 'off' | 'warn' | 'error';
|
|
|
524
316
|
*/
|
|
525
317
|
declare type RulesRecord = Record<string, RuleEntry>;
|
|
526
318
|
|
|
527
|
-
/**
|
|
528
|
-
* Detailed information about a function/method signature
|
|
529
|
-
*/
|
|
530
|
-
export declare interface SignatureInfo {
|
|
531
|
-
flags: number;
|
|
532
|
-
flagNames?: string[];
|
|
533
|
-
minArgumentCount: number;
|
|
534
|
-
pos?: number;
|
|
535
|
-
fileName?: string;
|
|
536
|
-
parameters?: SymbolInfo[];
|
|
537
|
-
thisParameter?: SymbolInfo;
|
|
538
|
-
typeParameters?: TypeInfo[];
|
|
539
|
-
returnType?: TypeInfo;
|
|
540
|
-
typePredicate?: TypePredicateInfo;
|
|
541
|
-
declaration?: NodeInfo;
|
|
542
|
-
}
|
|
543
|
-
|
|
544
|
-
/**
|
|
545
|
-
* Detailed information about a TypeScript symbol
|
|
546
|
-
*/
|
|
547
|
-
export declare interface SymbolInfo {
|
|
548
|
-
id?: number;
|
|
549
|
-
name: string;
|
|
550
|
-
escapedName?: string;
|
|
551
|
-
flags: number;
|
|
552
|
-
flagNames?: string[];
|
|
553
|
-
checkFlags?: number;
|
|
554
|
-
checkFlagNames?: string[];
|
|
555
|
-
pos?: number;
|
|
556
|
-
fileName?: string;
|
|
557
|
-
declarations?: NodeInfo[];
|
|
558
|
-
valueDeclaration?: NodeInfo;
|
|
559
|
-
members?: SymbolInfo[];
|
|
560
|
-
exports?: SymbolInfo[];
|
|
561
|
-
}
|
|
562
|
-
|
|
563
319
|
export declare const ts: {
|
|
564
320
|
configs: {
|
|
565
321
|
base: RslintConfigEntry;
|
|
@@ -567,56 +323,6 @@ export declare const ts: {
|
|
|
567
323
|
};
|
|
568
324
|
};
|
|
569
325
|
|
|
570
|
-
/**
|
|
571
|
-
* Detailed information about a TypeScript type
|
|
572
|
-
*/
|
|
573
|
-
export declare interface TypeInfo {
|
|
574
|
-
id?: number;
|
|
575
|
-
flags: number;
|
|
576
|
-
flagNames?: string[];
|
|
577
|
-
objectFlags?: number;
|
|
578
|
-
objectFlagNames?: string[];
|
|
579
|
-
intrinsicName?: string;
|
|
580
|
-
typeString: string;
|
|
581
|
-
pos?: number;
|
|
582
|
-
fileName?: string;
|
|
583
|
-
value?: unknown;
|
|
584
|
-
freshType?: TypeInfo;
|
|
585
|
-
regularType?: TypeInfo;
|
|
586
|
-
symbol?: SymbolInfo;
|
|
587
|
-
aliasSymbol?: SymbolInfo;
|
|
588
|
-
typeArguments?: TypeInfo[];
|
|
589
|
-
baseTypes?: TypeInfo[];
|
|
590
|
-
properties?: SymbolInfo[];
|
|
591
|
-
callSignatures?: SignatureInfo[];
|
|
592
|
-
constructSignatures?: SignatureInfo[];
|
|
593
|
-
indexInfos?: IndexInfo[];
|
|
594
|
-
types?: TypeInfo[];
|
|
595
|
-
constraint?: TypeInfo;
|
|
596
|
-
default?: TypeInfo;
|
|
597
|
-
target?: TypeInfo;
|
|
598
|
-
}
|
|
599
|
-
|
|
600
|
-
/**
|
|
601
|
-
* Generic type parameter information
|
|
602
|
-
*/
|
|
603
|
-
export declare interface TypeParamInfo {
|
|
604
|
-
name: string;
|
|
605
|
-
constraint?: TypeInfo;
|
|
606
|
-
default?: TypeInfo;
|
|
607
|
-
}
|
|
608
|
-
|
|
609
|
-
/**
|
|
610
|
-
* Type predicate information for type guards
|
|
611
|
-
*/
|
|
612
|
-
export declare interface TypePredicateInfo {
|
|
613
|
-
kind: number;
|
|
614
|
-
kindName: string;
|
|
615
|
-
parameterName?: string;
|
|
616
|
-
parameterIndex?: number;
|
|
617
|
-
type?: TypeInfo;
|
|
618
|
-
}
|
|
619
|
-
|
|
620
326
|
export declare const unicornPlugin: {
|
|
621
327
|
configs: {
|
|
622
328
|
recommended: RslintConfigEntry;
|