@rslint/core 0.5.2 → 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 -16
- package/dist/configs/index.d.ts.map +0 -1
- package/dist/configs/index.js +0 -32
- 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/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 -8
- package/dist/configs/typescript.d.ts.map +0 -1
- package/dist/configs/typescript.js +0 -119
- 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 -109
- 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
package/dist/index.js
CHANGED
|
@@ -1,31 +1,614 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
1
|
+
import { spawn } from "child_process";
|
|
2
|
+
import path from "path";
|
|
3
|
+
import { RSLintService } from "./service.js";
|
|
4
|
+
class NodeRslintService {
|
|
5
|
+
nextMessageId;
|
|
6
|
+
pendingMessages;
|
|
7
|
+
rslintPath;
|
|
8
|
+
process;
|
|
9
|
+
chunks;
|
|
10
|
+
chunkSize;
|
|
11
|
+
expectedSize;
|
|
12
|
+
constructor(options = {}){
|
|
13
|
+
this.nextMessageId = 1;
|
|
14
|
+
this.pendingMessages = new Map();
|
|
15
|
+
this.rslintPath = options.rslintPath || path.join(import.meta.dirname, '../bin/rslint');
|
|
16
|
+
this.process = spawn(this.rslintPath, [
|
|
17
|
+
'--api'
|
|
18
|
+
], {
|
|
19
|
+
stdio: [
|
|
20
|
+
'pipe',
|
|
21
|
+
'pipe',
|
|
22
|
+
'inherit'
|
|
23
|
+
],
|
|
24
|
+
cwd: options.workingDirectory || process.cwd(),
|
|
25
|
+
env: {
|
|
26
|
+
...process.env
|
|
27
|
+
}
|
|
28
|
+
});
|
|
29
|
+
this.process.stdout.on('data', (data)=>{
|
|
30
|
+
this.handleChunk(data);
|
|
31
|
+
});
|
|
32
|
+
this.chunks = [];
|
|
33
|
+
this.chunkSize = 0;
|
|
34
|
+
this.expectedSize = null;
|
|
35
|
+
}
|
|
36
|
+
async sendMessage(kind, data) {
|
|
37
|
+
return new Promise((resolve, reject)=>{
|
|
38
|
+
const id = this.nextMessageId++;
|
|
39
|
+
const message = {
|
|
40
|
+
id,
|
|
41
|
+
kind,
|
|
42
|
+
data
|
|
43
|
+
};
|
|
44
|
+
this.pendingMessages.set(id, {
|
|
45
|
+
resolve,
|
|
46
|
+
reject
|
|
47
|
+
});
|
|
48
|
+
const json = JSON.stringify(message);
|
|
49
|
+
const jsonBuffer = Buffer.from(json, 'utf8');
|
|
50
|
+
const length = Buffer.alloc(4);
|
|
51
|
+
length.writeUInt32LE(jsonBuffer.length, 0);
|
|
52
|
+
this.process.stdin.write(Buffer.concat([
|
|
53
|
+
length,
|
|
54
|
+
jsonBuffer
|
|
55
|
+
]));
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
handleChunk(chunk) {
|
|
59
|
+
this.chunks.push(chunk);
|
|
60
|
+
this.chunkSize += chunk.length;
|
|
61
|
+
while(true){
|
|
62
|
+
if (null === this.expectedSize) {
|
|
63
|
+
if (this.chunkSize < 4) return;
|
|
64
|
+
const combined = Buffer.concat(this.chunks);
|
|
65
|
+
this.expectedSize = combined.readUInt32LE(0);
|
|
66
|
+
this.chunks = [
|
|
67
|
+
combined.subarray(4)
|
|
68
|
+
];
|
|
69
|
+
this.chunkSize -= 4;
|
|
70
|
+
}
|
|
71
|
+
if (this.chunkSize < this.expectedSize) return;
|
|
72
|
+
const combined = Buffer.concat(this.chunks);
|
|
73
|
+
const message = combined.subarray(0, this.expectedSize).toString('utf8');
|
|
74
|
+
try {
|
|
75
|
+
const parsed = JSON.parse(message);
|
|
76
|
+
this.handleMessage(parsed);
|
|
77
|
+
} catch (err) {
|
|
78
|
+
console.error('Error parsing message:', err);
|
|
79
|
+
}
|
|
80
|
+
this.chunks = [
|
|
81
|
+
combined.subarray(this.expectedSize)
|
|
82
|
+
];
|
|
83
|
+
this.chunkSize = this.chunks[0].length;
|
|
84
|
+
this.expectedSize = null;
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
handleMessage(message) {
|
|
88
|
+
const { id, kind, data } = message;
|
|
89
|
+
const pending = this.pendingMessages.get(id);
|
|
90
|
+
if (!pending) return;
|
|
91
|
+
this.pendingMessages.delete(id);
|
|
92
|
+
if ('error' === kind) pending.reject(new Error(data.message));
|
|
93
|
+
else pending.resolve(data);
|
|
94
|
+
}
|
|
95
|
+
terminate() {
|
|
96
|
+
if (this.process && !this.process.killed) {
|
|
97
|
+
this.process.stdin.end();
|
|
98
|
+
this.process.kill();
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
const base = {
|
|
103
|
+
files: [
|
|
104
|
+
'**/*.ts',
|
|
105
|
+
'**/*.tsx',
|
|
106
|
+
'**/*.mts',
|
|
107
|
+
'**/*.cts'
|
|
108
|
+
],
|
|
109
|
+
plugins: [
|
|
110
|
+
"@typescript-eslint"
|
|
111
|
+
]
|
|
112
|
+
};
|
|
113
|
+
const recommended = {
|
|
114
|
+
...base,
|
|
115
|
+
languageOptions: {
|
|
116
|
+
parserOptions: {
|
|
117
|
+
projectService: true
|
|
118
|
+
}
|
|
119
|
+
},
|
|
120
|
+
rules: {
|
|
121
|
+
'constructor-super': 'off',
|
|
122
|
+
'getter-return': 'off',
|
|
123
|
+
'no-class-assign': 'off',
|
|
124
|
+
'no-const-assign': 'off',
|
|
125
|
+
'no-dupe-args': 'off',
|
|
126
|
+
'no-dupe-class-members': 'off',
|
|
127
|
+
'no-dupe-keys': 'off',
|
|
128
|
+
'no-func-assign': 'off',
|
|
129
|
+
'no-import-assign': 'off',
|
|
130
|
+
'no-new-native-nonconstructor': 'off',
|
|
131
|
+
'no-new-symbol': 'off',
|
|
132
|
+
'no-obj-calls': 'off',
|
|
133
|
+
'no-redeclare': 'off',
|
|
134
|
+
'no-setter-return': 'off',
|
|
135
|
+
'no-this-before-super': 'off',
|
|
136
|
+
'no-undef': 'off',
|
|
137
|
+
'no-unreachable': 'off',
|
|
138
|
+
'no-unsafe-negation': 'off',
|
|
139
|
+
'no-with': 'off',
|
|
140
|
+
'no-var': 'error',
|
|
141
|
+
'prefer-const': 'error',
|
|
142
|
+
'prefer-rest-params': 'error',
|
|
143
|
+
'prefer-spread': 'error',
|
|
144
|
+
'no-control-regex': 'error',
|
|
145
|
+
'no-delete-var': 'error',
|
|
146
|
+
'no-dupe-else-if': 'error',
|
|
147
|
+
'no-empty-character-class': 'error',
|
|
148
|
+
'no-ex-assign': 'error',
|
|
149
|
+
'no-extra-boolean-cast': 'error',
|
|
150
|
+
'no-fallthrough': 'error',
|
|
151
|
+
'no-global-assign': 'error',
|
|
152
|
+
'no-invalid-regexp': 'error',
|
|
153
|
+
'no-irregular-whitespace': 'error',
|
|
154
|
+
'no-misleading-character-class': 'error',
|
|
155
|
+
'no-nonoctal-decimal-escape': 'error',
|
|
156
|
+
'no-octal': 'error',
|
|
157
|
+
'no-prototype-builtins': 'error',
|
|
158
|
+
'no-regex-spaces': 'error',
|
|
159
|
+
'no-self-assign': 'error',
|
|
160
|
+
'no-shadow-restricted-names': 'error',
|
|
161
|
+
'no-unexpected-multiline': 'error',
|
|
162
|
+
'no-unsafe-finally': 'error',
|
|
163
|
+
'no-unsafe-optional-chaining': 'error',
|
|
164
|
+
'no-useless-backreference': 'error',
|
|
165
|
+
'no-useless-catch': 'error',
|
|
166
|
+
'no-useless-escape': 'error',
|
|
167
|
+
'require-yield': 'error',
|
|
168
|
+
'use-isnan': 'error',
|
|
169
|
+
'valid-typeof': 'error',
|
|
170
|
+
'for-direction': 'error',
|
|
171
|
+
'no-async-promise-executor': 'error',
|
|
172
|
+
'no-case-declarations': 'error',
|
|
173
|
+
'no-compare-neg-zero': 'error',
|
|
174
|
+
'no-cond-assign': 'error',
|
|
175
|
+
'no-constant-binary-expression': 'error',
|
|
176
|
+
'no-constant-condition': 'error',
|
|
177
|
+
'no-debugger': 'error',
|
|
178
|
+
'no-duplicate-case': 'error',
|
|
179
|
+
'no-empty': 'error',
|
|
180
|
+
'no-empty-pattern': 'error',
|
|
181
|
+
'no-loss-of-precision': 'error',
|
|
182
|
+
'no-sparse-arrays': 'error',
|
|
183
|
+
"@typescript-eslint/ban-ts-comment": 'error',
|
|
184
|
+
'no-array-constructor': 'off',
|
|
185
|
+
"@typescript-eslint/no-array-constructor": 'error',
|
|
186
|
+
"@typescript-eslint/no-duplicate-enum-values": 'error',
|
|
187
|
+
"@typescript-eslint/no-empty-object-type": 'error',
|
|
188
|
+
"@typescript-eslint/no-explicit-any": 'error',
|
|
189
|
+
"@typescript-eslint/no-extra-non-null-assertion": 'error',
|
|
190
|
+
"@typescript-eslint/no-misused-new": 'error',
|
|
191
|
+
"@typescript-eslint/no-namespace": 'error',
|
|
192
|
+
"@typescript-eslint/no-non-null-asserted-optional-chain": 'error',
|
|
193
|
+
"@typescript-eslint/no-require-imports": 'error',
|
|
194
|
+
"@typescript-eslint/no-this-alias": 'error',
|
|
195
|
+
"@typescript-eslint/no-unnecessary-type-constraint": 'error',
|
|
196
|
+
"@typescript-eslint/no-unsafe-declaration-merging": 'error',
|
|
197
|
+
"@typescript-eslint/no-unsafe-function-type": 'error',
|
|
198
|
+
'no-unused-expressions': 'off',
|
|
199
|
+
"@typescript-eslint/no-unused-expressions": 'error',
|
|
200
|
+
'no-unused-vars': 'off',
|
|
201
|
+
"@typescript-eslint/no-unused-vars": [
|
|
202
|
+
'error',
|
|
203
|
+
{
|
|
204
|
+
varsIgnorePattern: '^_',
|
|
205
|
+
argsIgnorePattern: '^_'
|
|
206
|
+
}
|
|
207
|
+
],
|
|
208
|
+
"@typescript-eslint/no-wrapper-object-types": 'error',
|
|
209
|
+
"@typescript-eslint/prefer-as-const": 'error',
|
|
210
|
+
"@typescript-eslint/prefer-namespace-keyword": 'error',
|
|
211
|
+
"@typescript-eslint/triple-slash-reference": 'error'
|
|
212
|
+
}
|
|
213
|
+
};
|
|
214
|
+
const javascript_recommended = {
|
|
215
|
+
files: [
|
|
216
|
+
'**/*.js',
|
|
217
|
+
'**/*.jsx',
|
|
218
|
+
'**/*.mjs',
|
|
219
|
+
'**/*.cjs'
|
|
220
|
+
],
|
|
221
|
+
rules: {
|
|
222
|
+
'constructor-super': 'error',
|
|
223
|
+
'no-control-regex': 'error',
|
|
224
|
+
'no-delete-var': 'error',
|
|
225
|
+
'no-dupe-class-members': 'error',
|
|
226
|
+
'no-dupe-else-if': 'error',
|
|
227
|
+
'no-empty-character-class': 'error',
|
|
228
|
+
'no-ex-assign': 'error',
|
|
229
|
+
'no-extra-boolean-cast': 'error',
|
|
230
|
+
'no-fallthrough': 'error',
|
|
231
|
+
'no-func-assign': 'error',
|
|
232
|
+
'no-global-assign': 'error',
|
|
233
|
+
'no-import-assign': 'error',
|
|
234
|
+
'no-invalid-regexp': 'error',
|
|
235
|
+
'no-irregular-whitespace': 'error',
|
|
236
|
+
'no-misleading-character-class': 'error',
|
|
237
|
+
'no-nonoctal-decimal-escape': 'error',
|
|
238
|
+
'no-obj-calls': 'error',
|
|
239
|
+
'no-octal': 'error',
|
|
240
|
+
'no-prototype-builtins': 'error',
|
|
241
|
+
'no-regex-spaces': 'error',
|
|
242
|
+
'no-self-assign': 'error',
|
|
243
|
+
'no-setter-return': 'error',
|
|
244
|
+
'no-shadow-restricted-names': 'error',
|
|
245
|
+
'no-this-before-super': 'error',
|
|
246
|
+
'no-undef': 'error',
|
|
247
|
+
'no-unexpected-multiline': 'error',
|
|
248
|
+
'no-unreachable': 'error',
|
|
249
|
+
'no-unsafe-finally': 'error',
|
|
250
|
+
'no-unsafe-negation': 'error',
|
|
251
|
+
'no-unsafe-optional-chaining': 'error',
|
|
252
|
+
'no-useless-backreference': 'error',
|
|
253
|
+
'no-useless-catch': 'error',
|
|
254
|
+
'no-useless-escape': 'error',
|
|
255
|
+
'no-with': 'error',
|
|
256
|
+
'require-yield': 'error',
|
|
257
|
+
'use-isnan': 'error',
|
|
258
|
+
'valid-typeof': 'error',
|
|
259
|
+
'for-direction': 'error',
|
|
260
|
+
'getter-return': 'error',
|
|
261
|
+
'no-async-promise-executor': 'error',
|
|
262
|
+
'no-case-declarations': 'error',
|
|
263
|
+
'no-class-assign': 'error',
|
|
264
|
+
'no-compare-neg-zero': 'error',
|
|
265
|
+
'no-cond-assign': 'error',
|
|
266
|
+
'no-const-assign': 'error',
|
|
267
|
+
'no-constant-binary-expression': 'error',
|
|
268
|
+
'no-constant-condition': 'error',
|
|
269
|
+
'no-debugger': 'error',
|
|
270
|
+
'no-dupe-args': 'error',
|
|
271
|
+
'no-dupe-keys': 'error',
|
|
272
|
+
'no-duplicate-case': 'error',
|
|
273
|
+
'no-empty': 'error',
|
|
274
|
+
'no-empty-pattern': 'error',
|
|
275
|
+
'no-loss-of-precision': 'error',
|
|
276
|
+
'no-sparse-arrays': 'error'
|
|
277
|
+
}
|
|
278
|
+
};
|
|
279
|
+
const react_recommended = {
|
|
280
|
+
files: [
|
|
281
|
+
'**/*.jsx',
|
|
282
|
+
'**/*.tsx'
|
|
283
|
+
],
|
|
284
|
+
plugins: [
|
|
285
|
+
'react'
|
|
286
|
+
],
|
|
287
|
+
rules: {
|
|
288
|
+
'react/jsx-key': 'error',
|
|
289
|
+
'react/jsx-no-comment-textnodes': 'error',
|
|
290
|
+
'react/jsx-no-duplicate-props': 'error',
|
|
291
|
+
'react/jsx-no-target-blank': 'error',
|
|
292
|
+
'react/jsx-no-undef': 'error',
|
|
293
|
+
'react/jsx-uses-react': 'error',
|
|
294
|
+
'react/jsx-uses-vars': 'error',
|
|
295
|
+
'react/no-children-prop': 'error',
|
|
296
|
+
'react/no-danger-with-children': 'error',
|
|
297
|
+
'react/no-deprecated': 'error',
|
|
298
|
+
'react/no-direct-mutation-state': 'error',
|
|
299
|
+
'react/no-find-dom-node': 'error',
|
|
300
|
+
'react/no-is-mounted': 'error',
|
|
301
|
+
'react/no-render-return-value': 'error',
|
|
302
|
+
'react/no-string-refs': 'error',
|
|
303
|
+
'react/no-unescaped-entities': 'error',
|
|
304
|
+
'react/no-unknown-property': 'error',
|
|
305
|
+
'react/no-unsafe': 'off',
|
|
306
|
+
'react/react-in-jsx-scope': 'error',
|
|
307
|
+
'react/require-render-return': 'error'
|
|
308
|
+
}
|
|
309
|
+
};
|
|
310
|
+
const react_hooks_recommended = {
|
|
311
|
+
plugins: [
|
|
312
|
+
'react-hooks'
|
|
313
|
+
],
|
|
314
|
+
rules: {
|
|
315
|
+
'react-hooks/rules-of-hooks': 'error',
|
|
316
|
+
'react-hooks/exhaustive-deps': 'warn'
|
|
317
|
+
}
|
|
318
|
+
};
|
|
319
|
+
const import_recommended = {
|
|
320
|
+
plugins: [
|
|
321
|
+
'eslint-plugin-import'
|
|
322
|
+
],
|
|
323
|
+
rules: {}
|
|
324
|
+
};
|
|
325
|
+
const promise_recommended = {
|
|
326
|
+
plugins: [
|
|
327
|
+
'promise'
|
|
328
|
+
],
|
|
329
|
+
rules: {
|
|
330
|
+
'promise/always-return': 'error',
|
|
331
|
+
'promise/no-return-wrap': 'error',
|
|
332
|
+
'promise/param-names': 'error',
|
|
333
|
+
'promise/catch-or-return': 'error',
|
|
334
|
+
'promise/avoid-new': 'off'
|
|
335
|
+
}
|
|
336
|
+
};
|
|
337
|
+
const jest_recommended = {
|
|
338
|
+
plugins: [
|
|
339
|
+
'jest'
|
|
340
|
+
],
|
|
341
|
+
rules: {
|
|
342
|
+
'jest/expect-expect': 'warn',
|
|
343
|
+
'jest/no-alias-methods': 'error',
|
|
344
|
+
'jest/no-commented-out-tests': 'warn',
|
|
345
|
+
'jest/no-deprecated-functions': 'error',
|
|
346
|
+
'jest/no-disabled-tests': 'warn',
|
|
347
|
+
'jest/no-done-callback': 'error',
|
|
348
|
+
'jest/no-focused-tests': 'error',
|
|
349
|
+
'jest/no-identical-title': 'error',
|
|
350
|
+
'jest/no-jasmine-globals': 'error',
|
|
351
|
+
'jest/no-mocks-import': 'error',
|
|
352
|
+
'jest/no-standalone-expect': 'error',
|
|
353
|
+
'jest/no-test-prefixes': 'error',
|
|
354
|
+
'jest/valid-describe-callback': 'error',
|
|
355
|
+
'jest/valid-expect': 'error',
|
|
356
|
+
'jest/valid-title': 'error'
|
|
357
|
+
}
|
|
358
|
+
};
|
|
359
|
+
const style = {
|
|
360
|
+
plugins: [
|
|
361
|
+
'jest'
|
|
362
|
+
],
|
|
363
|
+
rules: {
|
|
364
|
+
'jest/prefer-to-be': 'error',
|
|
365
|
+
'jest/prefer-to-contain': 'error',
|
|
366
|
+
'jest/prefer-to-have-length': 'error'
|
|
367
|
+
}
|
|
368
|
+
};
|
|
369
|
+
const unicorn_recommended = {
|
|
370
|
+
plugins: [
|
|
371
|
+
'unicorn'
|
|
372
|
+
],
|
|
373
|
+
rules: {
|
|
374
|
+
'unicorn/filename-case': 'error',
|
|
375
|
+
'unicorn/no-static-only-class': 'error'
|
|
376
|
+
}
|
|
377
|
+
};
|
|
378
|
+
const jsx_a11y_recommended = {
|
|
379
|
+
files: [
|
|
380
|
+
'**/*.jsx',
|
|
381
|
+
'**/*.tsx'
|
|
382
|
+
],
|
|
383
|
+
plugins: [
|
|
384
|
+
'jsx-a11y'
|
|
385
|
+
],
|
|
386
|
+
rules: {
|
|
387
|
+
'jsx-a11y/alt-text': 'error',
|
|
388
|
+
'jsx-a11y/anchor-ambiguous-text': 'off',
|
|
389
|
+
'jsx-a11y/anchor-has-content': 'error',
|
|
390
|
+
'jsx-a11y/anchor-is-valid': 'error',
|
|
391
|
+
'jsx-a11y/aria-activedescendant-has-tabindex': 'error',
|
|
392
|
+
'jsx-a11y/aria-props': 'error',
|
|
393
|
+
'jsx-a11y/aria-proptypes': 'error',
|
|
394
|
+
'jsx-a11y/aria-role': 'error',
|
|
395
|
+
'jsx-a11y/aria-unsupported-elements': 'error',
|
|
396
|
+
'jsx-a11y/autocomplete-valid': 'error',
|
|
397
|
+
'jsx-a11y/click-events-have-key-events': 'error',
|
|
398
|
+
'jsx-a11y/control-has-associated-label': 'off',
|
|
399
|
+
'jsx-a11y/heading-has-content': 'error',
|
|
400
|
+
'jsx-a11y/html-has-lang': 'error',
|
|
401
|
+
'jsx-a11y/iframe-has-title': 'error',
|
|
402
|
+
'jsx-a11y/img-redundant-alt': 'error',
|
|
403
|
+
'jsx-a11y/interactive-supports-focus': [
|
|
404
|
+
'error',
|
|
405
|
+
{
|
|
406
|
+
tabbable: [
|
|
407
|
+
'button',
|
|
408
|
+
'checkbox',
|
|
409
|
+
'link',
|
|
410
|
+
'searchbox',
|
|
411
|
+
'spinbutton',
|
|
412
|
+
'switch',
|
|
413
|
+
'textbox'
|
|
414
|
+
]
|
|
415
|
+
}
|
|
416
|
+
],
|
|
417
|
+
'jsx-a11y/label-has-associated-control': 'error',
|
|
418
|
+
'jsx-a11y/media-has-caption': 'error',
|
|
419
|
+
'jsx-a11y/mouse-events-have-key-events': 'error',
|
|
420
|
+
'jsx-a11y/no-access-key': 'error',
|
|
421
|
+
'jsx-a11y/no-autofocus': 'error',
|
|
422
|
+
'jsx-a11y/no-distracting-elements': 'error',
|
|
423
|
+
'jsx-a11y/no-interactive-element-to-noninteractive-role': [
|
|
424
|
+
'error',
|
|
425
|
+
{
|
|
426
|
+
tr: [
|
|
427
|
+
'none',
|
|
428
|
+
'presentation'
|
|
429
|
+
],
|
|
430
|
+
canvas: [
|
|
431
|
+
'img'
|
|
432
|
+
]
|
|
433
|
+
}
|
|
434
|
+
],
|
|
435
|
+
'jsx-a11y/no-noninteractive-element-interactions': [
|
|
436
|
+
'error',
|
|
437
|
+
{
|
|
438
|
+
handlers: [
|
|
439
|
+
'onClick',
|
|
440
|
+
'onError',
|
|
441
|
+
'onLoad',
|
|
442
|
+
'onMouseDown',
|
|
443
|
+
'onMouseUp',
|
|
444
|
+
'onKeyPress',
|
|
445
|
+
'onKeyDown',
|
|
446
|
+
'onKeyUp'
|
|
447
|
+
],
|
|
448
|
+
alert: [
|
|
449
|
+
'onKeyUp',
|
|
450
|
+
'onKeyDown',
|
|
451
|
+
'onKeyPress'
|
|
452
|
+
],
|
|
453
|
+
body: [
|
|
454
|
+
'onError',
|
|
455
|
+
'onLoad'
|
|
456
|
+
],
|
|
457
|
+
dialog: [
|
|
458
|
+
'onKeyUp',
|
|
459
|
+
'onKeyDown',
|
|
460
|
+
'onKeyPress'
|
|
461
|
+
],
|
|
462
|
+
iframe: [
|
|
463
|
+
'onError',
|
|
464
|
+
'onLoad'
|
|
465
|
+
],
|
|
466
|
+
img: [
|
|
467
|
+
'onError',
|
|
468
|
+
'onLoad'
|
|
469
|
+
]
|
|
470
|
+
}
|
|
471
|
+
],
|
|
472
|
+
'jsx-a11y/no-noninteractive-element-to-interactive-role': [
|
|
473
|
+
'error',
|
|
474
|
+
{
|
|
475
|
+
ul: [
|
|
476
|
+
'listbox',
|
|
477
|
+
'menu',
|
|
478
|
+
'menubar',
|
|
479
|
+
'radiogroup',
|
|
480
|
+
'tablist',
|
|
481
|
+
'tree',
|
|
482
|
+
'treegrid'
|
|
483
|
+
],
|
|
484
|
+
ol: [
|
|
485
|
+
'listbox',
|
|
486
|
+
'menu',
|
|
487
|
+
'menubar',
|
|
488
|
+
'radiogroup',
|
|
489
|
+
'tablist',
|
|
490
|
+
'tree',
|
|
491
|
+
'treegrid'
|
|
492
|
+
],
|
|
493
|
+
li: [
|
|
494
|
+
'menuitem',
|
|
495
|
+
'menuitemradio',
|
|
496
|
+
'menuitemcheckbox',
|
|
497
|
+
'option',
|
|
498
|
+
'row',
|
|
499
|
+
'tab',
|
|
500
|
+
'treeitem'
|
|
501
|
+
],
|
|
502
|
+
table: [
|
|
503
|
+
'grid'
|
|
504
|
+
],
|
|
505
|
+
td: [
|
|
506
|
+
'gridcell'
|
|
507
|
+
],
|
|
508
|
+
fieldset: [
|
|
509
|
+
'radiogroup',
|
|
510
|
+
'presentation'
|
|
511
|
+
]
|
|
512
|
+
}
|
|
513
|
+
],
|
|
514
|
+
'jsx-a11y/no-noninteractive-tabindex': [
|
|
515
|
+
'error',
|
|
516
|
+
{
|
|
517
|
+
tags: [],
|
|
518
|
+
roles: [
|
|
519
|
+
'tabpanel'
|
|
520
|
+
],
|
|
521
|
+
allowExpressionValues: true
|
|
522
|
+
}
|
|
523
|
+
],
|
|
524
|
+
'jsx-a11y/no-redundant-roles': 'error',
|
|
525
|
+
'jsx-a11y/no-static-element-interactions': [
|
|
526
|
+
'error',
|
|
527
|
+
{
|
|
528
|
+
allowExpressionValues: true,
|
|
529
|
+
handlers: [
|
|
530
|
+
'onClick',
|
|
531
|
+
'onMouseDown',
|
|
532
|
+
'onMouseUp',
|
|
533
|
+
'onKeyPress',
|
|
534
|
+
'onKeyDown',
|
|
535
|
+
'onKeyUp'
|
|
536
|
+
]
|
|
537
|
+
}
|
|
538
|
+
],
|
|
539
|
+
'jsx-a11y/role-has-required-aria-props': 'error',
|
|
540
|
+
'jsx-a11y/role-supports-aria-props': 'error',
|
|
541
|
+
'jsx-a11y/scope': 'error',
|
|
542
|
+
'jsx-a11y/tabindex-no-positive': 'error'
|
|
543
|
+
}
|
|
544
|
+
};
|
|
545
|
+
const ts = {
|
|
546
|
+
configs: {
|
|
547
|
+
base: base,
|
|
548
|
+
recommended: recommended
|
|
549
|
+
}
|
|
550
|
+
};
|
|
551
|
+
const js = {
|
|
552
|
+
configs: {
|
|
553
|
+
recommended: javascript_recommended
|
|
554
|
+
}
|
|
555
|
+
};
|
|
556
|
+
const reactPlugin = {
|
|
557
|
+
configs: {
|
|
558
|
+
recommended: react_recommended
|
|
559
|
+
}
|
|
560
|
+
};
|
|
561
|
+
const reactHooksPlugin = {
|
|
562
|
+
configs: {
|
|
563
|
+
recommended: react_hooks_recommended
|
|
564
|
+
}
|
|
565
|
+
};
|
|
566
|
+
const importPlugin = {
|
|
567
|
+
configs: {
|
|
568
|
+
recommended: import_recommended
|
|
569
|
+
}
|
|
570
|
+
};
|
|
571
|
+
const promisePlugin = {
|
|
572
|
+
configs: {
|
|
573
|
+
recommended: promise_recommended
|
|
574
|
+
}
|
|
575
|
+
};
|
|
576
|
+
const jestPlugin = {
|
|
577
|
+
configs: {
|
|
578
|
+
recommended: jest_recommended,
|
|
579
|
+
style: style
|
|
580
|
+
}
|
|
581
|
+
};
|
|
582
|
+
const unicornPlugin = {
|
|
583
|
+
configs: {
|
|
584
|
+
recommended: unicorn_recommended
|
|
585
|
+
}
|
|
586
|
+
};
|
|
587
|
+
const jsxA11yPlugin = {
|
|
588
|
+
configs: {
|
|
589
|
+
recommended: jsx_a11y_recommended
|
|
590
|
+
}
|
|
591
|
+
};
|
|
592
|
+
async function lint(options) {
|
|
11
593
|
const service = new RSLintService(new NodeRslintService({
|
|
12
|
-
workingDirectory: options.workingDirectory
|
|
594
|
+
workingDirectory: options.workingDirectory
|
|
13
595
|
}));
|
|
14
596
|
const result = await service.lint(options);
|
|
15
597
|
await service.close();
|
|
16
598
|
return result;
|
|
17
599
|
}
|
|
18
|
-
|
|
19
|
-
export async function applyFixes(options) {
|
|
600
|
+
async function applyFixes(options) {
|
|
20
601
|
const service = new RSLintService(new NodeRslintService());
|
|
21
602
|
const result = await service.applyFixes(options);
|
|
22
603
|
await service.close();
|
|
23
604
|
return result;
|
|
24
605
|
}
|
|
25
|
-
|
|
26
|
-
export async function getAstInfo(options) {
|
|
606
|
+
async function getAstInfo(options) {
|
|
27
607
|
const service = new RSLintService(new NodeRslintService());
|
|
28
608
|
const result = await service.getAstInfo(options);
|
|
29
609
|
await service.close();
|
|
30
610
|
return result;
|
|
31
611
|
}
|
|
612
|
+
export { RSLintService } from "./service.js";
|
|
613
|
+
export { defineConfig, globalIgnores } from "./34.js";
|
|
614
|
+
export { NodeRslintService, applyFixes, getAstInfo, importPlugin, jestPlugin, js, jsxA11yPlugin, lint, promisePlugin, reactHooksPlugin, reactPlugin, ts, unicornPlugin };
|