@alexlit/lint-kit 117.2.1 → 117.3.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 (162) hide show
  1. package/package.json +1 -1
  2. package/packages/config-eslint/index.js +7 -374
  3. package/packages/config-eslint/legacy.js +3 -0
  4. package/packages/config-eslint/node_modules/@eslint/eslintrc/LICENSE +19 -0
  5. package/packages/config-eslint/node_modules/@eslint/eslintrc/README.md +126 -0
  6. package/packages/config-eslint/node_modules/@eslint/eslintrc/conf/config-schema.js +79 -0
  7. package/packages/config-eslint/node_modules/@eslint/eslintrc/conf/environments.js +215 -0
  8. package/packages/config-eslint/node_modules/@eslint/eslintrc/dist/eslintrc-universal.cjs +1143 -0
  9. package/packages/config-eslint/node_modules/@eslint/eslintrc/dist/eslintrc-universal.cjs.map +1 -0
  10. package/packages/config-eslint/node_modules/@eslint/eslintrc/dist/eslintrc.cjs +4371 -0
  11. package/packages/config-eslint/node_modules/@eslint/eslintrc/dist/eslintrc.cjs.map +1 -0
  12. package/packages/config-eslint/node_modules/@eslint/eslintrc/lib/cascading-config-array-factory.js +532 -0
  13. package/packages/config-eslint/node_modules/@eslint/eslintrc/lib/config-array/config-array.js +510 -0
  14. package/packages/config-eslint/node_modules/@eslint/eslintrc/lib/config-array/config-dependency.js +124 -0
  15. package/packages/config-eslint/node_modules/@eslint/eslintrc/lib/config-array/extracted-config.js +145 -0
  16. package/packages/config-eslint/node_modules/@eslint/eslintrc/lib/config-array/ignore-pattern.js +238 -0
  17. package/packages/config-eslint/node_modules/@eslint/eslintrc/lib/config-array/index.js +19 -0
  18. package/packages/config-eslint/node_modules/@eslint/eslintrc/lib/config-array/override-tester.js +225 -0
  19. package/packages/config-eslint/node_modules/@eslint/eslintrc/lib/config-array-factory.js +1155 -0
  20. package/packages/config-eslint/node_modules/@eslint/eslintrc/lib/flat-compat.js +318 -0
  21. package/packages/config-eslint/node_modules/@eslint/eslintrc/lib/index-universal.js +29 -0
  22. package/packages/config-eslint/node_modules/@eslint/eslintrc/lib/index.js +58 -0
  23. package/packages/config-eslint/node_modules/@eslint/eslintrc/lib/shared/ajv.js +191 -0
  24. package/packages/config-eslint/node_modules/@eslint/eslintrc/lib/shared/config-ops.js +135 -0
  25. package/packages/config-eslint/node_modules/@eslint/eslintrc/lib/shared/config-validator.js +370 -0
  26. package/packages/config-eslint/node_modules/@eslint/eslintrc/lib/shared/deprecation-warnings.js +63 -0
  27. package/packages/config-eslint/node_modules/@eslint/eslintrc/lib/shared/naming.js +96 -0
  28. package/packages/config-eslint/node_modules/@eslint/eslintrc/lib/shared/relative-module-resolver.js +42 -0
  29. package/packages/config-eslint/node_modules/@eslint/eslintrc/lib/shared/types.js +149 -0
  30. package/packages/config-eslint/node_modules/@eslint/eslintrc/package.json +82 -0
  31. package/packages/config-eslint/node_modules/@eslint/eslintrc/universal.js +9 -0
  32. package/packages/config-eslint/node_modules/ajv/.tonic_example.js +20 -0
  33. package/packages/config-eslint/node_modules/ajv/LICENSE +22 -0
  34. package/packages/config-eslint/node_modules/ajv/README.md +1497 -0
  35. package/packages/config-eslint/node_modules/ajv/dist/ajv.bundle.js +7189 -0
  36. package/packages/config-eslint/node_modules/ajv/dist/ajv.min.js +3 -0
  37. package/packages/config-eslint/node_modules/ajv/dist/ajv.min.js.map +1 -0
  38. package/packages/config-eslint/node_modules/ajv/lib/ajv.d.ts +397 -0
  39. package/packages/config-eslint/node_modules/ajv/lib/ajv.js +506 -0
  40. package/packages/config-eslint/node_modules/ajv/lib/cache.js +26 -0
  41. package/packages/config-eslint/node_modules/ajv/lib/compile/async.js +90 -0
  42. package/packages/config-eslint/node_modules/ajv/lib/compile/equal.js +5 -0
  43. package/packages/config-eslint/node_modules/ajv/lib/compile/error_classes.js +34 -0
  44. package/packages/config-eslint/node_modules/ajv/lib/compile/formats.js +142 -0
  45. package/packages/config-eslint/node_modules/ajv/lib/compile/index.js +387 -0
  46. package/packages/config-eslint/node_modules/ajv/lib/compile/resolve.js +270 -0
  47. package/packages/config-eslint/node_modules/ajv/lib/compile/rules.js +66 -0
  48. package/packages/config-eslint/node_modules/ajv/lib/compile/schema_obj.js +9 -0
  49. package/packages/config-eslint/node_modules/ajv/lib/compile/ucs2length.js +20 -0
  50. package/packages/config-eslint/node_modules/ajv/lib/compile/util.js +239 -0
  51. package/packages/config-eslint/node_modules/ajv/lib/data.js +49 -0
  52. package/packages/config-eslint/node_modules/ajv/lib/definition_schema.js +37 -0
  53. package/packages/config-eslint/node_modules/ajv/lib/dot/_limit.jst +113 -0
  54. package/packages/config-eslint/node_modules/ajv/lib/dot/_limitItems.jst +12 -0
  55. package/packages/config-eslint/node_modules/ajv/lib/dot/_limitLength.jst +12 -0
  56. package/packages/config-eslint/node_modules/ajv/lib/dot/_limitProperties.jst +12 -0
  57. package/packages/config-eslint/node_modules/ajv/lib/dot/allOf.jst +32 -0
  58. package/packages/config-eslint/node_modules/ajv/lib/dot/anyOf.jst +46 -0
  59. package/packages/config-eslint/node_modules/ajv/lib/dot/coerce.def +51 -0
  60. package/packages/config-eslint/node_modules/ajv/lib/dot/comment.jst +9 -0
  61. package/packages/config-eslint/node_modules/ajv/lib/dot/const.jst +11 -0
  62. package/packages/config-eslint/node_modules/ajv/lib/dot/contains.jst +55 -0
  63. package/packages/config-eslint/node_modules/ajv/lib/dot/custom.jst +191 -0
  64. package/packages/config-eslint/node_modules/ajv/lib/dot/defaults.def +47 -0
  65. package/packages/config-eslint/node_modules/ajv/lib/dot/definitions.def +203 -0
  66. package/packages/config-eslint/node_modules/ajv/lib/dot/dependencies.jst +79 -0
  67. package/packages/config-eslint/node_modules/ajv/lib/dot/enum.jst +30 -0
  68. package/packages/config-eslint/node_modules/ajv/lib/dot/errors.def +194 -0
  69. package/packages/config-eslint/node_modules/ajv/lib/dot/format.jst +106 -0
  70. package/packages/config-eslint/node_modules/ajv/lib/dot/if.jst +73 -0
  71. package/packages/config-eslint/node_modules/ajv/lib/dot/items.jst +98 -0
  72. package/packages/config-eslint/node_modules/ajv/lib/dot/missing.def +39 -0
  73. package/packages/config-eslint/node_modules/ajv/lib/dot/multipleOf.jst +22 -0
  74. package/packages/config-eslint/node_modules/ajv/lib/dot/not.jst +43 -0
  75. package/packages/config-eslint/node_modules/ajv/lib/dot/oneOf.jst +54 -0
  76. package/packages/config-eslint/node_modules/ajv/lib/dot/pattern.jst +14 -0
  77. package/packages/config-eslint/node_modules/ajv/lib/dot/properties.jst +245 -0
  78. package/packages/config-eslint/node_modules/ajv/lib/dot/propertyNames.jst +52 -0
  79. package/packages/config-eslint/node_modules/ajv/lib/dot/ref.jst +85 -0
  80. package/packages/config-eslint/node_modules/ajv/lib/dot/required.jst +108 -0
  81. package/packages/config-eslint/node_modules/ajv/lib/dot/uniqueItems.jst +62 -0
  82. package/packages/config-eslint/node_modules/ajv/lib/dot/validate.jst +276 -0
  83. package/packages/config-eslint/node_modules/ajv/lib/dotjs/README.md +3 -0
  84. package/packages/config-eslint/node_modules/ajv/lib/dotjs/_limit.js +163 -0
  85. package/packages/config-eslint/node_modules/ajv/lib/dotjs/_limitItems.js +80 -0
  86. package/packages/config-eslint/node_modules/ajv/lib/dotjs/_limitLength.js +85 -0
  87. package/packages/config-eslint/node_modules/ajv/lib/dotjs/_limitProperties.js +80 -0
  88. package/packages/config-eslint/node_modules/ajv/lib/dotjs/allOf.js +42 -0
  89. package/packages/config-eslint/node_modules/ajv/lib/dotjs/anyOf.js +73 -0
  90. package/packages/config-eslint/node_modules/ajv/lib/dotjs/comment.js +14 -0
  91. package/packages/config-eslint/node_modules/ajv/lib/dotjs/const.js +56 -0
  92. package/packages/config-eslint/node_modules/ajv/lib/dotjs/contains.js +81 -0
  93. package/packages/config-eslint/node_modules/ajv/lib/dotjs/custom.js +228 -0
  94. package/packages/config-eslint/node_modules/ajv/lib/dotjs/dependencies.js +168 -0
  95. package/packages/config-eslint/node_modules/ajv/lib/dotjs/enum.js +66 -0
  96. package/packages/config-eslint/node_modules/ajv/lib/dotjs/format.js +150 -0
  97. package/packages/config-eslint/node_modules/ajv/lib/dotjs/if.js +103 -0
  98. package/packages/config-eslint/node_modules/ajv/lib/dotjs/index.js +33 -0
  99. package/packages/config-eslint/node_modules/ajv/lib/dotjs/items.js +140 -0
  100. package/packages/config-eslint/node_modules/ajv/lib/dotjs/multipleOf.js +80 -0
  101. package/packages/config-eslint/node_modules/ajv/lib/dotjs/not.js +84 -0
  102. package/packages/config-eslint/node_modules/ajv/lib/dotjs/oneOf.js +73 -0
  103. package/packages/config-eslint/node_modules/ajv/lib/dotjs/pattern.js +75 -0
  104. package/packages/config-eslint/node_modules/ajv/lib/dotjs/properties.js +335 -0
  105. package/packages/config-eslint/node_modules/ajv/lib/dotjs/propertyNames.js +81 -0
  106. package/packages/config-eslint/node_modules/ajv/lib/dotjs/ref.js +124 -0
  107. package/packages/config-eslint/node_modules/ajv/lib/dotjs/required.js +270 -0
  108. package/packages/config-eslint/node_modules/ajv/lib/dotjs/uniqueItems.js +86 -0
  109. package/packages/config-eslint/node_modules/ajv/lib/dotjs/validate.js +482 -0
  110. package/packages/config-eslint/node_modules/ajv/lib/keyword.js +146 -0
  111. package/packages/config-eslint/node_modules/ajv/lib/refs/data.json +17 -0
  112. package/packages/config-eslint/node_modules/ajv/lib/refs/json-schema-draft-04.json +149 -0
  113. package/packages/config-eslint/node_modules/ajv/lib/refs/json-schema-draft-06.json +154 -0
  114. package/packages/config-eslint/node_modules/ajv/lib/refs/json-schema-draft-07.json +168 -0
  115. package/packages/config-eslint/node_modules/ajv/lib/refs/json-schema-secure.json +94 -0
  116. package/packages/config-eslint/node_modules/ajv/package.json +106 -0
  117. package/packages/config-eslint/node_modules/ajv/scripts/.eslintrc.yml +3 -0
  118. package/packages/config-eslint/node_modules/ajv/scripts/bundle.js +61 -0
  119. package/packages/config-eslint/node_modules/ajv/scripts/compile-dots.js +73 -0
  120. package/packages/config-eslint/node_modules/ajv/scripts/info +10 -0
  121. package/packages/config-eslint/node_modules/ajv/scripts/prepare-tests +12 -0
  122. package/packages/config-eslint/node_modules/ajv/scripts/publish-built-version +32 -0
  123. package/packages/config-eslint/node_modules/ajv/scripts/travis-gh-pages +23 -0
  124. package/packages/config-eslint/node_modules/eslint-visitor-keys/LICENSE +201 -0
  125. package/packages/config-eslint/node_modules/eslint-visitor-keys/README.md +105 -0
  126. package/packages/config-eslint/node_modules/eslint-visitor-keys/dist/eslint-visitor-keys.cjs +384 -0
  127. package/packages/config-eslint/node_modules/eslint-visitor-keys/dist/eslint-visitor-keys.d.cts +27 -0
  128. package/packages/config-eslint/node_modules/eslint-visitor-keys/dist/index.d.ts +16 -0
  129. package/packages/config-eslint/node_modules/eslint-visitor-keys/dist/visitor-keys.d.ts +12 -0
  130. package/packages/config-eslint/node_modules/eslint-visitor-keys/lib/index.js +65 -0
  131. package/packages/config-eslint/node_modules/eslint-visitor-keys/lib/visitor-keys.js +315 -0
  132. package/packages/config-eslint/node_modules/eslint-visitor-keys/package.json +74 -0
  133. package/packages/config-eslint/node_modules/espree/LICENSE +25 -0
  134. package/packages/config-eslint/node_modules/espree/README.md +244 -0
  135. package/packages/config-eslint/node_modules/espree/dist/espree.cjs +883 -0
  136. package/packages/config-eslint/node_modules/espree/espree.js +177 -0
  137. package/packages/config-eslint/node_modules/espree/lib/espree.js +349 -0
  138. package/packages/config-eslint/node_modules/espree/lib/features.js +27 -0
  139. package/packages/config-eslint/node_modules/espree/lib/options.js +123 -0
  140. package/packages/config-eslint/node_modules/espree/lib/token-translator.js +263 -0
  141. package/packages/config-eslint/node_modules/espree/lib/version.js +3 -0
  142. package/packages/config-eslint/node_modules/espree/package.json +86 -0
  143. package/packages/config-eslint/node_modules/globals/globals.json +1998 -0
  144. package/packages/config-eslint/node_modules/globals/index.d.ts +2077 -0
  145. package/packages/config-eslint/node_modules/globals/index.js +2 -0
  146. package/packages/config-eslint/node_modules/globals/license +9 -0
  147. package/packages/config-eslint/node_modules/globals/package.json +58 -0
  148. package/packages/config-eslint/node_modules/globals/readme.md +44 -0
  149. package/packages/config-eslint/node_modules/json-schema-traverse/.eslintrc.yml +27 -0
  150. package/packages/config-eslint/node_modules/json-schema-traverse/.travis.yml +8 -0
  151. package/packages/config-eslint/node_modules/json-schema-traverse/LICENSE +21 -0
  152. package/packages/config-eslint/node_modules/json-schema-traverse/README.md +83 -0
  153. package/packages/config-eslint/node_modules/json-schema-traverse/index.js +89 -0
  154. package/packages/config-eslint/node_modules/json-schema-traverse/package.json +43 -0
  155. package/packages/config-eslint/node_modules/json-schema-traverse/spec/.eslintrc.yml +6 -0
  156. package/packages/config-eslint/node_modules/json-schema-traverse/spec/fixtures/schema.js +125 -0
  157. package/packages/config-eslint/node_modules/json-schema-traverse/spec/index.spec.js +171 -0
  158. package/packages/config-eslint/package.json +5 -3
  159. package/packages/config-eslint/plugins/no-await-in-promise.js +2 -2
  160. package/packages/config-eslint/utils/create-config.js +377 -0
  161. package/scripts/lint.eslint.sh +1 -1
  162. package/.eslintrc.cjs +0 -16
