@rslint/core 0.5.3 → 0.5.4-canary.1781059600
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/bin/rslint.cjs +21 -4
- package/dist/0~engine.js +406 -0
- package/dist/34.js +33 -0
- package/dist/browser.d.ts +52 -39
- package/dist/browser.js +42 -74
- package/dist/cli.d.ts +3 -2
- package/dist/cli.js +1051 -93
- package/dist/config-loader.d.ts +45 -14
- package/dist/config-loader.js +95 -59
- package/dist/eslint-plugin/612.js +43 -0
- package/dist/eslint-plugin/index.d.ts +892 -0
- package/dist/eslint-plugin/index.js +26692 -0
- package/dist/eslint-plugin/lint-worker.js +26225 -0
- package/dist/eslint-plugin/types.d.ts +23 -0
- package/dist/eslint-plugin/types.js +1 -0
- package/dist/index.d.ts +626 -19
- package/dist/index.js +598 -15
- package/dist/service.d.ts +360 -30
- package/dist/service.js +19 -34
- package/package.json +27 -11
- package/dist/browser.d.ts.map +0 -1
- package/dist/cli.d.ts.map +0 -1
- package/dist/config-loader.d.ts.map +0 -1
- package/dist/configs/import.d.ts +0 -6
- package/dist/configs/import.d.ts.map +0 -1
- package/dist/configs/import.js +0 -7
- package/dist/configs/index.d.ts +0 -47
- package/dist/configs/index.d.ts.map +0 -1
- package/dist/configs/index.js +0 -36
- package/dist/configs/javascript.d.ts +0 -6
- package/dist/configs/javascript.d.ts.map +0 -1
- package/dist/configs/javascript.js +0 -72
- package/dist/configs/jest.d.ts +0 -7
- package/dist/configs/jest.d.ts.map +0 -1
- package/dist/configs/jest.js +0 -35
- package/dist/configs/jsx-a11y.d.ts +0 -6
- package/dist/configs/jsx-a11y.d.ts.map +0 -1
- package/dist/configs/jsx-a11y.js +0 -135
- package/dist/configs/promise.d.ts +0 -6
- package/dist/configs/promise.d.ts.map +0 -1
- package/dist/configs/promise.js +0 -20
- package/dist/configs/react-hooks.d.ts +0 -6
- package/dist/configs/react-hooks.d.ts.map +0 -1
- package/dist/configs/react-hooks.js +0 -24
- package/dist/configs/react.d.ts +0 -6
- package/dist/configs/react.d.ts.map +0 -1
- package/dist/configs/react.js +0 -31
- package/dist/configs/typescript.d.ts +0 -9
- package/dist/configs/typescript.d.ts.map +0 -1
- package/dist/configs/typescript.js +0 -122
- package/dist/configs/unicorn.d.ts +0 -8
- package/dist/configs/unicorn.d.ts.map +0 -1
- package/dist/configs/unicorn.js +0 -161
- package/dist/define-config.d.ts +0 -110
- package/dist/define-config.d.ts.map +0 -1
- package/dist/define-config.js +0 -6
- package/dist/index.d.ts.map +0 -1
- package/dist/node.d.ts +0 -31
- package/dist/node.d.ts.map +0 -1
- package/dist/node.js +0 -116
- package/dist/service.d.ts.map +0 -1
- package/dist/tsconfig.build.tsbuildinfo +0 -1
- package/dist/types.d.ts +0 -342
- package/dist/types.d.ts.map +0 -1
- package/dist/types.js +0 -1
- package/dist/utils/args.d.ts +0 -19
- package/dist/utils/args.d.ts.map +0 -1
- package/dist/utils/args.js +0 -101
- package/dist/utils/config-discovery.d.ts +0 -47
- package/dist/utils/config-discovery.d.ts.map +0 -1
- package/dist/utils/config-discovery.js +0 -238
- package/dist/worker.d.ts +0 -2
- package/dist/worker.d.ts.map +0 -1
- package/dist/worker.js +0 -114
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Types shared between the eslint-plugin host and its lint workers.
|
|
3
|
+
*
|
|
4
|
+
* Wire-format / IPC frame types (the Go↔Node frame contract) live in
|
|
5
|
+
* `src/ipc/protocol.ts` — the single source the CLI host consumes.
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* Per-config descriptor handed to the worker pool. Each worker imports
|
|
9
|
+
* every descriptor's `configPath` once at init, then routes per-file
|
|
10
|
+
* lint tasks via `configKey === configDirectory` to the right plugin
|
|
11
|
+
* instances. The `configDirectory` here MUST match the value Go writes
|
|
12
|
+
* into `EslintPluginLintFile.ConfigKey` byte-for-byte; the worker uses
|
|
13
|
+
* it as a Map key for per-file dispatch.
|
|
14
|
+
*/
|
|
15
|
+
export declare interface ConfigDescriptor {
|
|
16
|
+
/** Absolute filesystem path of the rslint config file (`rslint.config.{js,mjs,ts,mts}`). */
|
|
17
|
+
configPath: string;
|
|
18
|
+
/** Absolute filesystem path of the directory holding the config file.
|
|
19
|
+
* Matches the `ConfigKey` Go emits per file during plugin-lint dispatch. */
|
|
20
|
+
configDirectory: string;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export { }
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,19 +1,626 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
export
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
export
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
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
|
+
/**
|
|
16
|
+
* Type-safe config helper. Returns the config array as-is (identity function).
|
|
17
|
+
*/
|
|
18
|
+
export declare function defineConfig(config: RslintConfig): RslintConfig;
|
|
19
|
+
|
|
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
|
+
/**
|
|
31
|
+
* A real ESLint plugin object, as exported by community packages
|
|
32
|
+
* (`eslint-plugin-unicorn`, etc.). Only the fields rslint consumes are
|
|
33
|
+
* typed; the open index keeps arbitrary plugin shapes assignable.
|
|
34
|
+
*/
|
|
35
|
+
export declare interface ESLintPlugin {
|
|
36
|
+
meta?: {
|
|
37
|
+
name?: string;
|
|
38
|
+
version?: string;
|
|
39
|
+
};
|
|
40
|
+
name?: string;
|
|
41
|
+
rules?: Record<string, unknown>;
|
|
42
|
+
configs?: Record<string, unknown>;
|
|
43
|
+
[key: string]: unknown;
|
|
44
|
+
}
|
|
45
|
+
|
|
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
|
+
/**
|
|
116
|
+
* Define a global-ignores config entry.
|
|
117
|
+
*
|
|
118
|
+
* Mirrors ESLint's `globalIgnores` helper: returns a config entry that contains
|
|
119
|
+
* only `ignores`. Because the entry has no `files` (and no rules/plugins/etc.),
|
|
120
|
+
* the patterns are treated as *global* ignores — applied across every other
|
|
121
|
+
* config entry — instead of being scoped to a single entry's `files`.
|
|
122
|
+
*
|
|
123
|
+
* @example
|
|
124
|
+
* export default defineConfig([
|
|
125
|
+
* globalIgnores(['dist/**', 'coverage/**']),
|
|
126
|
+
* { files: ['src/**'], rules: { 'no-console': 'error' } },
|
|
127
|
+
* ]);
|
|
128
|
+
*/
|
|
129
|
+
export declare function globalIgnores(ignorePatterns: string[]): RslintConfigEntry;
|
|
130
|
+
|
|
131
|
+
export declare const importPlugin: {
|
|
132
|
+
configs: {
|
|
133
|
+
recommended: RslintConfigEntry;
|
|
134
|
+
};
|
|
135
|
+
};
|
|
136
|
+
|
|
137
|
+
/**
|
|
138
|
+
* Index signature information
|
|
139
|
+
*/
|
|
140
|
+
export declare interface IndexInfo {
|
|
141
|
+
keyType: TypeInfo;
|
|
142
|
+
valueType: TypeInfo;
|
|
143
|
+
isReadonly: boolean;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
export declare const jestPlugin: {
|
|
147
|
+
configs: {
|
|
148
|
+
recommended: RslintConfigEntry;
|
|
149
|
+
style: RslintConfigEntry;
|
|
150
|
+
};
|
|
151
|
+
};
|
|
152
|
+
|
|
153
|
+
export declare const js: {
|
|
154
|
+
configs: {
|
|
155
|
+
recommended: RslintConfigEntry;
|
|
156
|
+
};
|
|
157
|
+
};
|
|
158
|
+
|
|
159
|
+
export declare const jsxA11yPlugin: {
|
|
160
|
+
configs: {
|
|
161
|
+
recommended: RslintConfigEntry;
|
|
162
|
+
};
|
|
163
|
+
};
|
|
164
|
+
|
|
165
|
+
/**
|
|
166
|
+
* Plugin declaration names recognized by rslint's loader.
|
|
167
|
+
*/
|
|
168
|
+
declare type KnownPlugin = (typeof NATIVE_PLUGINS)[number];
|
|
169
|
+
|
|
170
|
+
export declare interface LanguageOptions {
|
|
171
|
+
parserOptions?: ParserOptions;
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
/**
|
|
175
|
+
* Language-specific configuration.
|
|
176
|
+
*/
|
|
177
|
+
declare interface LanguageOptions_2 {
|
|
178
|
+
parserOptions?: ParserOptions_2;
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
export declare function lint(options: LintOptions): Promise<LintResponse>;
|
|
182
|
+
|
|
183
|
+
export declare interface LintOptions {
|
|
184
|
+
files?: string[];
|
|
185
|
+
config?: string;
|
|
186
|
+
workingDirectory?: string;
|
|
187
|
+
ruleOptions?: Record<string, string>;
|
|
188
|
+
fileContents?: Record<string, string>;
|
|
189
|
+
languageOptions?: LanguageOptions;
|
|
190
|
+
includeEncodedSourceFiles?: boolean;
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
export declare interface LintResponse {
|
|
194
|
+
diagnostics: Diagnostic[];
|
|
195
|
+
errorCount: number;
|
|
196
|
+
fileCount: number;
|
|
197
|
+
ruleCount: number;
|
|
198
|
+
duration: string;
|
|
199
|
+
encodedSourceFiles?: Record<string, string>;
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
/**
|
|
203
|
+
* Source of truth for the rule prefixes owned by rslint's built-in
|
|
204
|
+
* (natively-ported) plugins; the `KnownPlugin` type union derives from it.
|
|
205
|
+
* `NATIVE_PLUGIN_RESERVED_NAMES` unions these prefixes with the alternate
|
|
206
|
+
* `eslint-plugin-*` declaration names (`NATIVE_PLUGIN_DECL_ALIASES`), so a
|
|
207
|
+
* ported plugin that also has such an alias must be added to BOTH lists here —
|
|
208
|
+
* kept in sync with config.go's PluginInfo.DeclNames (a Go test guards the drift).
|
|
209
|
+
*/
|
|
210
|
+
declare const NATIVE_PLUGINS: readonly ["@typescript-eslint", "import", "jest", "jsx-a11y", "promise", "react", "react-hooks", "unicorn"];
|
|
211
|
+
|
|
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
|
+
/**
|
|
347
|
+
* TypeScript parser options. `project` may be a single tsconfig path or a list.
|
|
348
|
+
*/
|
|
349
|
+
declare interface ParserOptions_2 {
|
|
350
|
+
/**
|
|
351
|
+
* Enable project service for typed linting (runs the TypeScript language
|
|
352
|
+
* service behind the scenes).
|
|
353
|
+
*/
|
|
354
|
+
projectService?: boolean;
|
|
355
|
+
/**
|
|
356
|
+
* tsconfig.json path(s) used for typed linting. Glob patterns are supported.
|
|
357
|
+
*
|
|
358
|
+
* @example
|
|
359
|
+
* project: './tsconfig.json'
|
|
360
|
+
* @example
|
|
361
|
+
* project: ['./tsconfig.app.json', './tsconfig.node.json']
|
|
362
|
+
* @example
|
|
363
|
+
* project: ['./tsconfig.*.json']
|
|
364
|
+
*/
|
|
365
|
+
project?: string | string[];
|
|
366
|
+
}
|
|
367
|
+
|
|
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
|
+
export declare const promisePlugin: {
|
|
377
|
+
configs: {
|
|
378
|
+
recommended: RslintConfigEntry;
|
|
379
|
+
};
|
|
380
|
+
};
|
|
381
|
+
|
|
382
|
+
declare interface Range {
|
|
383
|
+
start: Position;
|
|
384
|
+
end: Position;
|
|
385
|
+
}
|
|
386
|
+
|
|
387
|
+
export declare const reactHooksPlugin: {
|
|
388
|
+
configs: {
|
|
389
|
+
recommended: RslintConfigEntry;
|
|
390
|
+
};
|
|
391
|
+
};
|
|
392
|
+
|
|
393
|
+
export declare const reactPlugin: {
|
|
394
|
+
configs: {
|
|
395
|
+
recommended: RslintConfigEntry;
|
|
396
|
+
};
|
|
397
|
+
};
|
|
398
|
+
|
|
399
|
+
/** Top-level rslint config: an array of entries. */
|
|
400
|
+
declare type RslintConfig = RslintConfigEntry[];
|
|
401
|
+
|
|
402
|
+
/**
|
|
403
|
+
* A single entry in an rslint config array. Multiple entries may target
|
|
404
|
+
* different file globs and are merged at lint time.
|
|
405
|
+
*/
|
|
406
|
+
export declare interface RslintConfigEntry {
|
|
407
|
+
/**
|
|
408
|
+
* Glob patterns for files this entry applies to.
|
|
409
|
+
*
|
|
410
|
+
* @example
|
|
411
|
+
* files: ['src/**', 'tests/**']
|
|
412
|
+
*/
|
|
413
|
+
files?: string[];
|
|
414
|
+
/**
|
|
415
|
+
* Glob patterns excluded from this entry.
|
|
416
|
+
*
|
|
417
|
+
* @example
|
|
418
|
+
* ignores: ['node_modules/**', 'dist/**']
|
|
419
|
+
*/
|
|
420
|
+
ignores?: string[];
|
|
421
|
+
/** Language-level configuration (parser, etc.). */
|
|
422
|
+
languageOptions?: LanguageOptions_2;
|
|
423
|
+
/**
|
|
424
|
+
* Plugins enabled for this entry. Two forms:
|
|
425
|
+
*
|
|
426
|
+
* - **Array of names** — built-in (natively-ported) plugins, e.g.
|
|
427
|
+
* `plugins: ['@typescript-eslint', 'unicorn']`. Built-in names are listed
|
|
428
|
+
* for autocomplete; arbitrary strings are still accepted. Each built-in
|
|
429
|
+
* maps to the ESLint plugin it ports rules from:
|
|
430
|
+
* `'@typescript-eslint'` → `@typescript-eslint/eslint-plugin`,
|
|
431
|
+
* `'import'` → `eslint-plugin-import`, `'jest'` → `eslint-plugin-jest`,
|
|
432
|
+
* `'jsx-a11y'` → `eslint-plugin-jsx-a11y`, `'promise'` → `eslint-plugin-promise`,
|
|
433
|
+
* `'react'` → `eslint-plugin-react`, `'react-hooks'` → `eslint-plugin-react-hooks`,
|
|
434
|
+
* `'unicorn'` → `eslint-plugin-unicorn`.
|
|
435
|
+
*
|
|
436
|
+
* - **Object of plugin instances** — community ESLint plugins mounted by
|
|
437
|
+
* prefix, e.g. `{ unicorn }` after `import unicorn from 'eslint-plugin-unicorn'`.
|
|
438
|
+
* Their JS rule functions run in a Node worker; only `{prefix, ruleNames}`
|
|
439
|
+
* metadata reaches the Go core. The live objects never cross the wire — the
|
|
440
|
+
* worker re-imports this config file to obtain them, so local-path and
|
|
441
|
+
* monorepo-versioned plugins resolve correctly. A prefix may not collide
|
|
442
|
+
* with a built-in plugin name.
|
|
443
|
+
*
|
|
444
|
+
* A single entry uses one form. To combine built-in and community plugins,
|
|
445
|
+
* declare them in separate config entries (merged at lint time).
|
|
446
|
+
*
|
|
447
|
+
* @example
|
|
448
|
+
* plugins: ['@typescript-eslint', 'unicorn']
|
|
449
|
+
* @example
|
|
450
|
+
* import unicorn from 'eslint-plugin-unicorn';
|
|
451
|
+
* export default [{ plugins: { unicorn }, rules: { 'unicorn/no-null': 'error' } }];
|
|
452
|
+
*/
|
|
453
|
+
plugins?: (KnownPlugin | (string & {}))[] | Record<string, ESLintPlugin>;
|
|
454
|
+
/** Shared settings accessible to rules. */
|
|
455
|
+
settings?: Record<string, any>;
|
|
456
|
+
/** Rule configuration map. */
|
|
457
|
+
rules?: RulesRecord;
|
|
458
|
+
}
|
|
459
|
+
|
|
460
|
+
export declare interface RSlintOptions {
|
|
461
|
+
rslintPath?: string;
|
|
462
|
+
workingDirectory?: string;
|
|
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>;
|
|
479
|
+
/**
|
|
480
|
+
* Get detailed AST information at a specific position
|
|
481
|
+
* Returns Node, Type, Symbol, Signature, and Flow information
|
|
482
|
+
*/
|
|
483
|
+
getAstInfo(options: GetAstInfoRequest): Promise<GetAstInfoResponse>;
|
|
484
|
+
/**
|
|
485
|
+
* Close the service
|
|
486
|
+
*/
|
|
487
|
+
close(): Promise<void>;
|
|
488
|
+
}
|
|
489
|
+
|
|
490
|
+
export declare interface RslintServiceInterface {
|
|
491
|
+
sendMessage(kind: string, data: any): Promise<any>;
|
|
492
|
+
terminate(): void;
|
|
493
|
+
}
|
|
494
|
+
|
|
495
|
+
/**
|
|
496
|
+
* Configuration value accepted for a single rule.
|
|
497
|
+
*
|
|
498
|
+
* - `RuleSeverity` — just toggle the rule.
|
|
499
|
+
* - `[RuleSeverity, ...args]` — ESLint-style array form. Most rules take a
|
|
500
|
+
* single options object (`[severity, { ... }]`); some accept positional
|
|
501
|
+
* string/object args (`[severity, "always", { ... }]`).
|
|
502
|
+
* - `{ level, options }` — object form supported by the loader.
|
|
503
|
+
*/
|
|
504
|
+
declare type RuleEntry = RuleSeverity | readonly [RuleSeverity, ...any[]] | {
|
|
505
|
+
level: RuleSeverity;
|
|
506
|
+
options?: RuleOptions;
|
|
507
|
+
};
|
|
508
|
+
|
|
509
|
+
/**
|
|
510
|
+
* Rule-specific options object. Each rule defines its own shape; until per-rule
|
|
511
|
+
* types are generated, options are accepted as an open record.
|
|
512
|
+
*/
|
|
513
|
+
declare type RuleOptions = Record<string, any>;
|
|
514
|
+
|
|
515
|
+
/**
|
|
516
|
+
* Severity level for a rule.
|
|
517
|
+
*/
|
|
518
|
+
declare type RuleSeverity = 'off' | 'warn' | 'error';
|
|
519
|
+
|
|
520
|
+
/**
|
|
521
|
+
* Map of rule name → rule configuration. Rule names are `string` (no
|
|
522
|
+
* enumeration of known rules yet); the value shape is what gives editors
|
|
523
|
+
* hints when typing the array or object form.
|
|
524
|
+
*/
|
|
525
|
+
declare type RulesRecord = Record<string, RuleEntry>;
|
|
526
|
+
|
|
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
|
+
export declare const ts: {
|
|
564
|
+
configs: {
|
|
565
|
+
base: RslintConfigEntry;
|
|
566
|
+
recommended: RslintConfigEntry;
|
|
567
|
+
};
|
|
568
|
+
};
|
|
569
|
+
|
|
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
|
+
export declare const unicornPlugin: {
|
|
621
|
+
configs: {
|
|
622
|
+
recommended: RslintConfigEntry;
|
|
623
|
+
};
|
|
624
|
+
};
|
|
625
|
+
|
|
626
|
+
export { }
|