@alexlit/lint-kit 181.0.0 → 182.0.0

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.
Files changed (21) hide show
  1. package/package.json +1 -1
  2. package/packages/config-eslint/node_modules/eslint-visitor-keys/LICENSE +201 -0
  3. package/packages/config-eslint/node_modules/eslint-visitor-keys/README.md +121 -0
  4. package/packages/config-eslint/node_modules/eslint-visitor-keys/dist/eslint-visitor-keys.cjs +396 -0
  5. package/packages/config-eslint/node_modules/eslint-visitor-keys/dist/eslint-visitor-keys.d.cts +28 -0
  6. package/packages/config-eslint/node_modules/eslint-visitor-keys/dist/index.d.ts +16 -0
  7. package/packages/config-eslint/node_modules/eslint-visitor-keys/dist/visitor-keys.d.ts +12 -0
  8. package/packages/config-eslint/node_modules/eslint-visitor-keys/lib/index.js +67 -0
  9. package/packages/config-eslint/node_modules/eslint-visitor-keys/lib/visitor-keys.js +327 -0
  10. package/packages/config-eslint/node_modules/eslint-visitor-keys/package.json +59 -0
  11. package/packages/config-eslint/node_modules/jsonc-eslint-parser/LICENSE +21 -0
  12. package/packages/config-eslint/node_modules/jsonc-eslint-parser/README.md +109 -0
  13. package/packages/config-eslint/node_modules/jsonc-eslint-parser/lib/chunk-C7Uep-_p.mjs +20 -0
  14. package/packages/config-eslint/node_modules/jsonc-eslint-parser/lib/index.d.mts +210 -0
  15. package/packages/config-eslint/node_modules/jsonc-eslint-parser/lib/index.mjs +1305 -0
  16. package/packages/config-eslint/node_modules/jsonc-eslint-parser/package.json +98 -0
  17. package/packages/config-eslint/package.json +3 -3
  18. package/packages/config-eslint/plugins/tanstack-query.js +2 -2
  19. package/packages/config-eslint/plugins/unocss.js +6 -4
  20. package/packages/config-stylelint/package.json +1 -1
  21. package/packages/config-stylelint/plugins/bem.js +7 -4