@@ -0,0 +1,384 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ /**
6
+ * @typedef {{ readonly [type: string]: ReadonlyArray<string> }} VisitorKeys
7
+ */
8
+
9
+ /**
10
+ * @type {VisitorKeys}
11
+ */
12
+ const KEYS = {
13
+ ArrayExpression: [
14
+ "elements"
15
+ ],
16
+ ArrayPattern: [
17
+ "elements"
18
+ ],
19
+ ArrowFunctionExpression: [
20
+ "params",
21
+ "body"
22
+ ],
23
+ AssignmentExpression: [
24
+ "left",
25
+ "right"
26
+ ],
27
+ AssignmentPattern: [
28
+ "left",
29
+ "right"
30
+ ],
31
+ AwaitExpression: [
32
+ "argument"
33
+ ],
34
+ BinaryExpression: [
35
+ "left",
36
+ "right"
37
+ ],
38
+ BlockStatement: [
39
+ "body"
40
+ ],
41
+ BreakStatement: [
42
+ "label"
43
+ ],
44
+ CallExpression: [
45
+ "callee",
46
+ "arguments"
47
+ ],
48
+ CatchClause: [
49
+ "param",
50
+ "body"
51
+ ],
52
+ ChainExpression: [
53
+ "expression"
54
+ ],
55
+ ClassBody: [
56
+ "body"
57
+ ],
58
+ ClassDeclaration: [
59
+ "id",
60
+ "superClass",
61
+ "body"
62
+ ],
63
+ ClassExpression: [
64
+ "id",
65
+ "superClass",
66
+ "body"
67
+ ],
68
+ ConditionalExpression: [
69
+ "test",
70
+ "consequent",
71
+ "alternate"
72
+ ],
73
+ ContinueStatement: [
74
+ "label"
75
+ ],
76
+ DebuggerStatement: [],
77
+ DoWhileStatement: [
78
+ "body",
79
+ "test"
80
+ ],
81
+ EmptyStatement: [],
82
+ ExperimentalRestProperty: [
83
+ "argument"
84
+ ],
85
+ ExperimentalSpreadProperty: [
86
+ "argument"
87
+ ],
88
+ ExportAllDeclaration: [
89
+ "exported",
90
+ "source"
91
+ ],
92
+ ExportDefaultDeclaration: [
93
+ "declaration"
94
+ ],
95
+ ExportNamedDeclaration: [
96
+ "declaration",
97
+ "specifiers",
98
+ "source"
99
+ ],
100
+ ExportSpecifier: [
101
+ "exported",
102
+ "local"
103
+ ],
104
+ ExpressionStatement: [
105
+ "expression"
106
+ ],
107
+ ForInStatement: [
108
+ "left",
109
+ "right",
110
+ "body"
111
+ ],
112
+ ForOfStatement: [
113
+ "left",
114
+ "right",
115
+ "body"
116
+ ],
117
+ ForStatement: [
118
+ "init",
119
+ "test",
120
+ "update",
121
+ "body"
122
+ ],
123
+ FunctionDeclaration: [
124
+ "id",
125
+ "params",
126
+ "body"
127
+ ],
128
+ FunctionExpression: [
129
+ "id",
130
+ "params",
131
+ "body"
132
+ ],
133
+ Identifier: [],
134
+ IfStatement: [
135
+ "test",
136
+ "consequent",
137
+ "alternate"
138
+ ],
139
+ ImportDeclaration: [
140
+ "specifiers",
141
+ "source"
142
+ ],
143
+ ImportDefaultSpecifier: [
144
+ "local"
145
+ ],
146
+ ImportExpression: [
147
+ "source"
148
+ ],
149
+ ImportNamespaceSpecifier: [
150
+ "local"
151
+ ],
152
+ ImportSpecifier: [
153
+ "imported",
154
+ "local"
155
+ ],
156
+ JSXAttribute: [
157
+ "name",
158
+ "value"
159
+ ],
160
+ JSXClosingElement: [
161
+ "name"
162
+ ],
163
+ JSXClosingFragment: [],
164
+ JSXElement: [
165
+ "openingElement",
166
+ "children",
167
+ "closingElement"
168
+ ],
169
+ JSXEmptyExpression: [],
170
+ JSXExpressionContainer: [
171
+ "expression"
172
+ ],
173
+ JSXFragment: [
174
+ "openingFragment",
175
+ "children",
176
+ "closingFragment"
177
+ ],
178
+ JSXIdentifier: [],
179
+ JSXMemberExpression: [
180
+ "object",
181
+ "property"
182
+ ],
183
+ JSXNamespacedName: [
184
+ "namespace",
185
+ "name"
186
+ ],
187
+ JSXOpeningElement: [
188
+ "name",
189
+ "attributes"
190
+ ],
191
+ JSXOpeningFragment: [],
192
+ JSXSpreadAttribute: [
193
+ "argument"
194
+ ],
195
+ JSXSpreadChild: [
196
+ "expression"
197
+ ],
198
+ JSXText: [],
199
+ LabeledStatement: [
200
+ "label",
201
+ "body"
202
+ ],
203
+ Literal: [],
204
+ LogicalExpression: [
205
+ "left",
206
+ "right"
207
+ ],
208
+ MemberExpression: [
209
+ "object",
210
+ "property"
211
+ ],
212
+ MetaProperty: [
213
+ "meta",
214
+ "property"
215
+ ],
216
+ MethodDefinition: [
217
+ "key",
218
+ "value"
219
+ ],
220
+ NewExpression: [
221
+ "callee",
222
+ "arguments"
223
+ ],
224
+ ObjectExpression: [
225
+ "properties"
226
+ ],
227
+ ObjectPattern: [
228
+ "properties"
229
+ ],
230
+ PrivateIdentifier: [],
231
+ Program: [
232
+ "body"
233
+ ],
234
+ Property: [
235
+ "key",
236
+ "value"
237
+ ],
238
+ PropertyDefinition: [
239
+ "key",
240
+ "value"
241
+ ],
242
+ RestElement: [
243
+ "argument"
244
+ ],
245
+ ReturnStatement: [
246
+ "argument"
247
+ ],
248
+ SequenceExpression: [
249
+ "expressions"
250
+ ],
251
+ SpreadElement: [
252
+ "argument"
253
+ ],
254
+ StaticBlock: [
255
+ "body"
256
+ ],
257
+ Super: [],
258
+ SwitchCase: [
259
+ "test",
260
+ "consequent"
261
+ ],
262
+ SwitchStatement: [
263
+ "discriminant",
264
+ "cases"
265
+ ],
266
+ TaggedTemplateExpression: [
267
+ "tag",
268
+ "quasi"
269
+ ],
270
+ TemplateElement: [],
271
+ TemplateLiteral: [
272
+ "quasis",
273
+ "expressions"
274
+ ],
275
+ ThisExpression: [],
276
+ ThrowStatement: [
277
+ "argument"
278
+ ],
279
+ TryStatement: [
280
+ "block",
281
+ "handler",
282
+ "finalizer"
283
+ ],
284
+ UnaryExpression: [
285
+ "argument"
286
+ ],
287
+ UpdateExpression: [
288
+ "argument"
289
+ ],
290
+ VariableDeclaration: [
291
+ "declarations"
292
+ ],
293
+ VariableDeclarator: [
294
+ "id",
295
+ "init"
296
+ ],
297
+ WhileStatement: [
298
+ "test",
299
+ "body"
300
+ ],
301
+ WithStatement: [
302
+ "object",
303
+ "body"
304
+ ],
305
+ YieldExpression: [
306
+ "argument"
307
+ ]
308
+ };
309
+
310
+ // Types.
311
+ const NODE_TYPES = Object.keys(KEYS);
312
+
313
+ // Freeze the keys.
314
+ for (const type of NODE_TYPES) {
315
+ Object.freeze(KEYS[type]);
316
+ }
317
+ Object.freeze(KEYS);
318
+
319
+ /**
320
+ * @author Toru Nagashima <https://github.com/mysticatea>
321
+ * See LICENSE file in root directory for full license.
322
+ */
323
+
324
+ /**
325
+ * @typedef {import('./visitor-keys.js').VisitorKeys} VisitorKeys
326
+ */
327
+
328
+ // List to ignore keys.
329
+ const KEY_BLACKLIST = new Set([
330
+ "parent",
331
+ "leadingComments",
332
+ "trailingComments"
333
+ ]);
334
+
335
+ /**
336
+ * Check whether a given key should be used or not.
337
+ * @param {string} key The key to check.
338
+ * @returns {boolean} `true` if the key should be used.
339
+ */
340
+ function filterKey(key) {
341
+ return !KEY_BLACKLIST.has(key) && key[0] !== "_";
342
+ }
343
+
344
+ /**
345
+ * Get visitor keys of a given node.
346
+ * @param {object} node The AST node to get keys.
347
+ * @returns {readonly string[]} Visitor keys of the node.
348
+ */
349
+ function getKeys(node) {
350
+ return Object.keys(node).filter(filterKey);
351
+ }
352
+
353
+ // Disable valid-jsdoc rule because it reports syntax error on the type of @returns.
354
+ // eslint-disable-next-line valid-jsdoc
355
+ /**
356
+ * Make the union set with `KEYS` and given keys.
357
+ * @param {VisitorKeys} additionalKeys The additional keys.
358
+ * @returns {VisitorKeys} The union set.
359
+ */
360
+ function unionWith(additionalKeys) {
361
+ const retv = /** @type {{
362
+ [type: string]: ReadonlyArray<string>
363
+ }} */ (Object.assign({}, KEYS));
364
+
365
+ for (const type of Object.keys(additionalKeys)) {
366
+ if (Object.prototype.hasOwnProperty.call(retv, type)) {
367
+ const keys = new Set(additionalKeys[type]);
368
+
369
+ for (const key of retv[type]) {
370
+ keys.add(key);
371
+ }
372
+
373
+ retv[type] = Object.freeze(Array.from(keys));
374
+ } else {
375
+ retv[type] = Object.freeze(Array.from(additionalKeys[type]));
376
+ }
377
+ }
378
+
379
+ return Object.freeze(retv);
380
+ }
381
+
382
+ exports.KEYS = KEYS;
383
+ exports.getKeys = getKeys;
384
+ exports.unionWith = unionWith;
@@ -0,0 +1,27 @@
1
+ type VisitorKeys$1 = {
2
+ readonly [type: string]: readonly 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, VisitorKeys, getKeys, unionWith };
@@ -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]: readonly 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,65 @@
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
+ * Get visitor keys of a given node.
29
+ * @param {object} node The AST node to get keys.
30
+ * @returns {readonly string[]} Visitor keys of the node.
31
+ */
32
+ export function getKeys(node) {
33
+ return Object.keys(node).filter(filterKey);
34
+ }
35
+
36
+ // Disable valid-jsdoc rule because it reports syntax error on the type of @returns.
37
+ // eslint-disable-next-line valid-jsdoc
38
+ /**
39
+ * Make the union set with `KEYS` and given keys.
40
+ * @param {VisitorKeys} additionalKeys The additional keys.
41
+ * @returns {VisitorKeys} The union set.
42
+ */
43
+ export function unionWith(additionalKeys) {
44
+ const retv = /** @type {{
45
+ [type: string]: ReadonlyArray<string>
46
+ }} */ (Object.assign({}, KEYS));
47
+
48
+ for (const type of Object.keys(additionalKeys)) {
49
+ if (Object.prototype.hasOwnProperty.call(retv, type)) {
50
+ const keys = new Set(additionalKeys[type]);
51
+
52
+ for (const key of retv[type]) {
53
+ keys.add(key);
54
+ }
55
+
56
+ retv[type] = Object.freeze(Array.from(keys));
57
+ } else {
58
+ retv[type] = Object.freeze(Array.from(additionalKeys[type]));
59
+ }
60
+ }
61
+
62
+ return Object.freeze(retv);
63
+ }
64
+
65
+ export { KEYS };