@@ -0,0 +1,396 @@
1
+ 'use strict';
2
+
3
+ /* eslint-disable jsdoc/valid-types -- doesn't allow `readonly`.
4
+ TODO: remove eslint-disable when https://github.com/jsdoc-type-pratt-parser/jsdoc-type-pratt-parser/issues/164 is fixed
5
+ */
6
+ /**
7
+ * @typedef {{ readonly [type: string]: ReadonlyArray<string> }} VisitorKeys
8
+ */
9
+ /* eslint-enable jsdoc/valid-types -- doesn't allow `readonly string[]`. TODO: check why */
10
+
11
+ /**
12
+ * @type {VisitorKeys}
13
+ */
14
+ const KEYS = {
15
+ ArrayExpression: [
16
+ "elements"
17
+ ],
18
+ ArrayPattern: [
19
+ "elements"
20
+ ],
21
+ ArrowFunctionExpression: [
22
+ "params",
23
+ "body"
24
+ ],
25
+ AssignmentExpression: [
26
+ "left",
27
+ "right"
28
+ ],
29
+ AssignmentPattern: [
30
+ "left",
31
+ "right"
32
+ ],
33
+ AwaitExpression: [
34
+ "argument"
35
+ ],
36
+ BinaryExpression: [
37
+ "left",
38
+ "right"
39
+ ],
40
+ BlockStatement: [
41
+ "body"
42
+ ],
43
+ BreakStatement: [
44
+ "label"
45
+ ],
46
+ CallExpression: [
47
+ "callee",
48
+ "arguments"
49
+ ],
50
+ CatchClause: [
51
+ "param",
52
+ "body"
53
+ ],
54
+ ChainExpression: [
55
+ "expression"
56
+ ],
57
+ ClassBody: [
58
+ "body"
59
+ ],
60
+ ClassDeclaration: [
61
+ "id",
62
+ "superClass",
63
+ "body"
64
+ ],
65
+ ClassExpression: [
66
+ "id",
67
+ "superClass",
68
+ "body"
69
+ ],
70
+ ConditionalExpression: [
71
+ "test",
72
+ "consequent",
73
+ "alternate"
74
+ ],
75
+ ContinueStatement: [
76
+ "label"
77
+ ],
78
+ DebuggerStatement: [],
79
+ DoWhileStatement: [
80
+ "body",
81
+ "test"
82
+ ],
83
+ EmptyStatement: [],
84
+ ExperimentalRestProperty: [
85
+ "argument"
86
+ ],
87
+ ExperimentalSpreadProperty: [
88
+ "argument"
89
+ ],
90
+ ExportAllDeclaration: [
91
+ "exported",
92
+ "source",
93
+ "attributes"
94
+ ],
95
+ ExportDefaultDeclaration: [
96
+ "declaration"
97
+ ],
98
+ ExportNamedDeclaration: [
99
+ "declaration",
100
+ "specifiers",
101
+ "source",
102
+ "attributes"
103
+ ],
104
+ ExportSpecifier: [
105
+ "local",
106
+ "exported"
107
+ ],
108
+ ExpressionStatement: [
109
+ "expression"
110
+ ],
111
+ ForInStatement: [
112
+ "left",
113
+ "right",
114
+ "body"
115
+ ],
116
+ ForOfStatement: [
117
+ "left",
118
+ "right",
119
+ "body"
120
+ ],
121
+ ForStatement: [
122
+ "init",
123
+ "test",
124
+ "update",
125
+ "body"
126
+ ],
127
+ FunctionDeclaration: [
128
+ "id",
129
+ "params",
130
+ "body"
131
+ ],
132
+ FunctionExpression: [
133
+ "id",
134
+ "params",
135
+ "body"
136
+ ],
137
+ Identifier: [],
138
+ IfStatement: [
139
+ "test",
140
+ "consequent",
141
+ "alternate"
142
+ ],
143
+ ImportAttribute: [
144
+ "key",
145
+ "value"
146
+ ],
147
+ ImportDeclaration: [
148
+ "specifiers",
149
+ "source",
150
+ "attributes"
151
+ ],
152
+ ImportDefaultSpecifier: [
153
+ "local"
154
+ ],
155
+ ImportExpression: [
156
+ "source",
157
+ "options"
158
+ ],
159
+ ImportNamespaceSpecifier: [
160
+ "local"
161
+ ],
162
+ ImportSpecifier: [
163
+ "imported",
164
+ "local"
165
+ ],
166
+ JSXAttribute: [
167
+ "name",
168
+ "value"
169
+ ],
170
+ JSXClosingElement: [
171
+ "name"
172
+ ],
173
+ JSXClosingFragment: [],
174
+ JSXElement: [
175
+ "openingElement",
176
+ "children",
177
+ "closingElement"
178
+ ],
179
+ JSXEmptyExpression: [],
180
+ JSXExpressionContainer: [
181
+ "expression"
182
+ ],
183
+ JSXFragment: [
184
+ "openingFragment",
185
+ "children",
186
+ "closingFragment"
187
+ ],
188
+ JSXIdentifier: [],
189
+ JSXMemberExpression: [
190
+ "object",
191
+ "property"
192
+ ],
193
+ JSXNamespacedName: [
194
+ "namespace",
195
+ "name"
196
+ ],
197
+ JSXOpeningElement: [
198
+ "name",
199
+ "attributes"
200
+ ],
201
+ JSXOpeningFragment: [],
202
+ JSXSpreadAttribute: [
203
+ "argument"
204
+ ],
205
+ JSXSpreadChild: [
206
+ "expression"
207
+ ],
208
+ JSXText: [],
209
+ LabeledStatement: [
210
+ "label",
211
+ "body"
212
+ ],
213
+ Literal: [],
214
+ LogicalExpression: [
215
+ "left",
216
+ "right"
217
+ ],
218
+ MemberExpression: [
219
+ "object",
220
+ "property"
221
+ ],
222
+ MetaProperty: [
223
+ "meta",
224
+ "property"
225
+ ],
226
+ MethodDefinition: [
227
+ "key",
228
+ "value"
229
+ ],
230
+ NewExpression: [
231
+ "callee",
232
+ "arguments"
233
+ ],
234
+ ObjectExpression: [
235
+ "properties"
236
+ ],
237
+ ObjectPattern: [
238
+ "properties"
239
+ ],
240
+ PrivateIdentifier: [],
241
+ Program: [
242
+ "body"
243
+ ],
244
+ Property: [
245
+ "key",
246
+ "value"
247
+ ],
248
+ PropertyDefinition: [
249
+ "key",
250
+ "value"
251
+ ],
252
+ RestElement: [
253
+ "argument"
254
+ ],
255
+ ReturnStatement: [
256
+ "argument"
257
+ ],
258
+ SequenceExpression: [
259
+ "expressions"
260
+ ],
261
+ SpreadElement: [
262
+ "argument"
263
+ ],
264
+ StaticBlock: [
265
+ "body"
266
+ ],
267
+ Super: [],
268
+ SwitchCase: [
269
+ "test",
270
+ "consequent"
271
+ ],
272
+ SwitchStatement: [
273
+ "discriminant",
274
+ "cases"
275
+ ],
276
+ TaggedTemplateExpression: [
277
+ "tag",
278
+ "quasi"
279
+ ],
280
+ TemplateElement: [],
281
+ TemplateLiteral: [
282
+ "quasis",
283
+ "expressions"
284
+ ],
285
+ ThisExpression: [],
286
+ ThrowStatement: [
287
+ "argument"
288
+ ],
289
+ TryStatement: [
290
+ "block",
291
+ "handler",
292
+ "finalizer"
293
+ ],
294
+ UnaryExpression: [
295
+ "argument"
296
+ ],
297
+ UpdateExpression: [
298
+ "argument"
299
+ ],
300
+ VariableDeclaration: [
301
+ "declarations"
302
+ ],
303
+ VariableDeclarator: [
304
+ "id",
305
+ "init"
306
+ ],
307
+ WhileStatement: [
308
+ "test",
309
+ "body"
310
+ ],
311
+ WithStatement: [
312
+ "object",
313
+ "body"
314
+ ],
315
+ YieldExpression: [
316
+ "argument"
317
+ ]
318
+ };
319
+
320
+ // Types.
321
+ const NODE_TYPES = Object.keys(KEYS);
322
+
323
+ // Freeze the keys.
324
+ for (const type of NODE_TYPES) {
325
+ Object.freeze(KEYS[type]);
326
+ }
327
+ Object.freeze(KEYS);
328
+
329
+ /**
330
+ * @author Toru Nagashima <https://github.com/mysticatea>
331
+ * See LICENSE file in root directory for full license.
332
+ */
333
+
334
+ /**
335
+ * @typedef {import('./visitor-keys.js').VisitorKeys} VisitorKeys
336
+ */
337
+
338
+ // List to ignore keys.
339
+ const KEY_BLACKLIST = new Set([
340
+ "parent",
341
+ "leadingComments",
342
+ "trailingComments"
343
+ ]);
344
+
345
+ /**
346
+ * Check whether a given key should be used or not.
347
+ * @param {string} key The key to check.
348
+ * @returns {boolean} `true` if the key should be used.
349
+ */
350
+ function filterKey(key) {
351
+ return !KEY_BLACKLIST.has(key) && key[0] !== "_";
352
+ }
353
+
354
+
355
+ /* eslint-disable jsdoc/valid-types -- doesn't allow `readonly`.
356
+ TODO: remove eslint-disable when https://github.com/jsdoc-type-pratt-parser/jsdoc-type-pratt-parser/issues/164 is fixed
357
+ */
358
+ /**
359
+ * Get visitor keys of a given node.
360
+ * @param {Object} node The AST node to get keys.
361
+ * @returns {readonly string[]} Visitor keys of the node.
362
+ */
363
+ function getKeys(node) {
364
+ return Object.keys(node).filter(filterKey);
365
+ }
366
+ /* eslint-enable jsdoc/valid-types -- doesn't allow `readonly` */
367
+
368
+ /**
369
+ * Make the union set with `KEYS` and given keys.
370
+ * @param {VisitorKeys} additionalKeys The additional keys.
371
+ * @returns {VisitorKeys} The union set.
372
+ */
373
+ function unionWith(additionalKeys) {
374
+ const retv = /** @type {{ [type: string]: ReadonlyArray<string> }} */
375
+ (Object.assign({}, KEYS));
376
+
377
+ for (const type of Object.keys(additionalKeys)) {
378
+ if (Object.hasOwn(retv, type)) {
379
+ const keys = new Set(additionalKeys[type]);
380
+
381
+ for (const key of retv[type]) {
382
+ keys.add(key);
383
+ }
384
+
385
+ retv[type] = Object.freeze(Array.from(keys));
386
+ } else {
387
+ retv[type] = Object.freeze(Array.from(additionalKeys[type]));
388
+ }
389
+ }
390
+
391
+ return Object.freeze(retv);
392
+ }
393
+
394
+ exports.KEYS = KEYS;
395
+ exports.getKeys = getKeys;
396
+ exports.unionWith = unionWith;
@@ -0,0 +1,28 @@
1
+ type VisitorKeys$1 = {
2
+ readonly [type: string]: ReadonlyArray<string>;
3
+ };
4
+ /**
5
+ * @typedef {{ readonly [type: string]: ReadonlyArray<string> }} VisitorKeys
6
+ */
7
+ /**
8
+ * @type {VisitorKeys}
9
+ */
10
+ declare const KEYS: VisitorKeys$1;
11
+
12
+ /**
13
+ * Get visitor keys of a given node.
14
+ * @param {Object} node The AST node to get keys.
15
+ * @returns {readonly string[]} Visitor keys of the node.
16
+ */
17
+ declare function getKeys(node: Object): readonly string[];
18
+ /**
19
+ * Make the union set with `KEYS` and given keys.
20
+ * @param {VisitorKeys} additionalKeys The additional keys.
21
+ * @returns {VisitorKeys} The union set.
22
+ */
23
+ declare function unionWith(additionalKeys: VisitorKeys): VisitorKeys;
24
+
25
+ type VisitorKeys = VisitorKeys$1;
26
+
27
+ export { KEYS, getKeys, unionWith };
28
+ export type { VisitorKeys };
@@ -0,0 +1,16 @@
1
+ /**
2
+ * Get visitor keys of a given node.
3
+ * @param {Object} node The AST node to get keys.
4
+ * @returns {readonly string[]} Visitor keys of the node.
5
+ */
6
+ export function getKeys(node: Object): readonly string[];
7
+ /**
8
+ * Make the union set with `KEYS` and given keys.
9
+ * @param {VisitorKeys} additionalKeys The additional keys.
10
+ * @returns {VisitorKeys} The union set.
11
+ */
12
+ export function unionWith(additionalKeys: VisitorKeys): VisitorKeys;
13
+ export { KEYS };
14
+ export type VisitorKeys = import("./visitor-keys.js").VisitorKeys;
15
+ import KEYS from "./visitor-keys.js";
16
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,12 @@
1
+ export default KEYS;
2
+ export type VisitorKeys = {
3
+ readonly [type: string]: ReadonlyArray<string>;
4
+ };
5
+ /**
6
+ * @typedef {{ readonly [type: string]: ReadonlyArray<string> }} VisitorKeys
7
+ */
8
+ /**
9
+ * @type {VisitorKeys}
10
+ */
11
+ declare const KEYS: VisitorKeys;
12
+ //# sourceMappingURL=visitor-keys.d.ts.map
@@ -0,0 +1,67 @@
1
+ /**
2
+ * @author Toru Nagashima <https://github.com/mysticatea>
3
+ * See LICENSE file in root directory for full license.
4
+ */
5
+ import KEYS from "./visitor-keys.js";
6
+
7
+ /**
8
+ * @typedef {import('./visitor-keys.js').VisitorKeys} VisitorKeys
9
+ */
10
+
11
+ // List to ignore keys.
12
+ const KEY_BLACKLIST = new Set([
13
+ "parent",
14
+ "leadingComments",
15
+ "trailingComments"
16
+ ]);
17
+
18
+ /**
19
+ * Check whether a given key should be used or not.
20
+ * @param {string} key The key to check.
21
+ * @returns {boolean} `true` if the key should be used.
22
+ */
23
+ function filterKey(key) {
24
+ return !KEY_BLACKLIST.has(key) && key[0] !== "_";
25
+ }
26
+
27
+
28
+ /* eslint-disable jsdoc/valid-types -- doesn't allow `readonly`.
29
+ TODO: remove eslint-disable when https://github.com/jsdoc-type-pratt-parser/jsdoc-type-pratt-parser/issues/164 is fixed
30
+ */
31
+ /**
32
+ * Get visitor keys of a given node.
33
+ * @param {Object} node The AST node to get keys.
34
+ * @returns {readonly string[]} Visitor keys of the node.
35
+ */
36
+ export function getKeys(node) {
37
+ return Object.keys(node).filter(filterKey);
38
+ }
39
+ /* eslint-enable jsdoc/valid-types -- doesn't allow `readonly` */
40
+
41
+ /**
42
+ * Make the union set with `KEYS` and given keys.
43
+ * @param {VisitorKeys} additionalKeys The additional keys.
44
+ * @returns {VisitorKeys} The union set.
45
+ */
46
+ export function unionWith(additionalKeys) {
47
+ const retv = /** @type {{ [type: string]: ReadonlyArray<string> }} */
48
+ (Object.assign({}, KEYS));
49
+
50
+ for (const type of Object.keys(additionalKeys)) {
51
+ if (Object.hasOwn(retv, type)) {
52
+ const keys = new Set(additionalKeys[type]);
53
+
54
+ for (const key of retv[type]) {
55
+ keys.add(key);
56
+ }
57
+
58
+ retv[type] = Object.freeze(Array.from(keys));
59
+ } else {
60
+ retv[type] = Object.freeze(Array.from(additionalKeys[type]));
61
+ }
62
+ }
63
+
64
+ return Object.freeze(retv);
65
+ }
66
+
67
+ export { KEYS };