@tsrx/eslint-parser 0.7.5 → 0.7.6

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/README.md CHANGED
@@ -64,7 +64,9 @@ ESTree-compatible AST that ESLint can analyze.
64
64
  The parser:
65
65
 
66
66
  1. Parses the TSRX source code (`.tsrx`)
67
- 2. Normalizes the AST for ESLint traversal
67
+ 2. Normalizes the AST for ESLint traversal, and gives ESLint typescript-eslint's
68
+ visitor keys, so rules visit each node's children in the order they do with
69
+ typescript-eslint's parser or espree
68
70
  3. Returns the ESTree AST to ESLint
69
71
  4. Allows ESLint rules to analyze TSRX-specific patterns
70
72
 
@@ -136,7 +138,9 @@ Some core ESLint rules miss part of what TSRX syntax does, and the parser can't
136
138
  change that without misdescribing the source to other rules.
137
139
  [`@tsrx/eslint-plugin`](https://www.npmjs.com/package/@tsrx/eslint-plugin) has
138
140
  TSRX versions of these rules. Its `js` configuration, for `js.configs.recommended`
139
- users, uses `tsrx/no-unused-vars` and `tsrx/no-unreachable` for `.tsrx` files:
141
+ users, uses `tsrx/no-unused-vars` and `tsrx/no-unreachable` for `.tsrx` files, and
142
+ on ESLint 10, whose `js.configs.recommended` turns on `no-useless-assignment`,
143
+ `tsrx/no-useless-assignment`:
140
144
 
141
145
  - `no-unused-vars` reports an unused `@for` index, but its "Remove unused
142
146
  variable" suggestion deletes only the name, and `index )` doesn't parse.
@@ -156,6 +160,16 @@ users, uses `tsrx/no-unused-vars` and `tsrx/no-unreachable` for `.tsrx` files:
156
160
  `tsrx/no-unreachable` treats `@pending`, the `@catch` and the code after the
157
161
  `@try` as reached whenever the `@try` is, unless the body or `@pending` awaits
158
162
  or yields and doesn't reach its end.
163
+ - For the same reason, `no-useless-assignment` treats a value as overwritten by a
164
+ block of a `@try` though another block, or the code after the `@try`, reads it:
165
+ a value set before the `@try` and assigned in the body but read in `@pending` or
166
+ the `@catch`, or a value assigned in the body and again in the `@catch` before
167
+ the code after the `@try` reads it. `tsrx/no-useless-assignment` lets each block
168
+ start from the start of the `@try` or from the end of any block before it,
169
+ unless the body or `@pending` awaits or yields. It still reports a value read
170
+ only in a block that code path analysis holds unreachable, such as a `@catch`
171
+ after a body that throws, or only in a block that runs again after a later one,
172
+ such as the body after `reset()`.
159
173
 
160
174
  Other rules built on code paths still treat every `@switch` arm as always running.
161
175
  For example, `react-hooks/rules-of-hooks` doesn't report a hook called in a
@@ -170,9 +184,6 @@ No TSRX rule covers these:
170
184
  `@catch` throws, as if the loop could run only once.
171
185
  - `react-hooks/rules-of-hooks` reports as conditional a hook after a `@try`
172
186
  whose body or `@catch` throws.
173
- - `no-useless-assignment` treats an assignment in the body as overwritten by one
174
- in `@catch`. It also treats a value set before the `@try` as overwritten when
175
- the body or `@pending` assigns it, though the `@catch` reads it.
176
187
 
177
188
  `rules-of-hooks` also misses a hook such as `useState` called in `@catch`,
178
189
  though React fails on it. A `try` statement would fix these, but
@@ -194,9 +205,16 @@ No TSRX rule covers these:
194
205
  `@else`, `@else if` or `@for` body that holds a single statement, such as
195
206
  `@if (n) { throw error; }`. TSRX needs them, so `--fix` leaves a file that
196
207
  doesn't parse. Use `all` or `multi-line`, which leave these bodies alone.
197
- - A `@pending` block shows while the `@try` body suspends, but code path analysis
198
- runs it after the body. So `no-useless-assignment` can flag a value only
199
- `@pending` reads, when the body overwrites it or can't complete.
208
+ - `indent` crashes on a `{name}` shorthand attribute, such as
209
+ `<Child {fetchProject} />`, with
210
+ `Cannot read properties of null (reading 'range')`
211
+ ([#1153](https://github.com/tsrx-org/tsrx/issues/1153)). It looks for the `=`
212
+ between an attribute's name and its value, and a shorthand has none. The parser
213
+ gives the shorthand as a `JSXAttribute` whose value is the expression, which
214
+ `eslint-plugin-react` and `eslint-plugin-jsx-a11y` read, so no shape suits both.
215
+ To keep `indent`, give it `ignoredNodes: ['JSXAttribute[shorthand=true]']`, so
216
+ it doesn't check a shorthand attribute's lines, or turn it off for `.tsrx` files
217
+ and format them with `@tsrx/prettier-plugin`.
200
218
 
201
219
  ## Related Packages
202
220
 
package/dist/index.d.ts CHANGED
@@ -502,7 +502,7 @@ interface ParseResult {
502
502
  ast: Program;
503
503
  services?: Record<string, any>;
504
504
  scopeManager?: any;
505
- visitorKeys?: Record<string, string[]>;
505
+ visitorKeys?: Record<string, readonly string[]>;
506
506
  }
507
507
  /**
508
508
  * ESLint parser for TSRX (.tsrx) files
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","names":[],"sources":["../../../node_modules/.pnpm/@types+estree@1.0.8/node_modules/@types/estree/index.d.ts","../src/index.ts"],"x_google_ignoreList":[0],"mappings":";;;;;;;;;;;;;;;;;;;UAkBiB;;;;EAIb;EACA,MAAM;EACN;;UAGa,iBAAiB;EAC9B,kBAAkB;EAClB,mBAAmB;;UA8BN,gBAAgB;EAC7B;EACA;;UAGa;EACb;EACA,OAAO;EACP,KAAK;;UAGQ;;EAEb;;EAEA;;UAGa,gBAAgB;EAC7B;EACA;EACA,MAAM,MAAM,YAAY,YAAY;EACpC,WAAW;;UAGE,kBAAkB;EAC/B;EACA,YAAY;EACZ;;UAGa,qBAAqB;EAClC,QAAQ;EACR;EACA;;;;EAIA,MAAM,iBAAiB;;KAKf,YACN,sBACA,iBACA,cACA,iBACA,oBACA,gBACA,kBACA,mBACA,iBACA,oBACA,cACA,kBACA,iBACA,eACA,iBACA,mBACA,eACA,iBACA,iBACA;UAEW,sBAAsB;UAEtB,uBAAuB;EACpC;;UAGa,uBAAuB;EACpC;EACA,MAAM;EACN,gBAAgB;;UAGH,oBAAoB,KAAK;EACtC;;UAGa,4BAA4B;EACzC;EACA,YAAY;;UAGC,oBAAoB;EACjC;EACA,MAAM;EACN,YAAY;EACZ,YAAY;;UAGC,yBAAyB;EACtC;EACA,OAAO;EACP,MAAM;;UAGO,uBAAuB;EACpC;EACA,QAAQ;;UAGK,0BAA0B;EACvC;EACA,QAAQ;;UAGK,sBAAsB;EACnC;EACA,QAAQ;EACR,MAAM;;UAGO,wB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gCAAgC,6BAA6B;;UAG7D,6BAA6B;EAC1C;EACA,UAAU,aAAa;EACvB,YAAY;EACZ,QAAQ;;UAGK,wBAAwB;EACrC;EACA,UAAU;;;;UC3qBJ;EACT,KAAK;EACL,WAAW;EACX;EACA,cAAc;;;;;;;;wBA2pBC,eAAe,cAAc,UAAU,OAAO,gBAAgB;;;;wBA6E9D,MAAM,cAAc,UAAU,OAAO,gBAAgB"}
1
+ {"version":3,"file":"index.d.ts","names":[],"sources":["../../../node_modules/.pnpm/@types+estree@1.0.8/node_modules/@types/estree/index.d.ts","../src/index.ts"],"x_google_ignoreList":[0],"mappings":";;;;;;;;;;;;;;;;;;;UAkBiB;;;;EAIb;EACA,MAAM;EACN;;UAGa,iBAAiB;EAC9B,kBAAkB;EAClB,mBAAmB;;UA8BN,gBAAgB;EAC7B;EACA;;UAGa;EACb;EACA,OAAO;EACP,KAAK;;UAGQ;;EAEb;;EAEA;;UAGa,gBAAgB;EAC7B;EACA;EACA,MAAM,MAAM,YAAY,YAAY;EACpC,WAAW;;UAGE,kBAAkB;EAC/B;EACA,YAAY;EACZ;;UAGa,qBAAqB;EAClC,QAAQ;EACR;EACA;;;;EAIA,MAAM,iBAAiB;;KAKf,YACN,sBACA,iBACA,cACA,iBACA,oBACA,gBACA,kBACA,mBACA,iBACA,oBACA,cACA,kBACA,iBACA,eACA,iBACA,mBACA,eACA,iBACA,iBACA;UAEW,sBAAsB;UAEtB,uBAAuB;EACpC;;UAGa,uBAAuB;EACpC;EACA,MAAM;EACN,gBAAgB;;UAGH,oBAAoB,KAAK;EACtC;;UAGa,4BAA4B;EACzC;EACA,YAAY;;UAGC,oBAAoB;EACjC;EACA,MAAM;EACN,YAAY;EACZ,YAAY;;UAGC,yBAAyB;EACtC;EACA,OAAO;EACP,MAAM;;UAGO,uBAAuB;EACpC;EACA,QAAQ;;UAGK,0BAA0B;EACvC;EACA,QAAQ;;UAGK,sBAAsB;EACnC;EACA,QAAQ;EACR,MAAM;;UAGO,wBAA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AAgC,6BAA6B;;UAG7D,6BAA6B;EAC1C;EACA,UAAU,aAAa;EACvB,YAAY;EACZ,QAAQ;;UAGK,wBAAwB;EACrC;EACA,UAAU;;;;UC1qBJ;EACT,KAAK;EACL,WAAW;EACX;EACA,cAAc;;;;;;;;wBA0sBC,eAAe,cAAc,UAAU,OAAO,gBAAgB;;;;wBA6E9D,MAAM,cAAc,UAAU,OAAO,gBAAgB"}
package/dist/index.js CHANGED
@@ -1,6 +1,519 @@
1
1
  import { DIAGNOSTIC_CODES, analyzeTsrx, parseModule } from "@tsrx/core";
2
2
  import { Definition, Referencer, ScopeManager } from "eslint-scope";
3
+ //#region \0rolldown/runtime.js
4
+ var __commonJSMin = (cb, mod) => () => (mod || (cb((mod = { exports: {} }).exports, mod), cb = null), mod.exports);
5
+ //#endregion
6
+ //#region ../../node_modules/.pnpm/eslint-visitor-keys@5.0.1/node_modules/eslint-visitor-keys/dist/eslint-visitor-keys.cjs
7
+ var require_eslint_visitor_keys = /* @__PURE__ */ __commonJSMin(((exports) => {
8
+ /**
9
+ * @typedef {{ readonly [type: string]: ReadonlyArray<string> }} VisitorKeys
10
+ */
11
+ /**
12
+ * @type {VisitorKeys}
13
+ */
14
+ const KEYS = {
15
+ ArrayExpression: ["elements"],
16
+ ArrayPattern: ["elements"],
17
+ ArrowFunctionExpression: ["params", "body"],
18
+ AssignmentExpression: ["left", "right"],
19
+ AssignmentPattern: ["left", "right"],
20
+ AwaitExpression: ["argument"],
21
+ BinaryExpression: ["left", "right"],
22
+ BlockStatement: ["body"],
23
+ BreakStatement: ["label"],
24
+ CallExpression: ["callee", "arguments"],
25
+ CatchClause: ["param", "body"],
26
+ ChainExpression: ["expression"],
27
+ ClassBody: ["body"],
28
+ ClassDeclaration: [
29
+ "id",
30
+ "superClass",
31
+ "body"
32
+ ],
33
+ ClassExpression: [
34
+ "id",
35
+ "superClass",
36
+ "body"
37
+ ],
38
+ ConditionalExpression: [
39
+ "test",
40
+ "consequent",
41
+ "alternate"
42
+ ],
43
+ ContinueStatement: ["label"],
44
+ DebuggerStatement: [],
45
+ DoWhileStatement: ["body", "test"],
46
+ EmptyStatement: [],
47
+ ExperimentalRestProperty: ["argument"],
48
+ ExperimentalSpreadProperty: ["argument"],
49
+ ExportAllDeclaration: [
50
+ "exported",
51
+ "source",
52
+ "attributes"
53
+ ],
54
+ ExportDefaultDeclaration: ["declaration"],
55
+ ExportNamedDeclaration: [
56
+ "declaration",
57
+ "specifiers",
58
+ "source",
59
+ "attributes"
60
+ ],
61
+ ExportSpecifier: ["local", "exported"],
62
+ ExpressionStatement: ["expression"],
63
+ ForInStatement: [
64
+ "left",
65
+ "right",
66
+ "body"
67
+ ],
68
+ ForOfStatement: [
69
+ "left",
70
+ "right",
71
+ "body"
72
+ ],
73
+ ForStatement: [
74
+ "init",
75
+ "test",
76
+ "update",
77
+ "body"
78
+ ],
79
+ FunctionDeclaration: [
80
+ "id",
81
+ "params",
82
+ "body"
83
+ ],
84
+ FunctionExpression: [
85
+ "id",
86
+ "params",
87
+ "body"
88
+ ],
89
+ Identifier: [],
90
+ IfStatement: [
91
+ "test",
92
+ "consequent",
93
+ "alternate"
94
+ ],
95
+ ImportAttribute: ["key", "value"],
96
+ ImportDeclaration: [
97
+ "specifiers",
98
+ "source",
99
+ "attributes"
100
+ ],
101
+ ImportDefaultSpecifier: ["local"],
102
+ ImportExpression: ["source", "options"],
103
+ ImportNamespaceSpecifier: ["local"],
104
+ ImportSpecifier: ["imported", "local"],
105
+ JSXAttribute: ["name", "value"],
106
+ JSXClosingElement: ["name"],
107
+ JSXClosingFragment: [],
108
+ JSXElement: [
109
+ "openingElement",
110
+ "children",
111
+ "closingElement"
112
+ ],
113
+ JSXEmptyExpression: [],
114
+ JSXExpressionContainer: ["expression"],
115
+ JSXFragment: [
116
+ "openingFragment",
117
+ "children",
118
+ "closingFragment"
119
+ ],
120
+ JSXIdentifier: [],
121
+ JSXMemberExpression: ["object", "property"],
122
+ JSXNamespacedName: ["namespace", "name"],
123
+ JSXOpeningElement: ["name", "attributes"],
124
+ JSXOpeningFragment: [],
125
+ JSXSpreadAttribute: ["argument"],
126
+ JSXSpreadChild: ["expression"],
127
+ JSXText: [],
128
+ LabeledStatement: ["label", "body"],
129
+ Literal: [],
130
+ LogicalExpression: ["left", "right"],
131
+ MemberExpression: ["object", "property"],
132
+ MetaProperty: ["meta", "property"],
133
+ MethodDefinition: ["key", "value"],
134
+ NewExpression: ["callee", "arguments"],
135
+ ObjectExpression: ["properties"],
136
+ ObjectPattern: ["properties"],
137
+ PrivateIdentifier: [],
138
+ Program: ["body"],
139
+ Property: ["key", "value"],
140
+ PropertyDefinition: ["key", "value"],
141
+ RestElement: ["argument"],
142
+ ReturnStatement: ["argument"],
143
+ SequenceExpression: ["expressions"],
144
+ SpreadElement: ["argument"],
145
+ StaticBlock: ["body"],
146
+ Super: [],
147
+ SwitchCase: ["test", "consequent"],
148
+ SwitchStatement: ["discriminant", "cases"],
149
+ TaggedTemplateExpression: ["tag", "quasi"],
150
+ TemplateElement: [],
151
+ TemplateLiteral: ["quasis", "expressions"],
152
+ ThisExpression: [],
153
+ ThrowStatement: ["argument"],
154
+ TryStatement: [
155
+ "block",
156
+ "handler",
157
+ "finalizer"
158
+ ],
159
+ UnaryExpression: ["argument"],
160
+ UpdateExpression: ["argument"],
161
+ VariableDeclaration: ["declarations"],
162
+ VariableDeclarator: ["id", "init"],
163
+ WhileStatement: ["test", "body"],
164
+ WithStatement: ["object", "body"],
165
+ YieldExpression: ["argument"]
166
+ };
167
+ const NODE_TYPES = Object.keys(KEYS);
168
+ for (const type of NODE_TYPES) Object.freeze(KEYS[type]);
169
+ Object.freeze(KEYS);
170
+ /**
171
+ * @author Toru Nagashima <https://github.com/mysticatea>
172
+ * See LICENSE file in root directory for full license.
173
+ */
174
+ /**
175
+ * @typedef {import('./visitor-keys.js').VisitorKeys} VisitorKeys
176
+ */
177
+ const KEY_BLACKLIST = /* @__PURE__ */ new Set([
178
+ "parent",
179
+ "leadingComments",
180
+ "trailingComments"
181
+ ]);
182
+ /**
183
+ * Check whether a given key should be used or not.
184
+ * @param {string} key The key to check.
185
+ * @returns {boolean} `true` if the key should be used.
186
+ */
187
+ function filterKey(key) {
188
+ return !KEY_BLACKLIST.has(key) && key[0] !== "_";
189
+ }
190
+ /**
191
+ * Get visitor keys of a given node.
192
+ * @param {Object} node The AST node to get keys.
193
+ * @returns {readonly string[]} Visitor keys of the node.
194
+ */
195
+ function getKeys(node) {
196
+ return Object.keys(node).filter(filterKey);
197
+ }
198
+ /**
199
+ * Make the union set with `KEYS` and given keys.
200
+ * @param {VisitorKeys} additionalKeys The additional keys.
201
+ * @returns {VisitorKeys} The union set.
202
+ */
203
+ function unionWith(additionalKeys) {
204
+ const retv = Object.assign({}, KEYS);
205
+ for (const type of Object.keys(additionalKeys)) if (Object.hasOwn(retv, type)) {
206
+ const keys = new Set(additionalKeys[type]);
207
+ for (const key of retv[type]) keys.add(key);
208
+ retv[type] = Object.freeze(Array.from(keys));
209
+ } else retv[type] = Object.freeze(Array.from(additionalKeys[type]));
210
+ return Object.freeze(retv);
211
+ }
212
+ exports.KEYS = KEYS;
213
+ exports.getKeys = getKeys;
214
+ exports.unionWith = unionWith;
215
+ }));
216
+ //#endregion
217
+ //#region ../../node_modules/.pnpm/@typescript-eslint+visitor-keys@8.56.1_typescript@5.9.3/node_modules/@typescript-eslint/visitor-keys/dist/get-keys.js
218
+ var require_get_keys = /* @__PURE__ */ __commonJSMin(((exports) => {
219
+ Object.defineProperty(exports, "__esModule", { value: true });
220
+ exports.getKeys = void 0;
221
+ exports.getKeys = require_eslint_visitor_keys().getKeys;
222
+ }));
223
+ //#endregion
224
+ //#region ../../node_modules/.pnpm/@typescript-eslint+visitor-keys@8.56.1_typescript@5.9.3/node_modules/@typescript-eslint/visitor-keys/dist/visitor-keys.js
225
+ var require_visitor_keys = /* @__PURE__ */ __commonJSMin(((exports) => {
226
+ var __createBinding = exports && exports.__createBinding || (Object.create ? (function(o, m, k, k2) {
227
+ if (k2 === void 0) k2 = k;
228
+ var desc = Object.getOwnPropertyDescriptor(m, k);
229
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) desc = {
230
+ enumerable: true,
231
+ get: function() {
232
+ return m[k];
233
+ }
234
+ };
235
+ Object.defineProperty(o, k2, desc);
236
+ }) : (function(o, m, k, k2) {
237
+ if (k2 === void 0) k2 = k;
238
+ o[k2] = m[k];
239
+ }));
240
+ var __setModuleDefault = exports && exports.__setModuleDefault || (Object.create ? (function(o, v) {
241
+ Object.defineProperty(o, "default", {
242
+ enumerable: true,
243
+ value: v
244
+ });
245
+ }) : function(o, v) {
246
+ o["default"] = v;
247
+ });
248
+ var __importStar = exports && exports.__importStar || (function() {
249
+ var ownKeys = function(o) {
250
+ ownKeys = Object.getOwnPropertyNames || function(o) {
251
+ var ar = [];
252
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
253
+ return ar;
254
+ };
255
+ return ownKeys(o);
256
+ };
257
+ return function(mod) {
258
+ if (mod && mod.__esModule) return mod;
259
+ var result = {};
260
+ if (mod != null) {
261
+ for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
262
+ }
263
+ __setModuleDefault(result, mod);
264
+ return result;
265
+ };
266
+ })();
267
+ Object.defineProperty(exports, "__esModule", { value: true });
268
+ exports.visitorKeys = void 0;
269
+ const eslintVisitorKeys = __importStar(require_eslint_visitor_keys());
270
+ const SharedVisitorKeys = (() => {
271
+ const FunctionType = [
272
+ "typeParameters",
273
+ "params",
274
+ "returnType"
275
+ ];
276
+ const AnonymousFunction = [...FunctionType, "body"];
277
+ const AbstractPropertyDefinition = [
278
+ "decorators",
279
+ "key",
280
+ "typeAnnotation"
281
+ ];
282
+ return {
283
+ AbstractPropertyDefinition: [
284
+ "decorators",
285
+ "key",
286
+ "typeAnnotation"
287
+ ],
288
+ AnonymousFunction,
289
+ AsExpression: ["expression", "typeAnnotation"],
290
+ ClassDeclaration: [
291
+ "decorators",
292
+ "id",
293
+ "typeParameters",
294
+ "superClass",
295
+ "superTypeArguments",
296
+ "implements",
297
+ "body"
298
+ ],
299
+ Function: ["id", ...AnonymousFunction],
300
+ FunctionType,
301
+ PropertyDefinition: [...AbstractPropertyDefinition, "value"]
302
+ };
303
+ })();
304
+ const additionalKeys = {
305
+ AccessorProperty: SharedVisitorKeys.PropertyDefinition,
306
+ ArrayPattern: [
307
+ "decorators",
308
+ "elements",
309
+ "typeAnnotation"
310
+ ],
311
+ ArrowFunctionExpression: SharedVisitorKeys.AnonymousFunction,
312
+ AssignmentPattern: [
313
+ "decorators",
314
+ "left",
315
+ "right",
316
+ "typeAnnotation"
317
+ ],
318
+ CallExpression: [
319
+ "callee",
320
+ "typeArguments",
321
+ "arguments"
322
+ ],
323
+ ClassDeclaration: SharedVisitorKeys.ClassDeclaration,
324
+ ClassExpression: SharedVisitorKeys.ClassDeclaration,
325
+ Decorator: ["expression"],
326
+ ExportAllDeclaration: [
327
+ "exported",
328
+ "source",
329
+ "attributes"
330
+ ],
331
+ ExportNamedDeclaration: [
332
+ "declaration",
333
+ "specifiers",
334
+ "source",
335
+ "attributes"
336
+ ],
337
+ FunctionDeclaration: SharedVisitorKeys.Function,
338
+ FunctionExpression: SharedVisitorKeys.Function,
339
+ Identifier: ["decorators", "typeAnnotation"],
340
+ ImportAttribute: ["key", "value"],
341
+ ImportDeclaration: [
342
+ "specifiers",
343
+ "source",
344
+ "attributes"
345
+ ],
346
+ ImportExpression: ["source", "options"],
347
+ JSXClosingFragment: [],
348
+ JSXOpeningElement: [
349
+ "name",
350
+ "typeArguments",
351
+ "attributes"
352
+ ],
353
+ JSXOpeningFragment: [],
354
+ JSXSpreadChild: ["expression"],
355
+ MethodDefinition: [
356
+ "decorators",
357
+ "key",
358
+ "value"
359
+ ],
360
+ NewExpression: [
361
+ "callee",
362
+ "typeArguments",
363
+ "arguments"
364
+ ],
365
+ ObjectPattern: [
366
+ "decorators",
367
+ "properties",
368
+ "typeAnnotation"
369
+ ],
370
+ PropertyDefinition: SharedVisitorKeys.PropertyDefinition,
371
+ RestElement: [
372
+ "decorators",
373
+ "argument",
374
+ "typeAnnotation"
375
+ ],
376
+ StaticBlock: ["body"],
377
+ TaggedTemplateExpression: [
378
+ "tag",
379
+ "typeArguments",
380
+ "quasi"
381
+ ],
382
+ TSAbstractAccessorProperty: SharedVisitorKeys.AbstractPropertyDefinition,
383
+ TSAbstractKeyword: [],
384
+ TSAbstractMethodDefinition: ["key", "value"],
385
+ TSAbstractPropertyDefinition: SharedVisitorKeys.AbstractPropertyDefinition,
386
+ TSAnyKeyword: [],
387
+ TSArrayType: ["elementType"],
388
+ TSAsExpression: SharedVisitorKeys.AsExpression,
389
+ TSAsyncKeyword: [],
390
+ TSBigIntKeyword: [],
391
+ TSBooleanKeyword: [],
392
+ TSCallSignatureDeclaration: SharedVisitorKeys.FunctionType,
393
+ TSClassImplements: ["expression", "typeArguments"],
394
+ TSConditionalType: [
395
+ "checkType",
396
+ "extendsType",
397
+ "trueType",
398
+ "falseType"
399
+ ],
400
+ TSConstructorType: SharedVisitorKeys.FunctionType,
401
+ TSConstructSignatureDeclaration: SharedVisitorKeys.FunctionType,
402
+ TSDeclareFunction: SharedVisitorKeys.Function,
403
+ TSDeclareKeyword: [],
404
+ TSEmptyBodyFunctionExpression: ["id", ...SharedVisitorKeys.FunctionType],
405
+ TSEnumBody: ["members"],
406
+ TSEnumDeclaration: ["id", "body"],
407
+ TSEnumMember: ["id", "initializer"],
408
+ TSExportAssignment: ["expression"],
409
+ TSExportKeyword: [],
410
+ TSExternalModuleReference: ["expression"],
411
+ TSFunctionType: SharedVisitorKeys.FunctionType,
412
+ TSImportEqualsDeclaration: ["id", "moduleReference"],
413
+ TSImportType: [
414
+ "source",
415
+ "options",
416
+ "qualifier",
417
+ "typeArguments"
418
+ ],
419
+ TSIndexedAccessType: ["objectType", "indexType"],
420
+ TSIndexSignature: ["parameters", "typeAnnotation"],
421
+ TSInferType: ["typeParameter"],
422
+ TSInstantiationExpression: ["expression", "typeArguments"],
423
+ TSInterfaceBody: ["body"],
424
+ TSInterfaceDeclaration: [
425
+ "id",
426
+ "typeParameters",
427
+ "extends",
428
+ "body"
429
+ ],
430
+ TSInterfaceHeritage: ["expression", "typeArguments"],
431
+ TSIntersectionType: ["types"],
432
+ TSIntrinsicKeyword: [],
433
+ TSLiteralType: ["literal"],
434
+ TSMappedType: [
435
+ "key",
436
+ "constraint",
437
+ "nameType",
438
+ "typeAnnotation"
439
+ ],
440
+ TSMethodSignature: [
441
+ "key",
442
+ "typeParameters",
443
+ "params",
444
+ "returnType"
445
+ ],
446
+ TSModuleBlock: ["body"],
447
+ TSModuleDeclaration: ["id", "body"],
448
+ TSNamedTupleMember: ["label", "elementType"],
449
+ TSNamespaceExportDeclaration: ["id"],
450
+ TSNeverKeyword: [],
451
+ TSNonNullExpression: ["expression"],
452
+ TSNullKeyword: [],
453
+ TSNumberKeyword: [],
454
+ TSObjectKeyword: [],
455
+ TSOptionalType: ["typeAnnotation"],
456
+ TSParameterProperty: ["decorators", "parameter"],
457
+ TSPrivateKeyword: [],
458
+ TSPropertySignature: ["key", "typeAnnotation"],
459
+ TSProtectedKeyword: [],
460
+ TSPublicKeyword: [],
461
+ TSQualifiedName: ["left", "right"],
462
+ TSReadonlyKeyword: [],
463
+ TSRestType: ["typeAnnotation"],
464
+ TSSatisfiesExpression: SharedVisitorKeys.AsExpression,
465
+ TSStaticKeyword: [],
466
+ TSStringKeyword: [],
467
+ TSSymbolKeyword: [],
468
+ TSTemplateLiteralType: ["quasis", "types"],
469
+ TSThisType: [],
470
+ TSTupleType: ["elementTypes"],
471
+ TSTypeAliasDeclaration: [
472
+ "id",
473
+ "typeParameters",
474
+ "typeAnnotation"
475
+ ],
476
+ TSTypeAnnotation: ["typeAnnotation"],
477
+ TSTypeAssertion: ["typeAnnotation", "expression"],
478
+ TSTypeLiteral: ["members"],
479
+ TSTypeOperator: ["typeAnnotation"],
480
+ TSTypeParameter: [
481
+ "name",
482
+ "constraint",
483
+ "default"
484
+ ],
485
+ TSTypeParameterDeclaration: ["params"],
486
+ TSTypeParameterInstantiation: ["params"],
487
+ TSTypePredicate: ["parameterName", "typeAnnotation"],
488
+ TSTypeQuery: ["exprName", "typeArguments"],
489
+ TSTypeReference: ["typeName", "typeArguments"],
490
+ TSUndefinedKeyword: [],
491
+ TSUnionType: ["types"],
492
+ TSUnknownKeyword: [],
493
+ TSVoidKeyword: []
494
+ };
495
+ exports.visitorKeys = eslintVisitorKeys.unionWith(additionalKeys);
496
+ }));
497
+ //#endregion
3
498
  //#region src/index.ts
499
+ var import_dist = (/* @__PURE__ */ __commonJSMin(((exports) => {
500
+ Object.defineProperty(exports, "__esModule", { value: true });
501
+ exports.visitorKeys = exports.getKeys = void 0;
502
+ var get_keys_1 = require_get_keys();
503
+ Object.defineProperty(exports, "getKeys", {
504
+ enumerable: true,
505
+ get: function() {
506
+ return get_keys_1.getKeys;
507
+ }
508
+ });
509
+ var visitor_keys_1 = require_visitor_keys();
510
+ Object.defineProperty(exports, "visitorKeys", {
511
+ enumerable: true,
512
+ get: function() {
513
+ return visitor_keys_1.visitorKeys;
514
+ }
515
+ });
516
+ })))();
4
517
  const visitorKeys = {
5
518
  Program: ["body"],
6
519
  JSXElement: [
@@ -62,6 +575,79 @@ const visitorKeys = {
62
575
  "finalizer"
63
576
  ]
64
577
  };
578
+ const SIGNATURE_KEYS = [
579
+ "typeParameters",
580
+ "parameters",
581
+ "typeAnnotation"
582
+ ];
583
+ const CLASS_KEYS = [
584
+ "decorators",
585
+ "id",
586
+ "typeParameters",
587
+ "superClass",
588
+ "superTypeParameters",
589
+ "implements",
590
+ "body"
591
+ ];
592
+ /**
593
+ * The keys ESLint walks the tree with. For a type without keys, ESLint visits
594
+ * the node's properties in the order the parser set them, which puts a label
595
+ * after its statement, a switch case's test after its consequent, a call's
596
+ * type arguments after its arguments and decorators last. Rules that follow
597
+ * the code path, such as `no-useless-assignment`, then reported falsely even
598
+ * in plain JavaScript. typescript-eslint's keys list each node's children in
599
+ * source order. The TSRX parser names a few parts of TypeScript nodes as
600
+ * Babel does (a function type's `parameters` and `typeAnnotation`, a class's
601
+ * `superTypeParameters`), so those types list its names, and a `@catch` can
602
+ * take a `reset` function. A function type's `params` is the same array as
603
+ * its `parameters` and isn't listed, so each parameter is visited once. Scope
604
+ * analysis keeps `visitorKeys` and its own fallback.
605
+ */
606
+ const eslint_visitor_keys = {
607
+ ...import_dist.visitorKeys,
608
+ CatchClause: [
609
+ "param",
610
+ "resetParam",
611
+ "body"
612
+ ],
613
+ ClassDeclaration: CLASS_KEYS,
614
+ ClassExpression: CLASS_KEYS,
615
+ MethodDefinition: [
616
+ "decorators",
617
+ "key",
618
+ "typeParameters",
619
+ "value"
620
+ ],
621
+ StaticBlock: ["decorators", "body"],
622
+ TSIndexSignature: [
623
+ "decorators",
624
+ "parameters",
625
+ "typeAnnotation"
626
+ ],
627
+ TSCallSignatureDeclaration: SIGNATURE_KEYS,
628
+ TSConstructSignatureDeclaration: SIGNATURE_KEYS,
629
+ TSConstructorType: SIGNATURE_KEYS,
630
+ TSFunctionType: SIGNATURE_KEYS,
631
+ TSMethodSignature: ["key", ...SIGNATURE_KEYS],
632
+ TSImportType: [
633
+ "argument",
634
+ "options",
635
+ "qualifier",
636
+ "typeArguments"
637
+ ],
638
+ TSMappedType: [
639
+ "typeParameter",
640
+ "nameType",
641
+ "typeAnnotation"
642
+ ],
643
+ ...visitorKeys,
644
+ JSXOpeningElement: [
645
+ "name",
646
+ "tagExpression",
647
+ "typeArguments",
648
+ "attributes"
649
+ ]
650
+ };
65
651
  /**
66
652
  * eslint-scope's referencer, plus the `@for` parts: the loop's `index` and
67
653
  * `key` belong to the loop's scope, like its variable, and the `@empty` branch
@@ -558,7 +1144,7 @@ function parseForESLint(code, options) {
558
1144
  ast: result,
559
1145
  services: { tsrxDiagnostics: errors },
560
1146
  scopeManager: analyze_scope(result, options),
561
- visitorKeys
1147
+ visitorKeys: eslint_visitor_keys
562
1148
  };
563
1149
  } catch (error) {
564
1150
  if (error instanceof SyntaxError && error.lineNumber != null) throw error;
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["parse_module"],"sources":["../src/index.ts"],"sourcesContent":["import type { Program } from 'estree';\nimport type { AST, Linter } from 'eslint';\nimport {\n\tanalyzeTsrx as analyze_tsrx,\n\tDIAGNOSTIC_CODES,\n\tparseModule as parse_module,\n} from '@tsrx/core';\nimport { Definition, Referencer, ScopeManager } from 'eslint-scope';\n\ninterface ParseResult {\n\tast: Program;\n\tservices?: Record<string, any>;\n\tscopeManager?: any;\n\tvisitorKeys?: Record<string, string[]>;\n}\n\nconst visitorKeys: Record<string, string[]> = {\n\tProgram: ['body'],\n\tJSXElement: ['openingElement', 'children', 'closingElement'],\n\tJSXOpeningElement: ['name', 'tagExpression', 'attributes'],\n\tJSXClosingElement: ['name', 'tagExpression'],\n\tJSXFragment: ['openingFragment', 'children', 'closingFragment'],\n\tJSXOpeningFragment: [],\n\tJSXClosingFragment: [],\n\tJSXExpressionContainer: ['expression'],\n\tJSXAttribute: ['name', 'value'],\n\tJSXSpreadAttribute: ['argument'],\n\tJSXIdentifier: [],\n\tJSXMemberExpression: ['object', 'property'],\n\tJSXNamespacedName: ['namespace', 'name'],\n\tJSXText: [],\n\tJSXStyleElement: ['openingElement', 'children', 'closingElement'],\n\tJSXIfExpression: ['statement'],\n\tJSXForExpression: ['index', 'key', 'loop', 'empty'],\n\tJSXSwitchExpression: ['discriminant', 'cases'],\n\tJSXSwitchCase: ['test', 'consequent'],\n\tJSXTryExpression: ['block', 'pending', 'handler', 'finalizer'],\n\tJSXCodeBlock: ['body', 'render'],\n\tStyleSheet: [],\n\tForOfStatement: ['left', 'right', 'body'],\n\t// eslint-scope's default keys leave out `pending`, so without this, scope\n\t// analysis would skip the `pending` block of a plain `try`.\n\tTryStatement: ['block', 'pending', 'handler', 'finalizer'],\n};\n\n/**\n * eslint-scope's referencer, plus the `@for` parts: the loop's `index` and\n * `key` belong to the loop's scope, like its variable, and the `@empty` branch\n * runs outside it. TSRX gives every iteration its own index. A `@catch` can\n * also take a `reset` function after the error.\n */\nclass TSRXReferencer extends Referencer {\n\t#tsrx_for_by_loop = new Map<any, any>();\n\t#var_heads = new Set<any>();\n\n\tJSXOpeningElement(node: any): void {\n\t\tif (!node.tagExpression) {\n\t\t\tsuper.JSXOpeningElement(node);\n\t\t\treturn;\n\t\t}\n\t\t// A dynamic tag's expression holds its references, with or without JSX\n\t\t// enabled. The name that mirrors it holds none.\n\t\tthis.visit(node.tagExpression);\n\t\tnode.attributes.forEach(this.visit, this);\n\t}\n\n\t// A closing tag repeats the opening tag's name, so it adds no references.\n\t// With JSX enabled, eslint-scope read the `</style>` of a `<style>` element\n\t// as one.\n\tJSXClosingElement(): void {}\n\n\tJSXForExpression(node: any): void {\n\t\tthis.#tsrx_for_by_loop.set(node.loop, node);\n\t\t// TSRX runs each iteration in a callback, so the loop has a scope of its\n\t\t// own whatever its head declares. eslint-scope opens one only for a\n\t\t// `let` or `const` head.\n\t\tconst head = node.loop.type === 'ForStatement' ? node.loop.init : node.loop.left;\n\t\tif (head?.type !== 'VariableDeclaration' || head.kind === 'var') {\n\t\t\t(this as any).scopeManager.__nestForScope(node.loop);\n\t\t}\n\t\tif (head?.kind === 'var') this.#var_heads.add(head);\n\t\tthis.visit(node.loop);\n\t\tif (node.empty) this.visit(node.empty);\n\t}\n\n\tVariableDeclaration(node: any): void {\n\t\tif (!this.#var_heads.has(node)) {\n\t\t\tsuper.VariableDeclaration(node);\n\t\t\treturn;\n\t\t}\n\t\t// A `var` head declares the variable in the loop's scope, as `let` does.\n\t\tnode.declarations.forEach((declaration: any, index: number) => {\n\t\t\tthis.visitVariableDeclaration(this.currentScope(), 'Variable', node, index);\n\t\t\tif (declaration.init) this.visit(declaration.init);\n\t\t});\n\t}\n\n\tCatchClause(node: any): void {\n\t\tif (!node.resetParam) {\n\t\t\tsuper.CatchClause(node);\n\t\t\treturn;\n\t\t}\n\t\t// eslint-scope's `CatchClause`, with `reset` defined as the error is.\n\t\t(this as any).scopeManager.__nestCatchScope(node);\n\t\tfor (const param of [node.param, node.resetParam]) {\n\t\t\tthis.visitPattern(param, { processRightHandNodes: true }, (pattern: any, info: any) => {\n\t\t\t\t(this.currentScope() as any).__define(\n\t\t\t\t\tpattern,\n\t\t\t\t\tnew (Definition as any)('CatchClause', pattern, node, null, null, null),\n\t\t\t\t);\n\t\t\t\tthis.referencingDefaultValue(pattern, info.assignments, null, true);\n\t\t\t});\n\t\t}\n\t\tthis.visit(node.body);\n\t\tthis.close(node);\n\t}\n\n\tclose(node: any): void {\n\t\tconst tsrx_for = this.#tsrx_for_by_loop.get(node);\n\t\tif (tsrx_for?.index) {\n\t\t\t(this.currentScope() as any).__define(\n\t\t\t\ttsrx_for.index,\n\t\t\t\tnew (Definition as any)('Variable', tsrx_for.index, tsrx_for, tsrx_for, null, null),\n\t\t\t);\n\t\t}\n\t\tif (tsrx_for?.key) this.visit(tsrx_for.key);\n\t\tsuper.close(node);\n\t}\n}\n\n/**\n * Scope analysis as ESLint runs it, with `TSRXReferencer`. A `.tsrx` file is\n * always a module.\n */\nfunction analyze_scope(ast: any, options: Linter.ParserOptions | undefined): any {\n\tconst ecma_features = options?.ecmaFeatures ?? {};\n\tconst scope_options = {\n\t\tignoreEval: true,\n\t\tnodejsScope: ecma_features.globalReturn,\n\t\timpliedStrict: ecma_features.impliedStrict,\n\t\tecmaVersion: typeof options?.ecmaVersion === 'number' ? options.ecmaVersion : 6,\n\t\tsourceType: 'module',\n\t\tchildVisitorKeys: visitorKeys,\n\t\t// eslint-visitor-keys' `getKeys`, which ESLint passes\n\t\tfallback: (node: any) =>\n\t\t\tObject.keys(node).filter(\n\t\t\t\t(key) =>\n\t\t\t\t\tkey !== 'parent' &&\n\t\t\t\t\tkey !== 'leadingComments' &&\n\t\t\t\t\tkey !== 'trailingComments' &&\n\t\t\t\t\tkey[0] !== '_',\n\t\t\t),\n\t\tjsx: ecma_features.jsx,\n\t};\n\tconst scope_manager = new ScopeManager(scope_options as any);\n\tnew TSRXReferencer(scope_options as any, scope_manager).visit(ast);\n\treturn scope_manager;\n}\n\nconst LOOP_FIELDS: Record<string, string[]> = {\n\tForStatement: ['init', 'test', 'update', 'body'],\n\tForInStatement: ['left', 'right', 'body'],\n\tForOfStatement: ['await', 'left', 'right', 'body'],\n};\n\nconst STATEMENT_FIELDS: Record<string, { keyword: string; fields: string[] }> = {\n\tJSXIfExpression: { keyword: 'if', fields: ['test', 'consequent', 'alternate'] },\n};\n\nconst SIGNATURE_TYPES = new Set([\n\t'TSFunctionType',\n\t'TSConstructorType',\n\t'TSCallSignatureDeclaration',\n\t'TSConstructSignatureDeclaration',\n\t'TSMethodSignature',\n]);\n\n/** The name rules see for a dynamic tag that no JSX name can mirror. */\nconst DYNAMIC_TAG_NAME = 'tsrx-dynamic-tag';\n\n/**\n * The JSX name rules see for a dynamic tag: a `JSXIdentifier` or\n * `JSXMemberExpression` that mirrors its expression (`<{as}>` is `as`,\n * `<{ui.Box}>` is `ui.Box`), or a synthetic `JSXIdentifier` for any other\n * expression (`<{'div'}>`, `<{icons[key]}>`, `<{pick()}>`). The name spans the\n * braces, so a rule that fixes the text before or after it keeps them.\n */\nfunction dynamic_tag_name(container: any): any {\n\tconst name = mirror_tag_expression(container.expression) ?? {\n\t\ttype: 'JSXIdentifier',\n\t\tname: DYNAMIC_TAG_NAME,\n\t};\n\treturn { ...name, start: container.start, end: container.end };\n}\n\n/** The JSX name for an identifier or a chain of `.name` accesses, or `null`. */\nfunction mirror_tag_expression(node: any): any {\n\tif (node.type === 'Identifier') {\n\t\treturn { type: 'JSXIdentifier', name: node.name, start: node.start, end: node.end };\n\t}\n\tif (node.type !== 'MemberExpression' || node.computed || node.property.type !== 'Identifier') {\n\t\treturn null;\n\t}\n\t// `<this.Item>` is a JSX member name too.\n\tconst object =\n\t\tnode.object.type === 'ThisExpression'\n\t\t\t? { type: 'JSXIdentifier', name: 'this', start: node.object.start, end: node.object.end }\n\t\t\t: mirror_tag_expression(node.object);\n\treturn (\n\t\tobject && {\n\t\t\ttype: 'JSXMemberExpression',\n\t\t\tobject,\n\t\t\tproperty: mirror_tag_expression(node.property),\n\t\t\tstart: node.start,\n\t\t\tend: node.end,\n\t\t}\n\t);\n}\n\n/**\n * Keep this hook for small ESLint-only AST normalizations. Returns the `JSXText`\n * nodes, which each get a token of their own.\n */\nfunction normalize_tsrx_ast_for_eslint(ast: any, code: string): Span[] {\n\tconst texts: Span[] = [];\n\tconst seen = new Set<any>();\n\tconst visit = (node: any) => {\n\t\tif (!node || typeof node !== 'object') return;\n\t\tif (seen.has(node)) return;\n\t\tseen.add(node);\n\n\t\t// `<style apply={...} />` resolutions hold scope bindings whose reference\n\t\t// paths point back at AST ancestors. ESLint rules do not use them, and the\n\t\t// cycles break consumers that deep-clone or serialize the AST (RuleTester).\n\t\tif (node.type === 'JSXStyleElement' && node.metadata?.styleApplies) {\n\t\t\tdelete node.metadata.styleApplies;\n\t\t}\n\n\t\t// ESLint's code path analysis handles every `SwitchCase` as a case of a\n\t\t// `switch` statement and throws on one inside `@switch`. `@case` bodies\n\t\t// never fall through, so they need no switch code paths.\n\t\tif (node.type === 'JSXSwitchExpression') {\n\t\t\tfor (const switch_case of node.cases) switch_case.type = 'JSXSwitchCase';\n\t\t}\n\n\t\t// A comment in JSX text is a comment for ESLint, not a `{}` container:\n\t\t// drop the placeholder node the parser keeps for it.\n\t\tif (node.type === 'JSXElement' || node.type === 'JSXFragment') {\n\t\t\tnode.children = node.children.filter(\n\t\t\t\t(child: any) =>\n\t\t\t\t\tchild.type !== 'JSXExpressionContainer' ||\n\t\t\t\t\tchild.expression.type !== 'JSXEmptyExpression' ||\n\t\t\t\t\tchild.start !== child.expression.start,\n\t\t\t);\n\t\t}\n\n\t\t// The loop of a `@for` is a real for statement in `loop`, so rules such as\n\t\t// `semi` and `init-declarations` know its head. ESLint's code path analysis\n\t\t// allows a for statement no fields of its own, so `index`, `key` and the\n\t\t// `@empty` branch stay on `JSXForExpression`.\n\t\tif (node.type === 'JSXForExpression') {\n\t\t\tconst loop: any = {\n\t\t\t\ttype: node.statementType,\n\t\t\t\tstart: code.indexOf('for', node.start),\n\t\t\t\tend: node.body.end,\n\t\t\t};\n\t\t\tfor (const key of LOOP_FIELDS[node.statementType]) {\n\t\t\t\tloop[key] = node[key];\n\t\t\t\tdelete node[key];\n\t\t\t}\n\t\t\tnode.loop = loop;\n\t\t}\n\n\t\t// An `@if` likewise keeps its if statement in `statement`, so code path\n\t\t// analysis gives each arm a path of its own, as it does the branches of an\n\t\t// `if`. A `@try` keeps its blocks, in source order: as a `try` statement,\n\t\t// its body would be inside a `try`, though the React, Preact and Hono\n\t\t// output has none.\n\t\t// `react-hooks/rules-of-hooks` would then report as conditional every hook\n\t\t// after the body's first call, member access or identifier, except `use()`,\n\t\t// which 6.1.1 and 7.1.1 report anywhere in the body as inside a try/catch\n\t\t// block.\n\t\t// `@switch` keeps its cases: a `switch` would fall through from each case\n\t\t// into the next.\n\t\tif (node.type in STATEMENT_FIELDS) {\n\t\t\tconst { keyword, fields } = STATEMENT_FIELDS[node.type];\n\t\t\tconst statement: any = {\n\t\t\t\ttype: node.statementType,\n\t\t\t\tstart: code.indexOf(keyword, node.start),\n\t\t\t\tend: node.end,\n\t\t\t};\n\t\t\tfor (const key of fields) {\n\t\t\t\tstatement[key] = node[key];\n\t\t\t\tdelete node[key];\n\t\t\t}\n\t\t\tnode.statement = statement;\n\t\t}\n\n\t\t// The parser accepts a plain `try` with only a `pending` block. It compiles\n\t\t// to a `try` with neither a `catch` nor a `finally`, which isn't JavaScript,\n\t\t// and code path analysis throws on it.\n\t\tif (node.type === 'TryStatement' && !node.handler && !node.finalizer) {\n\t\t\tthrow to_eslint_parse_error({\n\t\t\t\tmessage: 'Missing catch or finally clause',\n\t\t\t\tloc: node.loc,\n\t\t\t\tstart: node.start,\n\t\t\t});\n\t\t}\n\n\t\t// Rules read a tag name as a JSX name, and crash on the expression\n\t\t// container of a dynamic tag. They see a name that mirrors it instead, and\n\t\t// the container moves to `tagExpression`, where rules still lint the code\n\t\t// and scope analysis reads the opening tag's (see `TSRXReferencer`).\n\t\tif (\n\t\t\t(node.type === 'JSXOpeningElement' || node.type === 'JSXClosingElement') &&\n\t\t\tnode.name?.type === 'JSXExpressionContainer'\n\t\t) {\n\t\t\tnode.tagExpression = node.name;\n\t\t\tnode.name = dynamic_tag_name(node.name);\n\t\t}\n\n\t\t// typescript-eslint names the parameters of a function type or signature\n\t\t// `params`, and rules such as `max-params` read that name. It is not\n\t\t// enumerable, so traversal still visits each parameter once.\n\t\tif (SIGNATURE_TYPES.has(node.type) && node.parameters) {\n\t\t\tObject.defineProperty(node, 'params', { value: node.parameters, configurable: true });\n\t\t}\n\n\t\t// Like espree, a template element spans its delimiters: `` `a${ ``, `` }b` ``.\n\t\tif (node.type === 'TemplateElement') {\n\t\t\tconst end_offset = node.tail ? 1 : 2;\n\t\t\tnode.start -= 1;\n\t\t\tnode.end += end_offset;\n\t\t\tnode.range = [node.start, node.end];\n\t\t\tnode.loc = {\n\t\t\t\tstart: { line: node.loc.start.line, column: node.loc.start.column - 1 },\n\t\t\t\tend: { line: node.loc.end.line, column: node.loc.end.column + end_offset },\n\t\t\t};\n\t\t}\n\n\t\tif (node.type === 'JSXText' && node.end > node.start) {\n\t\t\ttexts.push({ type: 'JSXText', start: node.start, end: node.end });\n\t\t}\n\n\t\tfor (const key of Object.keys(node)) {\n\t\t\tif (key === 'parent' || key === 'loc' || key === 'range') continue;\n\t\t\tconst value = node[key];\n\t\t\tif (Array.isArray(value)) {\n\t\t\t\tfor (const child of value) visit(child);\n\t\t\t} else if (value && typeof value === 'object') {\n\t\t\t\tvisit(value);\n\t\t\t}\n\t\t}\n\t};\n\n\tvisit(ast);\n\treturn texts.sort((a, b) => a.start - b.start);\n}\n\n/**\n * Recursively walks the AST and ensures all nodes have range and loc properties\n * ESLint's scope analyzer requires these properties on ALL nodes\n */\nfunction ensure_node_properties(node: any, locate: Locate): void {\n\tif (!node || typeof node !== 'object') {\n\t\treturn;\n\t}\n\n\t// Ensure range property exists\n\tif (node.start !== undefined && node.end !== undefined && !node.range) {\n\t\tnode.range = [node.start, node.end];\n\t}\n\n\t// Ensure loc property exists\n\tif (!node.loc && node.start !== undefined && node.end !== undefined) {\n\t\tnode.loc = locate(node.start, node.end);\n\t}\n\n\tfor (const key in node) {\n\t\tif (key === 'parent' || key === 'loc' || key === 'range') {\n\t\t\tcontinue; // Skip these to avoid infinite loops\n\t\t}\n\n\t\tconst value = node[key];\n\t\tif (Array.isArray(value)) {\n\t\t\tvalue.forEach((child) => ensure_node_properties(child, locate));\n\t\t} else if (value && typeof value === 'object' && value.type) {\n\t\t\tensure_node_properties(value, locate);\n\t\t}\n\t}\n}\n\n/** The fields read from an acorn token recorded by the TSRX parser. */\ninterface LexerToken {\n\ttype: { label: string; keyword?: string };\n\tvalue?: any;\n\tstart: number;\n\tend: number;\n}\n\n/** A comment as the TSRX parser collects it. */\ninterface ParserComment {\n\ttype: 'Line' | 'Block';\n\tstart: number;\n\tend: number;\n}\n\ninterface ESLintToken extends AST.Token {\n\tstart: number;\n\tend: number;\n\tregex?: { pattern: string; flags: string };\n}\n\ninterface ESLintComment {\n\ttype: 'Line' | 'Block';\n\tvalue: string;\n\tstart: number;\n\tend: number;\n\trange: AST.Range;\n\tloc: AST.SourceLocation;\n}\n\ninterface Span {\n\ttype: AST.TokenType;\n\tstart: number;\n\tend: number;\n\tregex?: ESLintToken['regex'];\n}\n\ntype Locate = (start: number, end: number) => AST.SourceLocation;\n\n/**\n * Builds `loc` objects from offsets, with the line terminators acorn and ESLint\n * count.\n */\nfunction create_locator(code: string): Locate {\n\tconst line_starts = [0];\n\tfor (const match of code.matchAll(/\\r\\n?|[\\n\\u2028\\u2029]/g)) {\n\t\tline_starts.push(match.index + match[0].length);\n\t}\n\tconst position = (offset: number) => {\n\t\tlet low = 0;\n\t\tlet high = line_starts.length - 1;\n\t\twhile (low < high) {\n\t\t\tconst middle = (low + high + 1) >> 1;\n\t\t\tif (line_starts[middle] <= offset) low = middle;\n\t\t\telse high = middle - 1;\n\t\t}\n\t\treturn { line: low + 1, column: offset - line_starts[low] };\n\t};\n\treturn (start, end) => ({ start: position(start), end: position(end) });\n}\n\n/**\n * Converts the parser's comments to ESLint comments, in source order. The value\n * is read from the source: the parser strips the indentation from the value of\n * a multi-line block comment.\n */\nfunction to_eslint_comments(\n\tcode: string,\n\tcomments: ParserComment[],\n\tlocate: Locate,\n): ESLintComment[] {\n\tconst result: ESLintComment[] = [];\n\tfor (const { type, start, end } of [...comments].sort((a, b) => a.start - b.start)) {\n\t\tif (result.at(-1)?.start === start) continue;\n\t\tconst value_end = type === 'Block' && code.startsWith('*/', end - 2) ? end - 2 : end;\n\t\tresult.push({\n\t\t\ttype,\n\t\t\tvalue: code.slice(start + 2, value_end),\n\t\t\tstart,\n\t\t\tend,\n\t\t\trange: [start, end],\n\t\t\tloc: locate(start, end),\n\t\t});\n\t}\n\treturn result;\n}\n\n/**\n * Converts the tokens the TSRX lexer reported into the token list ESLint\n * expects: in source order, without overlaps, in espree's token types, and\n * covering every character that is not whitespace or a comment.\n */\nfunction to_eslint_tokens(\n\tcode: string,\n\tlexer_tokens: LexerToken[],\n\ttexts: Span[],\n\tcomments: ESLintComment[],\n\tlocate: Locate,\n): ESLintToken[] {\n\t// The lexer reports a token again when it re-reads it after looking ahead.\n\tconst lexed: LexerToken[] = [];\n\tfor (const token of [...lexer_tokens].sort((a, b) => a.start - b.start || a.end - b.end)) {\n\t\tconst last = lexed.at(-1);\n\t\tif (last?.start === token.start && last.end === token.end) {\n\t\t\tlexed[lexed.length - 1] = token;\n\t\t} else if (!last || token.start >= last.end) {\n\t\t\tlexed.push(token);\n\t\t}\n\t}\n\n\tconst spans: Span[] = [];\n\tfor (let i = 0; i < lexed.length; i++) {\n\t\tconst token = lexed[i];\n\t\tconst label = token.type.label;\n\n\t\tif (label === '`' || (label === '}' && is_template_part(lexed[i + 1]))) {\n\t\t\t// Like espree, one token per template chunk: `` `a${ ``, `` }b${ ``, `` }c` ``.\n\t\t\tlet last = i + 1;\n\t\t\twhile (is_template_part(lexed[last])) last++;\n\t\t\tconst closer = lexed[last]?.type.label;\n\t\t\tif (closer !== '${' && closer !== '`') last--;\n\t\t\tspans.push({ type: 'Template', start: token.start, end: lexed[last].end });\n\t\t\ti = last;\n\t\t\tcontinue;\n\t\t}\n\n\t\tif (code.startsWith('</', token.start) && token.end > token.start + 1) {\n\t\t\t// The lexer skips the body of a raw `<style>` or `<script>` element and\n\t\t\t// reports its closing tag as one token.\n\t\t\tfor (const match of code.slice(token.start, token.end).matchAll(/([</>])|[^\\s</>]+/g)) {\n\t\t\t\tconst start = token.start + match.index;\n\t\t\t\tspans.push({\n\t\t\t\t\ttype: match[1] ? 'Punctuator' : 'JSXIdentifier',\n\t\t\t\t\tstart,\n\t\t\t\t\tend: start + match[0].length,\n\t\t\t\t});\n\t\t\t}\n\t\t\tcontinue;\n\t\t}\n\n\t\tif (label === 'eof' || token.start === token.end) continue;\n\t\tspans.push({\n\t\t\ttype: token_type(token, lexed[i - 1], lexed[i - 2]),\n\t\t\tstart: token.start,\n\t\t\tend: token.end,\n\t\t\tregex:\n\t\t\t\tlabel === 'regexp' ? { pattern: token.value.pattern, flags: token.value.flags } : undefined,\n\t\t});\n\t}\n\n\t// Each JSX text node is one token. The lexer reports no token for\n\t// whitespace-only text, and reads text after a template directive's block\n\t// as code (`Identifier \" hello\"`).\n\tconst with_texts = [...outside(spans, texts), ...texts].sort((a, b) => a.start - b.start);\n\t// Text the lexer read as part of a comment is left to the gap filling below.\n\tconst kept = outside(with_texts, comments);\n\n\tconst tokens: ESLintToken[] = [];\n\tconst add = (span: Span) => {\n\t\tconst token: ESLintToken = {\n\t\t\ttype: span.type,\n\t\t\tvalue: code.slice(span.start, span.end),\n\t\t\tstart: span.start,\n\t\t\tend: span.end,\n\t\t\trange: [span.start, span.end],\n\t\t\tloc: locate(span.start, span.end),\n\t\t};\n\t\tif (span.regex) token.regex = span.regex;\n\t\ttokens.push(token);\n\t};\n\n\t// The lexer reports no token for the `@` of a template directive or the\n\t// body of a raw `<style>` or `<script>` element.\n\tconst fill = (start: number, end: number) => {\n\t\tconst at = end > start && code[end - 1] === '@';\n\t\tif (at) end--;\n\t\tif (/\\S/.test(code.slice(start, end))) add({ type: 'JSXText', start, end });\n\t\tif (at) add({ type: 'Punctuator', start: end, end: end + 1 });\n\t};\n\n\tconst covered: Array<Span | ESLintComment> = [...kept, ...comments];\n\tlet position = 0;\n\tfor (const item of covered.sort((a, b) => a.start - b.start)) {\n\t\tfill(position, item.start);\n\t\tif (!('value' in item)) add(item);\n\t\tposition = item.end;\n\t}\n\tfill(position, code.length);\n\n\treturn tokens;\n}\n\n/** The spans that overlap none of the sorted, disjoint `ranges`. */\nfunction outside(spans: Span[], ranges: Array<{ start: number; end: number }>): Span[] {\n\tlet index = 0;\n\treturn spans.filter((span) => {\n\t\twhile (index < ranges.length && ranges[index].end <= span.start) index++;\n\t\treturn index === ranges.length || ranges[index].start >= span.end;\n\t});\n}\n\nfunction is_template_part(token: LexerToken | undefined): boolean {\n\treturn token?.type.label === 'template' || token?.type.label === 'invalidTemplate';\n}\n\n/** The espree token type of an acorn token. */\nfunction token_type(\n\ttoken: LexerToken,\n\tprevious: LexerToken | undefined,\n\tbefore_previous: LexerToken | undefined,\n): AST.TokenType {\n\tconst { label, keyword } = token.type;\n\tswitch (label) {\n\t\tcase 'name':\n\t\t\treturn token.value === 'static' || token.value === 'yield' || token.value === 'let'\n\t\t\t\t? 'Keyword'\n\t\t\t\t: 'Identifier';\n\t\tcase 'privateId':\n\t\t\treturn 'PrivateIdentifier';\n\t\tcase 'jsxName':\n\t\t\treturn 'JSXIdentifier';\n\t\tcase 'jsxText':\n\t\t\treturn 'JSXText';\n\t\tcase 'num':\n\t\t\treturn 'Numeric';\n\t\tcase 'regexp':\n\t\t\treturn 'RegularExpression';\n\t\tcase 'string':\n\t\t\t// A JSX attribute value, as in espree.\n\t\t\treturn previous?.type.label === '=' && before_previous?.type.label === 'jsxName'\n\t\t\t\t? 'JSXText'\n\t\t\t\t: 'String';\n\t}\n\tif (keyword === 'true' || keyword === 'false') return 'Boolean';\n\tif (keyword === 'null') return 'Null';\n\treturn keyword ? 'Keyword' : 'Punctuator';\n}\n\n/**\n * The collected errors ESLint reports as a parse error: broken markup, and a\n * directive's clause that no directive takes (TSRX1012), which the parser\n * reads as text and an expression container, as it throws a clause written\n * without its `@` (TSRX1009).\n */\nfunction is_fatal_parser_diagnostic(error: any): boolean {\n\treturn (\n\t\terror?.code === DIAGNOSTIC_CODES.UNCLOSED_TAG ||\n\t\terror?.code === DIAGNOSTIC_CODES.MISMATCHED_CLOSING_TAG ||\n\t\terror?.code === DIAGNOSTIC_CODES.DETACHED_DIRECTIVE_CLAUSE\n\t);\n}\n\n/**\n * A parse error as ESLint reads one: `lineNumber` and a 1-based `column`. A\n * collected error's `loc` is a range, and a thrown one's is acorn's\n * `{ line, column }`, which its message ends with too, as `(line:column)`. With\n * `code`, an error with only `pos` gets its line and column from there.\n */\nfunction to_eslint_parse_error(error: any, code?: string): SyntaxError {\n\tconst index = error?.start ?? error?.pos;\n\tlet loc = error?.loc?.start ?? error?.loc;\n\tif (typeof loc?.line !== 'number' || typeof loc?.column !== 'number') {\n\t\tloc =\n\t\t\tcode !== undefined && typeof index === 'number'\n\t\t\t\t? create_locator(code)(index, index).start\n\t\t\t\t: null;\n\t}\n\tlet message = error?.message || String(error);\n\tif (loc && message.endsWith(` (${loc.line}:${loc.column})`)) {\n\t\tmessage = message.slice(0, -` (${loc.line}:${loc.column})`.length);\n\t}\n\tconst parse_error: any = new SyntaxError(message);\n\tif (loc) {\n\t\tparse_error.lineNumber = loc.line;\n\t\tparse_error.column = loc.column + 1;\n\t}\n\tif (typeof index === 'number') {\n\t\tparse_error.index = index;\n\t}\n\treturn parse_error;\n}\n\n/**\n * ESLint parser for TSRX (.tsrx) files\n *\n * This parser uses the shared TSRX parser to parse .tsrx files\n * and returns an ESTree-compatible AST for ESLint to analyze.\n */\nexport function parseForESLint(code: string, options?: Linter.ParserOptions): ParseResult {\n\ttry {\n\t\tconst errors: any[] = [];\n\t\tconst comments: any[] = [];\n\t\t// Parse the TSRX source code using the shared TSRX parser. ESLint passes\n\t\t// `<input>` for in-memory sources (e.g. RuleTester), so a real filename is\n\t\t// only missing when the parser is invoked directly.\n\t\tconst ast = parse_module(code, options?.filePath || 'ESLintParser.tsrx', {\n\t\t\tcollect: true,\n\t\t\terrors,\n\t\t\tcomments,\n\t\t\t// Also records every token, as `tsrx_tokens`.\n\t\t\tkeywordTokens: true,\n\t\t}) as any;\n\t\tif (!ast) throw new Error('Parser returned null or undefined AST');\n\t\tconst lexer_tokens = ast.tsrx_tokens;\n\t\tdelete ast.tsrx_tokens;\n\t\tdelete ast.tsrx_keyword_tokens;\n\t\tanalyze_tsrx(ast, options?.filePath || 'ESLintParser.tsrx', {\n\t\t\tcollect: true,\n\t\t\terrors,\n\t\t\tcomments,\n\t\t});\n\n\t\tconst fatal_error = errors.find(is_fatal_parser_diagnostic);\n\t\tif (fatal_error) {\n\t\t\tthrow to_eslint_parse_error(fatal_error);\n\t\t}\n\n\t\t// Normalize for ESLint traversal (avoid duplicate node visits)\n\t\tconst texts = normalize_tsrx_ast_for_eslint(ast, code);\n\n\t\t// Recursively ensure all nodes have range and loc properties\n\t\tconst locate = create_locator(code);\n\t\tensure_node_properties(ast, locate);\n\n\t\tconst eslint_comments = to_eslint_comments(code, comments, locate);\n\n\t\t// Create a properly structured AST object ensuring all required properties exist\n\t\tconst result: any = {\n\t\t\ttype: ast.type || 'Program',\n\t\t\tstart: ast.start !== undefined ? ast.start : 0,\n\t\t\tend: ast.end !== undefined ? ast.end : code.length,\n\t\t\tloc: ast.loc || {\n\t\t\t\tstart: { line: 1, column: 0 },\n\t\t\t\tend: { line: code.split('\\n').length, column: 0 },\n\t\t\t},\n\t\t\trange: ast.range || [0, code.length],\n\t\t\tbody: ast.body || [],\n\t\t\tsourceType: ast.sourceType || 'module',\n\t\t\tcomments: eslint_comments,\n\t\t\ttokens: to_eslint_tokens(code, lexer_tokens, texts, eslint_comments, locate),\n\t\t};\n\n\t\treturn {\n\t\t\tast: result,\n\t\t\tservices: {\n\t\t\t\ttsrxDiagnostics: errors,\n\t\t\t},\n\t\t\tscopeManager: analyze_scope(result, options),\n\t\t\tvisitorKeys,\n\t\t};\n\t} catch (error: any) {\n\t\tif (error instanceof SyntaxError && (error as any).lineNumber != null) {\n\t\t\tthrow error;\n\t\t}\n\t\t// A syntax error the parser throws, at its position.\n\t\tconst parse_error: any = to_eslint_parse_error(error, code);\n\t\tif (parse_error.lineNumber != null) throw parse_error;\n\t\t// Transform TSRX parse errors to ESLint-compatible format\n\t\tthrow new SyntaxError(`Failed to parse TSRX file: ${error.message || error}`);\n\t}\n}\n\n/**\n * Legacy parse function for older ESLint versions\n */\nexport function parse(code: string, options?: Linter.ParserOptions): Program {\n\tconst result = parseForESLint(code, options);\n\treturn result.ast;\n}\n\nexport default {\n\tparseForESLint,\n\tparse,\n};\n"],"mappings":";;;AAgBA,MAAM,cAAwC;CAC7C,SAAS,CAAC,MAAM;CAChB,YAAY;EAAC;EAAkB;EAAY;CAAgB;CAC3D,mBAAmB;EAAC;EAAQ;EAAiB;CAAY;CACzD,mBAAmB,CAAC,QAAQ,eAAe;CAC3C,aAAa;EAAC;EAAmB;EAAY;CAAiB;CAC9D,oBAAoB,CAAC;CACrB,oBAAoB,CAAC;CACrB,wBAAwB,CAAC,YAAY;CACrC,cAAc,CAAC,QAAQ,OAAO;CAC9B,oBAAoB,CAAC,UAAU;CAC/B,eAAe,CAAC;CAChB,qBAAqB,CAAC,UAAU,UAAU;CAC1C,mBAAmB,CAAC,aAAa,MAAM;CACvC,SAAS,CAAC;CACV,iBAAiB;EAAC;EAAkB;EAAY;CAAgB;CAChE,iBAAiB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ACjD;GACA,OAAO,IAAI,SAAS,CAAC,GAAG,KAAK,MAAM;GACnC,MAAM,IAAI,QAAQ,CAAC;GACnB,YAAY,IAAI,cAAc;GAC9B,UAAU;GACV,QAAQ,iBAAiB,MAAM,cAAc,OAAO,iBAAiB,MAAM;EAC5E;EAEA,OAAO;GACN,KAAK;GACL,UAAU,EACT,iBAAiB,OAClB;GACA,cAAc,cAAc,QAAQ,OAAO;GAC3C;EACD;CACD,SAAS,OAAY;EACpB,IAAI,iBAAiB,eAAgB,MAAc,cAAc,MAChE,MAAM;EAGP,MAAM,cAAmB,sBAAsB,OAAO,IAAI;EAC1D,IAAI,YAAY,cAAc,MAAM,MAAM;EAE1C,MAAM,IAAI,YAAY,8BAA8B,MAAM,WAAW,OAAO;CAC7E;AACD;;;;AAKA,SAAgB,MAAM,MAAc,SAAyC;CAE5E,OADe,eAAe,MAAM,OACxB,CAAC,CAAC;AACf;AAEA,IAAA,cAAe;CACd;CACA;AACD"}
1
+ {"version":3,"file":"index.js","names":["typescript_visitor_keys","parse_module"],"sources":["../../../node_modules/.pnpm/eslint-visitor-keys@5.0.1/node_modules/eslint-visitor-keys/dist/eslint-visitor-keys.cjs","../../../node_modules/.pnpm/@typescript-eslint+visitor-keys@8.56.1_typescript@5.9.3/node_modules/@typescript-eslint/visitor-keys/dist/get-keys.js","../../../node_modules/.pnpm/@typescript-eslint+visitor-keys@8.56.1_typescript@5.9.3/node_modules/@typescript-eslint/visitor-keys/dist/visitor-keys.js","../../../node_modules/.pnpm/@typescript-eslint+visitor-keys@8.56.1_typescript@5.9.3/node_modules/@typescript-eslint/visitor-keys/dist/index.js","../src/index.ts"],"sourcesContent":["'use strict';\n\n/* eslint-disable jsdoc/valid-types -- doesn't allow `readonly`.\n TODO: remove eslint-disable when https://github.com/jsdoc-type-pratt-parser/jsdoc-type-pratt-parser/issues/164 is fixed\n*/\n/**\n * @typedef {{ readonly [type: string]: ReadonlyArray<string> }} VisitorKeys\n */\n/* eslint-enable jsdoc/valid-types -- doesn't allow `readonly string[]`. TODO: check why */\n\n/**\n * @type {VisitorKeys}\n */\nconst KEYS = {\n\tArrayExpression: [\"elements\"],\n\tArrayPattern: [\"elements\"],\n\tArrowFunctionExpression: [\"params\", \"body\"],\n\tAssignmentExpression: [\"left\", \"right\"],\n\tAssignmentPattern: [\"left\", \"right\"],\n\tAwaitExpression: [\"argument\"],\n\tBinaryExpression: [\"left\", \"right\"],\n\tBlockStatement: [\"body\"],\n\tBreakStatement: [\"label\"],\n\tCallExpression: [\"callee\", \"arguments\"],\n\tCatchClause: [\"param\", \"body\"],\n\tChainExpression: [\"expression\"],\n\tClassBody: [\"body\"],\n\tClassDeclaration: [\"id\", \"superClass\", \"body\"],\n\tClassExpression: [\"id\", \"superClass\", \"body\"],\n\tConditionalExpression: [\"test\", \"consequent\", \"alternate\"],\n\tContinueStatement: [\"label\"],\n\tDebuggerStatement: [],\n\tDoWhileStatement: [\"body\", \"test\"],\n\tEmptyStatement: [],\n\tExperimentalRestProperty: [\"argument\"],\n\tExperimentalSpreadProperty: [\"argument\"],\n\tExportAllDeclaration: [\"exported\", \"source\", \"attributes\"],\n\tExportDefaultDeclaration: [\"declaration\"],\n\tExportNamedDeclaration: [\n\t\t\"declaration\",\n\t\t\"specifiers\",\n\t\t\"source\",\n\t\t\"attributes\",\n\t],\n\tExportSpecifier: [\"local\", \"exported\"],\n\tExpressionStatement: [\"expression\"],\n\tForInStatement: [\"left\", \"right\", \"body\"],\n\tForOfStatement: [\"left\", \"right\", \"body\"],\n\tForStatement: [\"init\", \"test\", \"update\", \"body\"],\n\tFunctionDeclaration: [\"id\", \"params\", \"body\"],\n\tFunctionExpression: [\"id\", \"params\", \"body\"],\n\tIdentifier: [],\n\tIfStatement: [\"test\", \"consequent\", \"alternate\"],\n\tImportAttribute: [\"key\", \"value\"],\n\tImportDeclaration: [\"specifiers\", \"source\", \"attributes\"],\n\tImportDefaultSpecifier: [\"local\"],\n\tImportExpression: [\"source\", \"options\"],\n\tImportNamespaceSpecifier: [\"local\"],\n\tImportSpecifier: [\"imported\", \"local\"],\n\tJSXAttribute: [\"name\", \"value\"],\n\tJSXClosingElement: [\"name\"],\n\tJSXClosingFragment: [],\n\tJSXElement: [\"openingElement\", \"children\", \"closingElement\"],\n\tJSXEmptyExpression: [],\n\tJSXExpressionContainer: [\"expression\"],\n\tJSXFragment: [\"openingFragment\", \"children\", \"closingFragment\"],\n\tJSXIdentifier: [],\n\tJSXMemberExpression: [\"object\", \"property\"],\n\tJSXNamespacedName: [\"namespace\", \"name\"],\n\tJSXOpeningElement: [\"name\", \"attributes\"],\n\tJSXOpeningFragment: [],\n\tJSXSpreadAttribute: [\"argument\"],\n\tJSXSpreadChild: [\"expression\"],\n\tJSXText: [],\n\tLabeledStatement: [\"label\", \"body\"],\n\tLiteral: [],\n\tLogicalExpression: [\"left\", \"right\"],\n\tMemberExpression: [\"object\", \"property\"],\n\tMetaProperty: [\"meta\", \"property\"],\n\tMethodDefinition: [\"key\", \"value\"],\n\tNewExpression: [\"callee\", \"arguments\"],\n\tObjectExpression: [\"properties\"],\n\tObjectPattern: [\"properties\"],\n\tPrivateIdentifier: [],\n\tProgram: [\"body\"],\n\tProperty: [\"key\", \"value\"],\n\tPropertyDefinition: [\"key\", \"value\"],\n\tRestElement: [\"argument\"],\n\tReturnStatement: [\"argument\"],\n\tSequenceExpression: [\"expressions\"],\n\tSpreadElement: [\"argument\"],\n\tStaticBlock: [\"body\"],\n\tSuper: [],\n\tSwitchCase: [\"test\", \"consequent\"],\n\tSwitchStatement: [\"discriminant\", \"cases\"],\n\tTaggedTemplateExpression: [\"tag\", \"quasi\"],\n\tTemplateElement: [],\n\tTemplateLiteral: [\"quasis\", \"expressions\"],\n\tThisExpression: [],\n\tThrowStatement: [\"argument\"],\n\tTryStatement: [\"block\", \"handler\", \"finalizer\"],\n\tUnaryExpression: [\"argument\"],\n\tUpdateExpression: [\"argument\"],\n\tVariableDeclaration: [\"declarations\"],\n\tVariableDeclarator: [\"id\", \"init\"],\n\tWhileStatement: [\"test\", \"body\"],\n\tWithStatement: [\"object\", \"body\"],\n\tYieldExpression: [\"argument\"],\n};\n\n// Types.\nconst NODE_TYPES = Object.keys(KEYS);\n\n// Freeze the keys.\nfor (const type of NODE_TYPES) {\n\tObject.freeze(KEYS[type]);\n}\nObject.freeze(KEYS);\n\n/**\n * @author Toru Nagashima <https://github.com/mysticatea>\n * See LICENSE file in root directory for full license.\n */\n\n/**\n * @typedef {import('./visitor-keys.js').VisitorKeys} VisitorKeys\n */\n\n// List to ignore keys.\nconst KEY_BLACKLIST = new Set([\n\t\"parent\",\n\t\"leadingComments\",\n\t\"trailingComments\",\n]);\n\n/**\n * Check whether a given key should be used or not.\n * @param {string} key The key to check.\n * @returns {boolean} `true` if the key should be used.\n */\nfunction filterKey(key) {\n\treturn !KEY_BLACKLIST.has(key) && key[0] !== \"_\";\n}\n\n/* eslint-disable jsdoc/valid-types -- doesn't allow `readonly`.\n TODO: remove eslint-disable when https://github.com/jsdoc-type-pratt-parser/jsdoc-type-pratt-parser/issues/164 is fixed\n*/\n/**\n * Get visitor keys of a given node.\n * @param {Object} node The AST node to get keys.\n * @returns {readonly string[]} Visitor keys of the node.\n */\nfunction getKeys(node) {\n\treturn Object.keys(node).filter(filterKey);\n}\n/* eslint-enable jsdoc/valid-types -- doesn't allow `readonly` */\n\n/**\n * Make the union set with `KEYS` and given keys.\n * @param {VisitorKeys} additionalKeys The additional keys.\n * @returns {VisitorKeys} The union set.\n */\nfunction unionWith(additionalKeys) {\n\tconst retv =\n\t\t/** @type {{ [type: string]: ReadonlyArray<string> }} */\n\t\t(Object.assign({}, KEYS));\n\n\tfor (const type of Object.keys(additionalKeys)) {\n\t\tif (Object.hasOwn(retv, type)) {\n\t\t\tconst keys = new Set(additionalKeys[type]);\n\n\t\t\tfor (const key of retv[type]) {\n\t\t\t\tkeys.add(key);\n\t\t\t}\n\n\t\t\tretv[type] = Object.freeze(Array.from(keys));\n\t\t} else {\n\t\t\tretv[type] = Object.freeze(Array.from(additionalKeys[type]));\n\t\t}\n\t}\n\n\treturn Object.freeze(retv);\n}\n\nexports.KEYS = KEYS;\nexports.getKeys = getKeys;\nexports.unionWith = unionWith;\n","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.getKeys = void 0;\nconst eslint_visitor_keys_1 = require(\"eslint-visitor-keys\");\nexports.getKeys = eslint_visitor_keys_1.getKeys;\n","\"use strict\";\nvar __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n var desc = Object.getOwnPropertyDescriptor(m, k);\n if (!desc || (\"get\" in desc ? !m.__esModule : desc.writable || desc.configurable)) {\n desc = { enumerable: true, get: function() { return m[k]; } };\n }\n Object.defineProperty(o, k2, desc);\n}) : (function(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n o[k2] = m[k];\n}));\nvar __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {\n Object.defineProperty(o, \"default\", { enumerable: true, value: v });\n}) : function(o, v) {\n o[\"default\"] = v;\n});\nvar __importStar = (this && this.__importStar) || (function () {\n var ownKeys = function(o) {\n ownKeys = Object.getOwnPropertyNames || function (o) {\n var ar = [];\n for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;\n return ar;\n };\n return ownKeys(o);\n };\n return function (mod) {\n if (mod && mod.__esModule) return mod;\n var result = {};\n if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== \"default\") __createBinding(result, mod, k[i]);\n __setModuleDefault(result, mod);\n return result;\n };\n})();\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.visitorKeys = void 0;\nconst eslintVisitorKeys = __importStar(require(\"eslint-visitor-keys\"));\n/*\n ********************************** IMPORTANT NOTE ********************************\n * *\n * The key arrays should be sorted in the order in which you would want to visit *\n * the child keys. *\n * *\n * DO NOT SORT THEM ALPHABETICALLY! *\n * *\n * They should be sorted in the order that they appear in the source code. *\n * For example: *\n * *\n * class Foo extends Bar { prop: 1 } *\n * ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ClassDeclaration *\n * ^^^ id ^^^ superClass *\n * ^^^^^^^^^^^ body *\n * *\n * It would be incorrect to provide the visitor keys ['body', 'id', 'superClass'] *\n * because the body comes AFTER everything else in the source code. *\n * Instead the correct ordering would be ['id', 'superClass', 'body']. *\n * *\n **********************************************************************************\n */\nconst SharedVisitorKeys = (() => {\n const FunctionType = ['typeParameters', 'params', 'returnType'];\n const AnonymousFunction = [...FunctionType, 'body'];\n const AbstractPropertyDefinition = [\n 'decorators',\n 'key',\n 'typeAnnotation',\n ];\n return {\n AbstractPropertyDefinition: ['decorators', 'key', 'typeAnnotation'],\n AnonymousFunction,\n AsExpression: ['expression', 'typeAnnotation'],\n ClassDeclaration: [\n 'decorators',\n 'id',\n 'typeParameters',\n 'superClass',\n 'superTypeArguments',\n 'implements',\n 'body',\n ],\n Function: ['id', ...AnonymousFunction],\n FunctionType,\n PropertyDefinition: [...AbstractPropertyDefinition, 'value'],\n };\n})();\nconst additionalKeys = {\n AccessorProperty: SharedVisitorKeys.PropertyDefinition,\n ArrayPattern: ['decorators', 'elements', 'typeAnnotation'],\n ArrowFunctionExpression: SharedVisitorKeys.AnonymousFunction,\n AssignmentPattern: ['decorators', 'left', 'right', 'typeAnnotation'],\n CallExpression: ['callee', 'typeArguments', 'arguments'],\n ClassDeclaration: SharedVisitorKeys.ClassDeclaration,\n ClassExpression: SharedVisitorKeys.ClassDeclaration,\n Decorator: ['expression'],\n ExportAllDeclaration: ['exported', 'source', 'attributes'],\n ExportNamedDeclaration: ['declaration', 'specifiers', 'source', 'attributes'],\n FunctionDeclaration: SharedVisitorKeys.Function,\n FunctionExpression: SharedVisitorKeys.Function,\n Identifier: ['decorators', 'typeAnnotation'],\n ImportAttribute: ['key', 'value'],\n ImportDeclaration: ['specifiers', 'source', 'attributes'],\n ImportExpression: ['source', 'options'],\n JSXClosingFragment: [],\n JSXOpeningElement: ['name', 'typeArguments', 'attributes'],\n JSXOpeningFragment: [],\n JSXSpreadChild: ['expression'],\n MethodDefinition: ['decorators', 'key', 'value'],\n NewExpression: ['callee', 'typeArguments', 'arguments'],\n ObjectPattern: ['decorators', 'properties', 'typeAnnotation'],\n PropertyDefinition: SharedVisitorKeys.PropertyDefinition,\n RestElement: ['decorators', 'argument', 'typeAnnotation'],\n StaticBlock: ['body'],\n TaggedTemplateExpression: ['tag', 'typeArguments', 'quasi'],\n TSAbstractAccessorProperty: SharedVisitorKeys.AbstractPropertyDefinition,\n TSAbstractKeyword: [],\n TSAbstractMethodDefinition: ['key', 'value'],\n TSAbstractPropertyDefinition: SharedVisitorKeys.AbstractPropertyDefinition,\n TSAnyKeyword: [],\n TSArrayType: ['elementType'],\n TSAsExpression: SharedVisitorKeys.AsExpression,\n TSAsyncKeyword: [],\n TSBigIntKeyword: [],\n TSBooleanKeyword: [],\n TSCallSignatureDeclaration: SharedVisitorKeys.FunctionType,\n TSClassImplements: ['expression', 'typeArguments'],\n TSConditionalType: ['checkType', 'extendsType', 'trueType', 'falseType'],\n TSConstructorType: SharedVisitorKeys.FunctionType,\n TSConstructSignatureDeclaration: SharedVisitorKeys.FunctionType,\n TSDeclareFunction: SharedVisitorKeys.Function,\n TSDeclareKeyword: [],\n TSEmptyBodyFunctionExpression: ['id', ...SharedVisitorKeys.FunctionType],\n TSEnumBody: ['members'],\n TSEnumDeclaration: ['id', 'body'],\n TSEnumMember: ['id', 'initializer'],\n TSExportAssignment: ['expression'],\n TSExportKeyword: [],\n TSExternalModuleReference: ['expression'],\n TSFunctionType: SharedVisitorKeys.FunctionType,\n TSImportEqualsDeclaration: ['id', 'moduleReference'],\n TSImportType: ['source', 'options', 'qualifier', 'typeArguments'],\n TSIndexedAccessType: ['objectType', 'indexType'],\n TSIndexSignature: ['parameters', 'typeAnnotation'],\n TSInferType: ['typeParameter'],\n TSInstantiationExpression: ['expression', 'typeArguments'],\n TSInterfaceBody: ['body'],\n TSInterfaceDeclaration: ['id', 'typeParameters', 'extends', 'body'],\n TSInterfaceHeritage: ['expression', 'typeArguments'],\n TSIntersectionType: ['types'],\n TSIntrinsicKeyword: [],\n TSLiteralType: ['literal'],\n TSMappedType: ['key', 'constraint', 'nameType', 'typeAnnotation'],\n TSMethodSignature: ['key', 'typeParameters', 'params', 'returnType'],\n TSModuleBlock: ['body'],\n TSModuleDeclaration: ['id', 'body'],\n TSNamedTupleMember: ['label', 'elementType'],\n TSNamespaceExportDeclaration: ['id'],\n TSNeverKeyword: [],\n TSNonNullExpression: ['expression'],\n TSNullKeyword: [],\n TSNumberKeyword: [],\n TSObjectKeyword: [],\n TSOptionalType: ['typeAnnotation'],\n TSParameterProperty: ['decorators', 'parameter'],\n TSPrivateKeyword: [],\n TSPropertySignature: ['key', 'typeAnnotation'],\n TSProtectedKeyword: [],\n TSPublicKeyword: [],\n TSQualifiedName: ['left', 'right'],\n TSReadonlyKeyword: [],\n TSRestType: ['typeAnnotation'],\n TSSatisfiesExpression: SharedVisitorKeys.AsExpression,\n TSStaticKeyword: [],\n TSStringKeyword: [],\n TSSymbolKeyword: [],\n TSTemplateLiteralType: ['quasis', 'types'],\n TSThisType: [],\n TSTupleType: ['elementTypes'],\n TSTypeAliasDeclaration: ['id', 'typeParameters', 'typeAnnotation'],\n TSTypeAnnotation: ['typeAnnotation'],\n TSTypeAssertion: ['typeAnnotation', 'expression'],\n TSTypeLiteral: ['members'],\n TSTypeOperator: ['typeAnnotation'],\n TSTypeParameter: ['name', 'constraint', 'default'],\n TSTypeParameterDeclaration: ['params'],\n TSTypeParameterInstantiation: ['params'],\n TSTypePredicate: ['parameterName', 'typeAnnotation'],\n TSTypeQuery: ['exprName', 'typeArguments'],\n TSTypeReference: ['typeName', 'typeArguments'],\n TSUndefinedKeyword: [],\n TSUnionType: ['types'],\n TSUnknownKeyword: [],\n TSVoidKeyword: [],\n};\nexports.visitorKeys = eslintVisitorKeys.unionWith(additionalKeys);\n","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.visitorKeys = exports.getKeys = void 0;\nvar get_keys_1 = require(\"./get-keys\");\nObject.defineProperty(exports, \"getKeys\", { enumerable: true, get: function () { return get_keys_1.getKeys; } });\nvar visitor_keys_1 = require(\"./visitor-keys\");\nObject.defineProperty(exports, \"visitorKeys\", { enumerable: true, get: function () { return visitor_keys_1.visitorKeys; } });\n","import type { Program } from 'estree';\nimport type { AST, Linter } from 'eslint';\nimport {\n\tanalyzeTsrx as analyze_tsrx,\n\tDIAGNOSTIC_CODES,\n\tparseModule as parse_module,\n} from '@tsrx/core';\nimport { visitorKeys as typescript_visitor_keys } from '@typescript-eslint/visitor-keys';\nimport { Definition, Referencer, ScopeManager } from 'eslint-scope';\n\ninterface ParseResult {\n\tast: Program;\n\tservices?: Record<string, any>;\n\tscopeManager?: any;\n\tvisitorKeys?: Record<string, readonly string[]>;\n}\n\nconst visitorKeys: Record<string, string[]> = {\n\tProgram: ['body'],\n\tJSXElement: ['openingElement', 'children', 'closingElement'],\n\tJSXOpeningElement: ['name', 'tagExpression', 'attributes'],\n\tJSXClosingElement: ['name', 'tagExpression'],\n\tJSXFragment: ['openingFragment', 'children', 'closingFragment'],\n\tJSXOpeningFragment: [],\n\tJSXClosingFragment: [],\n\tJSXExpressionContainer: ['expression'],\n\tJSXAttribute: ['name', 'value'],\n\tJSXSpreadAttribute: ['argument'],\n\tJSXIdentifier: [],\n\tJSXMemberExpression: ['object', 'property'],\n\tJSXNamespacedName: ['namespace', 'name'],\n\tJSXText: [],\n\tJSXStyleElement: ['openingElement', 'children', 'closingElement'],\n\tJSXIfExpression: ['statement'],\n\tJSXForExpression: ['index', 'key', 'loop', 'empty'],\n\tJSXSwitchExpression: ['discriminant', 'cases'],\n\tJSXSwitchCase: ['test', 'consequent'],\n\tJSXTryExpression: ['block', 'pending', 'handler', 'finalizer'],\n\tJSXCodeBlock: ['body', 'render'],\n\tStyleSheet: [],\n\tForOfStatement: ['left', 'right', 'body'],\n\t// eslint-scope's default keys leave out `pending`, so without this, scope\n\t// analysis would skip the `pending` block of a plain `try`.\n\tTryStatement: ['block', 'pending', 'handler', 'finalizer'],\n};\n\nconst SIGNATURE_KEYS = ['typeParameters', 'parameters', 'typeAnnotation'];\nconst CLASS_KEYS = [\n\t'decorators',\n\t'id',\n\t'typeParameters',\n\t'superClass',\n\t'superTypeParameters',\n\t'implements',\n\t'body',\n];\n\n/**\n * The keys ESLint walks the tree with. For a type without keys, ESLint visits\n * the node's properties in the order the parser set them, which puts a label\n * after its statement, a switch case's test after its consequent, a call's\n * type arguments after its arguments and decorators last. Rules that follow\n * the code path, such as `no-useless-assignment`, then reported falsely even\n * in plain JavaScript. typescript-eslint's keys list each node's children in\n * source order. The TSRX parser names a few parts of TypeScript nodes as\n * Babel does (a function type's `parameters` and `typeAnnotation`, a class's\n * `superTypeParameters`), so those types list its names, and a `@catch` can\n * take a `reset` function. A function type's `params` is the same array as\n * its `parameters` and isn't listed, so each parameter is visited once. Scope\n * analysis keeps `visitorKeys` and its own fallback.\n */\nconst eslint_visitor_keys: Record<string, readonly string[]> = {\n\t...typescript_visitor_keys,\n\tCatchClause: ['param', 'resetParam', 'body'],\n\tClassDeclaration: CLASS_KEYS,\n\tClassExpression: CLASS_KEYS,\n\tMethodDefinition: ['decorators', 'key', 'typeParameters', 'value'],\n\t// The parser keeps the decorators of a static block, which TypeScript\n\t// rejects (TS1206), and of an index signature, which it accepts.\n\tStaticBlock: ['decorators', 'body'],\n\tTSIndexSignature: ['decorators', 'parameters', 'typeAnnotation'],\n\tTSCallSignatureDeclaration: SIGNATURE_KEYS,\n\tTSConstructSignatureDeclaration: SIGNATURE_KEYS,\n\tTSConstructorType: SIGNATURE_KEYS,\n\tTSFunctionType: SIGNATURE_KEYS,\n\tTSMethodSignature: ['key', ...SIGNATURE_KEYS],\n\tTSImportType: ['argument', 'options', 'qualifier', 'typeArguments'],\n\tTSMappedType: ['typeParameter', 'nameType', 'typeAnnotation'],\n\t...visitorKeys,\n\t// `<Box<Item> />`; a dynamic tag takes no type arguments.\n\tJSXOpeningElement: ['name', 'tagExpression', 'typeArguments', 'attributes'],\n};\n\n/**\n * eslint-scope's referencer, plus the `@for` parts: the loop's `index` and\n * `key` belong to the loop's scope, like its variable, and the `@empty` branch\n * runs outside it. TSRX gives every iteration its own index. A `@catch` can\n * also take a `reset` function after the error.\n */\nclass TSRXReferencer extends Referencer {\n\t#tsrx_for_by_loop = new Map<any, any>();\n\t#var_heads = new Set<any>();\n\n\tJSXOpeningElement(node: any): void {\n\t\tif (!node.tagExpression) {\n\t\t\tsuper.JSXOpeningElement(node);\n\t\t\treturn;\n\t\t}\n\t\t// A dynamic tag's expression holds its references, with or without JSX\n\t\t// enabled. The name that mirrors it holds none.\n\t\tthis.visit(node.tagExpression);\n\t\tnode.attributes.forEach(this.visit, this);\n\t}\n\n\t// A closing tag repeats the opening tag's name, so it adds no references.\n\t// With JSX enabled, eslint-scope read the `</style>` of a `<style>` element\n\t// as one.\n\tJSXClosingElement(): void {}\n\n\tJSXForExpression(node: any): void {\n\t\tthis.#tsrx_for_by_loop.set(node.loop, node);\n\t\t// TSRX runs each iteration in a callback, so the loop has a scope of its\n\t\t// own whatever its head declares. eslint-scope opens one only for a\n\t\t// `let` or `const` head.\n\t\tconst head = node.loop.type === 'ForStatement' ? node.loop.init : node.loop.left;\n\t\tif (head?.type !== 'VariableDeclaration' || head.kind === 'var') {\n\t\t\t(this as any).scopeManager.__nestForScope(node.loop);\n\t\t}\n\t\tif (head?.kind === 'var') this.#var_heads.add(head);\n\t\tthis.visit(node.loop);\n\t\tif (node.empty) this.visit(node.empty);\n\t}\n\n\tVariableDeclaration(node: any): void {\n\t\tif (!this.#var_heads.has(node)) {\n\t\t\tsuper.VariableDeclaration(node);\n\t\t\treturn;\n\t\t}\n\t\t// A `var` head declares the variable in the loop's scope, as `let` does.\n\t\tnode.declarations.forEach((declaration: any, index: number) => {\n\t\t\tthis.visitVariableDeclaration(this.currentScope(), 'Variable', node, index);\n\t\t\tif (declaration.init) this.visit(declaration.init);\n\t\t});\n\t}\n\n\tCatchClause(node: any): void {\n\t\tif (!node.resetParam) {\n\t\t\tsuper.CatchClause(node);\n\t\t\treturn;\n\t\t}\n\t\t// eslint-scope's `CatchClause`, with `reset` defined as the error is.\n\t\t(this as any).scopeManager.__nestCatchScope(node);\n\t\tfor (const param of [node.param, node.resetParam]) {\n\t\t\tthis.visitPattern(param, { processRightHandNodes: true }, (pattern: any, info: any) => {\n\t\t\t\t(this.currentScope() as any).__define(\n\t\t\t\t\tpattern,\n\t\t\t\t\tnew (Definition as any)('CatchClause', pattern, node, null, null, null),\n\t\t\t\t);\n\t\t\t\tthis.referencingDefaultValue(pattern, info.assignments, null, true);\n\t\t\t});\n\t\t}\n\t\tthis.visit(node.body);\n\t\tthis.close(node);\n\t}\n\n\tclose(node: any): void {\n\t\tconst tsrx_for = this.#tsrx_for_by_loop.get(node);\n\t\tif (tsrx_for?.index) {\n\t\t\t(this.currentScope() as any).__define(\n\t\t\t\ttsrx_for.index,\n\t\t\t\tnew (Definition as any)('Variable', tsrx_for.index, tsrx_for, tsrx_for, null, null),\n\t\t\t);\n\t\t}\n\t\tif (tsrx_for?.key) this.visit(tsrx_for.key);\n\t\tsuper.close(node);\n\t}\n}\n\n/**\n * Scope analysis as ESLint runs it, with `TSRXReferencer`. A `.tsrx` file is\n * always a module.\n */\nfunction analyze_scope(ast: any, options: Linter.ParserOptions | undefined): any {\n\tconst ecma_features = options?.ecmaFeatures ?? {};\n\tconst scope_options = {\n\t\tignoreEval: true,\n\t\tnodejsScope: ecma_features.globalReturn,\n\t\timpliedStrict: ecma_features.impliedStrict,\n\t\tecmaVersion: typeof options?.ecmaVersion === 'number' ? options.ecmaVersion : 6,\n\t\tsourceType: 'module',\n\t\tchildVisitorKeys: visitorKeys,\n\t\t// eslint-visitor-keys' `getKeys`, which ESLint passes\n\t\tfallback: (node: any) =>\n\t\t\tObject.keys(node).filter(\n\t\t\t\t(key) =>\n\t\t\t\t\tkey !== 'parent' &&\n\t\t\t\t\tkey !== 'leadingComments' &&\n\t\t\t\t\tkey !== 'trailingComments' &&\n\t\t\t\t\tkey[0] !== '_',\n\t\t\t),\n\t\tjsx: ecma_features.jsx,\n\t};\n\tconst scope_manager = new ScopeManager(scope_options as any);\n\tnew TSRXReferencer(scope_options as any, scope_manager).visit(ast);\n\treturn scope_manager;\n}\n\nconst LOOP_FIELDS: Record<string, string[]> = {\n\tForStatement: ['init', 'test', 'update', 'body'],\n\tForInStatement: ['left', 'right', 'body'],\n\tForOfStatement: ['await', 'left', 'right', 'body'],\n};\n\nconst STATEMENT_FIELDS: Record<string, { keyword: string; fields: string[] }> = {\n\tJSXIfExpression: { keyword: 'if', fields: ['test', 'consequent', 'alternate'] },\n};\n\nconst SIGNATURE_TYPES = new Set([\n\t'TSFunctionType',\n\t'TSConstructorType',\n\t'TSCallSignatureDeclaration',\n\t'TSConstructSignatureDeclaration',\n\t'TSMethodSignature',\n]);\n\n/** The name rules see for a dynamic tag that no JSX name can mirror. */\nconst DYNAMIC_TAG_NAME = 'tsrx-dynamic-tag';\n\n/**\n * The JSX name rules see for a dynamic tag: a `JSXIdentifier` or\n * `JSXMemberExpression` that mirrors its expression (`<{as}>` is `as`,\n * `<{ui.Box}>` is `ui.Box`), or a synthetic `JSXIdentifier` for any other\n * expression (`<{'div'}>`, `<{icons[key]}>`, `<{pick()}>`). The name spans the\n * braces, so a rule that fixes the text before or after it keeps them.\n */\nfunction dynamic_tag_name(container: any): any {\n\tconst name = mirror_tag_expression(container.expression) ?? {\n\t\ttype: 'JSXIdentifier',\n\t\tname: DYNAMIC_TAG_NAME,\n\t};\n\treturn { ...name, start: container.start, end: container.end };\n}\n\n/** The JSX name for an identifier or a chain of `.name` accesses, or `null`. */\nfunction mirror_tag_expression(node: any): any {\n\tif (node.type === 'Identifier') {\n\t\treturn { type: 'JSXIdentifier', name: node.name, start: node.start, end: node.end };\n\t}\n\tif (node.type !== 'MemberExpression' || node.computed || node.property.type !== 'Identifier') {\n\t\treturn null;\n\t}\n\t// `<this.Item>` is a JSX member name too.\n\tconst object =\n\t\tnode.object.type === 'ThisExpression'\n\t\t\t? { type: 'JSXIdentifier', name: 'this', start: node.object.start, end: node.object.end }\n\t\t\t: mirror_tag_expression(node.object);\n\treturn (\n\t\tobject && {\n\t\t\ttype: 'JSXMemberExpression',\n\t\t\tobject,\n\t\t\tproperty: mirror_tag_expression(node.property),\n\t\t\tstart: node.start,\n\t\t\tend: node.end,\n\t\t}\n\t);\n}\n\n/**\n * Keep this hook for small ESLint-only AST normalizations. Returns the `JSXText`\n * nodes, which each get a token of their own.\n */\nfunction normalize_tsrx_ast_for_eslint(ast: any, code: string): Span[] {\n\tconst texts: Span[] = [];\n\tconst seen = new Set<any>();\n\tconst visit = (node: any) => {\n\t\tif (!node || typeof node !== 'object') return;\n\t\tif (seen.has(node)) return;\n\t\tseen.add(node);\n\n\t\t// `<style apply={...} />` resolutions hold scope bindings whose reference\n\t\t// paths point back at AST ancestors. ESLint rules do not use them, and the\n\t\t// cycles break consumers that deep-clone or serialize the AST (RuleTester).\n\t\tif (node.type === 'JSXStyleElement' && node.metadata?.styleApplies) {\n\t\t\tdelete node.metadata.styleApplies;\n\t\t}\n\n\t\t// ESLint's code path analysis handles every `SwitchCase` as a case of a\n\t\t// `switch` statement and throws on one inside `@switch`. `@case` bodies\n\t\t// never fall through, so they need no switch code paths.\n\t\tif (node.type === 'JSXSwitchExpression') {\n\t\t\tfor (const switch_case of node.cases) switch_case.type = 'JSXSwitchCase';\n\t\t}\n\n\t\t// A comment in JSX text is a comment for ESLint, not a `{}` container:\n\t\t// drop the placeholder node the parser keeps for it.\n\t\tif (node.type === 'JSXElement' || node.type === 'JSXFragment') {\n\t\t\tnode.children = node.children.filter(\n\t\t\t\t(child: any) =>\n\t\t\t\t\tchild.type !== 'JSXExpressionContainer' ||\n\t\t\t\t\tchild.expression.type !== 'JSXEmptyExpression' ||\n\t\t\t\t\tchild.start !== child.expression.start,\n\t\t\t);\n\t\t}\n\n\t\t// The loop of a `@for` is a real for statement in `loop`, so rules such as\n\t\t// `semi` and `init-declarations` know its head. ESLint's code path analysis\n\t\t// allows a for statement no fields of its own, so `index`, `key` and the\n\t\t// `@empty` branch stay on `JSXForExpression`.\n\t\tif (node.type === 'JSXForExpression') {\n\t\t\tconst loop: any = {\n\t\t\t\ttype: node.statementType,\n\t\t\t\tstart: code.indexOf('for', node.start),\n\t\t\t\tend: node.body.end,\n\t\t\t};\n\t\t\tfor (const key of LOOP_FIELDS[node.statementType]) {\n\t\t\t\tloop[key] = node[key];\n\t\t\t\tdelete node[key];\n\t\t\t}\n\t\t\tnode.loop = loop;\n\t\t}\n\n\t\t// An `@if` likewise keeps its if statement in `statement`, so code path\n\t\t// analysis gives each arm a path of its own, as it does the branches of an\n\t\t// `if`. A `@try` keeps its blocks, in source order: as a `try` statement,\n\t\t// its body would be inside a `try`, though the React, Preact and Hono\n\t\t// output has none.\n\t\t// `react-hooks/rules-of-hooks` would then report as conditional every hook\n\t\t// after the body's first call, member access or identifier, except `use()`,\n\t\t// which 6.1.1 and 7.1.1 report anywhere in the body as inside a try/catch\n\t\t// block.\n\t\t// `@switch` keeps its cases: a `switch` would fall through from each case\n\t\t// into the next.\n\t\tif (node.type in STATEMENT_FIELDS) {\n\t\t\tconst { keyword, fields } = STATEMENT_FIELDS[node.type];\n\t\t\tconst statement: any = {\n\t\t\t\ttype: node.statementType,\n\t\t\t\tstart: code.indexOf(keyword, node.start),\n\t\t\t\tend: node.end,\n\t\t\t};\n\t\t\tfor (const key of fields) {\n\t\t\t\tstatement[key] = node[key];\n\t\t\t\tdelete node[key];\n\t\t\t}\n\t\t\tnode.statement = statement;\n\t\t}\n\n\t\t// The parser accepts a plain `try` with only a `pending` block. It compiles\n\t\t// to a `try` with neither a `catch` nor a `finally`, which isn't JavaScript,\n\t\t// and code path analysis throws on it.\n\t\tif (node.type === 'TryStatement' && !node.handler && !node.finalizer) {\n\t\t\tthrow to_eslint_parse_error({\n\t\t\t\tmessage: 'Missing catch or finally clause',\n\t\t\t\tloc: node.loc,\n\t\t\t\tstart: node.start,\n\t\t\t});\n\t\t}\n\n\t\t// Rules read a tag name as a JSX name, and crash on the expression\n\t\t// container of a dynamic tag. They see a name that mirrors it instead, and\n\t\t// the container moves to `tagExpression`, where rules still lint the code\n\t\t// and scope analysis reads the opening tag's (see `TSRXReferencer`).\n\t\tif (\n\t\t\t(node.type === 'JSXOpeningElement' || node.type === 'JSXClosingElement') &&\n\t\t\tnode.name?.type === 'JSXExpressionContainer'\n\t\t) {\n\t\t\tnode.tagExpression = node.name;\n\t\t\tnode.name = dynamic_tag_name(node.name);\n\t\t}\n\n\t\t// typescript-eslint names the parameters of a function type or signature\n\t\t// `params`, and rules such as `max-params` read that name. It is not\n\t\t// enumerable, so traversal still visits each parameter once.\n\t\tif (SIGNATURE_TYPES.has(node.type) && node.parameters) {\n\t\t\tObject.defineProperty(node, 'params', { value: node.parameters, configurable: true });\n\t\t}\n\n\t\t// Like espree, a template element spans its delimiters: `` `a${ ``, `` }b` ``.\n\t\tif (node.type === 'TemplateElement') {\n\t\t\tconst end_offset = node.tail ? 1 : 2;\n\t\t\tnode.start -= 1;\n\t\t\tnode.end += end_offset;\n\t\t\tnode.range = [node.start, node.end];\n\t\t\tnode.loc = {\n\t\t\t\tstart: { line: node.loc.start.line, column: node.loc.start.column - 1 },\n\t\t\t\tend: { line: node.loc.end.line, column: node.loc.end.column + end_offset },\n\t\t\t};\n\t\t}\n\n\t\tif (node.type === 'JSXText' && node.end > node.start) {\n\t\t\ttexts.push({ type: 'JSXText', start: node.start, end: node.end });\n\t\t}\n\n\t\tfor (const key of Object.keys(node)) {\n\t\t\tif (key === 'parent' || key === 'loc' || key === 'range') continue;\n\t\t\tconst value = node[key];\n\t\t\tif (Array.isArray(value)) {\n\t\t\t\tfor (const child of value) visit(child);\n\t\t\t} else if (value && typeof value === 'object') {\n\t\t\t\tvisit(value);\n\t\t\t}\n\t\t}\n\t};\n\n\tvisit(ast);\n\treturn texts.sort((a, b) => a.start - b.start);\n}\n\n/**\n * Recursively walks the AST and ensures all nodes have range and loc properties\n * ESLint's scope analyzer requires these properties on ALL nodes\n */\nfunction ensure_node_properties(node: any, locate: Locate): void {\n\tif (!node || typeof node !== 'object') {\n\t\treturn;\n\t}\n\n\t// Ensure range property exists\n\tif (node.start !== undefined && node.end !== undefined && !node.range) {\n\t\tnode.range = [node.start, node.end];\n\t}\n\n\t// Ensure loc property exists\n\tif (!node.loc && node.start !== undefined && node.end !== undefined) {\n\t\tnode.loc = locate(node.start, node.end);\n\t}\n\n\tfor (const key in node) {\n\t\tif (key === 'parent' || key === 'loc' || key === 'range') {\n\t\t\tcontinue; // Skip these to avoid infinite loops\n\t\t}\n\n\t\tconst value = node[key];\n\t\tif (Array.isArray(value)) {\n\t\t\tvalue.forEach((child) => ensure_node_properties(child, locate));\n\t\t} else if (value && typeof value === 'object' && value.type) {\n\t\t\tensure_node_properties(value, locate);\n\t\t}\n\t}\n}\n\n/** The fields read from an acorn token recorded by the TSRX parser. */\ninterface LexerToken {\n\ttype: { label: string; keyword?: string };\n\tvalue?: any;\n\tstart: number;\n\tend: number;\n}\n\n/** A comment as the TSRX parser collects it. */\ninterface ParserComment {\n\ttype: 'Line' | 'Block';\n\tstart: number;\n\tend: number;\n}\n\ninterface ESLintToken extends AST.Token {\n\tstart: number;\n\tend: number;\n\tregex?: { pattern: string; flags: string };\n}\n\ninterface ESLintComment {\n\ttype: 'Line' | 'Block';\n\tvalue: string;\n\tstart: number;\n\tend: number;\n\trange: AST.Range;\n\tloc: AST.SourceLocation;\n}\n\ninterface Span {\n\ttype: AST.TokenType;\n\tstart: number;\n\tend: number;\n\tregex?: ESLintToken['regex'];\n}\n\ntype Locate = (start: number, end: number) => AST.SourceLocation;\n\n/**\n * Builds `loc` objects from offsets, with the line terminators acorn and ESLint\n * count.\n */\nfunction create_locator(code: string): Locate {\n\tconst line_starts = [0];\n\tfor (const match of code.matchAll(/\\r\\n?|[\\n\\u2028\\u2029]/g)) {\n\t\tline_starts.push(match.index + match[0].length);\n\t}\n\tconst position = (offset: number) => {\n\t\tlet low = 0;\n\t\tlet high = line_starts.length - 1;\n\t\twhile (low < high) {\n\t\t\tconst middle = (low + high + 1) >> 1;\n\t\t\tif (line_starts[middle] <= offset) low = middle;\n\t\t\telse high = middle - 1;\n\t\t}\n\t\treturn { line: low + 1, column: offset - line_starts[low] };\n\t};\n\treturn (start, end) => ({ start: position(start), end: position(end) });\n}\n\n/**\n * Converts the parser's comments to ESLint comments, in source order. The value\n * is read from the source: the parser strips the indentation from the value of\n * a multi-line block comment.\n */\nfunction to_eslint_comments(\n\tcode: string,\n\tcomments: ParserComment[],\n\tlocate: Locate,\n): ESLintComment[] {\n\tconst result: ESLintComment[] = [];\n\tfor (const { type, start, end } of [...comments].sort((a, b) => a.start - b.start)) {\n\t\tif (result.at(-1)?.start === start) continue;\n\t\tconst value_end = type === 'Block' && code.startsWith('*/', end - 2) ? end - 2 : end;\n\t\tresult.push({\n\t\t\ttype,\n\t\t\tvalue: code.slice(start + 2, value_end),\n\t\t\tstart,\n\t\t\tend,\n\t\t\trange: [start, end],\n\t\t\tloc: locate(start, end),\n\t\t});\n\t}\n\treturn result;\n}\n\n/**\n * Converts the tokens the TSRX lexer reported into the token list ESLint\n * expects: in source order, without overlaps, in espree's token types, and\n * covering every character that is not whitespace or a comment.\n */\nfunction to_eslint_tokens(\n\tcode: string,\n\tlexer_tokens: LexerToken[],\n\ttexts: Span[],\n\tcomments: ESLintComment[],\n\tlocate: Locate,\n): ESLintToken[] {\n\t// The lexer reports a token again when it re-reads it after looking ahead.\n\tconst lexed: LexerToken[] = [];\n\tfor (const token of [...lexer_tokens].sort((a, b) => a.start - b.start || a.end - b.end)) {\n\t\tconst last = lexed.at(-1);\n\t\tif (last?.start === token.start && last.end === token.end) {\n\t\t\tlexed[lexed.length - 1] = token;\n\t\t} else if (!last || token.start >= last.end) {\n\t\t\tlexed.push(token);\n\t\t}\n\t}\n\n\tconst spans: Span[] = [];\n\tfor (let i = 0; i < lexed.length; i++) {\n\t\tconst token = lexed[i];\n\t\tconst label = token.type.label;\n\n\t\tif (label === '`' || (label === '}' && is_template_part(lexed[i + 1]))) {\n\t\t\t// Like espree, one token per template chunk: `` `a${ ``, `` }b${ ``, `` }c` ``.\n\t\t\tlet last = i + 1;\n\t\t\twhile (is_template_part(lexed[last])) last++;\n\t\t\tconst closer = lexed[last]?.type.label;\n\t\t\tif (closer !== '${' && closer !== '`') last--;\n\t\t\tspans.push({ type: 'Template', start: token.start, end: lexed[last].end });\n\t\t\ti = last;\n\t\t\tcontinue;\n\t\t}\n\n\t\tif (code.startsWith('</', token.start) && token.end > token.start + 1) {\n\t\t\t// The lexer skips the body of a raw `<style>` or `<script>` element and\n\t\t\t// reports its closing tag as one token.\n\t\t\tfor (const match of code.slice(token.start, token.end).matchAll(/([</>])|[^\\s</>]+/g)) {\n\t\t\t\tconst start = token.start + match.index;\n\t\t\t\tspans.push({\n\t\t\t\t\ttype: match[1] ? 'Punctuator' : 'JSXIdentifier',\n\t\t\t\t\tstart,\n\t\t\t\t\tend: start + match[0].length,\n\t\t\t\t});\n\t\t\t}\n\t\t\tcontinue;\n\t\t}\n\n\t\tif (label === 'eof' || token.start === token.end) continue;\n\t\tspans.push({\n\t\t\ttype: token_type(token, lexed[i - 1], lexed[i - 2]),\n\t\t\tstart: token.start,\n\t\t\tend: token.end,\n\t\t\tregex:\n\t\t\t\tlabel === 'regexp' ? { pattern: token.value.pattern, flags: token.value.flags } : undefined,\n\t\t});\n\t}\n\n\t// Each JSX text node is one token. The lexer reports no token for\n\t// whitespace-only text, and reads text after a template directive's block\n\t// as code (`Identifier \" hello\"`).\n\tconst with_texts = [...outside(spans, texts), ...texts].sort((a, b) => a.start - b.start);\n\t// Text the lexer read as part of a comment is left to the gap filling below.\n\tconst kept = outside(with_texts, comments);\n\n\tconst tokens: ESLintToken[] = [];\n\tconst add = (span: Span) => {\n\t\tconst token: ESLintToken = {\n\t\t\ttype: span.type,\n\t\t\tvalue: code.slice(span.start, span.end),\n\t\t\tstart: span.start,\n\t\t\tend: span.end,\n\t\t\trange: [span.start, span.end],\n\t\t\tloc: locate(span.start, span.end),\n\t\t};\n\t\tif (span.regex) token.regex = span.regex;\n\t\ttokens.push(token);\n\t};\n\n\t// The lexer reports no token for the `@` of a template directive or the\n\t// body of a raw `<style>` or `<script>` element.\n\tconst fill = (start: number, end: number) => {\n\t\tconst at = end > start && code[end - 1] === '@';\n\t\tif (at) end--;\n\t\tif (/\\S/.test(code.slice(start, end))) add({ type: 'JSXText', start, end });\n\t\tif (at) add({ type: 'Punctuator', start: end, end: end + 1 });\n\t};\n\n\tconst covered: Array<Span | ESLintComment> = [...kept, ...comments];\n\tlet position = 0;\n\tfor (const item of covered.sort((a, b) => a.start - b.start)) {\n\t\tfill(position, item.start);\n\t\tif (!('value' in item)) add(item);\n\t\tposition = item.end;\n\t}\n\tfill(position, code.length);\n\n\treturn tokens;\n}\n\n/** The spans that overlap none of the sorted, disjoint `ranges`. */\nfunction outside(spans: Span[], ranges: Array<{ start: number; end: number }>): Span[] {\n\tlet index = 0;\n\treturn spans.filter((span) => {\n\t\twhile (index < ranges.length && ranges[index].end <= span.start) index++;\n\t\treturn index === ranges.length || ranges[index].start >= span.end;\n\t});\n}\n\nfunction is_template_part(token: LexerToken | undefined): boolean {\n\treturn token?.type.label === 'template' || token?.type.label === 'invalidTemplate';\n}\n\n/** The espree token type of an acorn token. */\nfunction token_type(\n\ttoken: LexerToken,\n\tprevious: LexerToken | undefined,\n\tbefore_previous: LexerToken | undefined,\n): AST.TokenType {\n\tconst { label, keyword } = token.type;\n\tswitch (label) {\n\t\tcase 'name':\n\t\t\treturn token.value === 'static' || token.value === 'yield' || token.value === 'let'\n\t\t\t\t? 'Keyword'\n\t\t\t\t: 'Identifier';\n\t\tcase 'privateId':\n\t\t\treturn 'PrivateIdentifier';\n\t\tcase 'jsxName':\n\t\t\treturn 'JSXIdentifier';\n\t\tcase 'jsxText':\n\t\t\treturn 'JSXText';\n\t\tcase 'num':\n\t\t\treturn 'Numeric';\n\t\tcase 'regexp':\n\t\t\treturn 'RegularExpression';\n\t\tcase 'string':\n\t\t\t// A JSX attribute value, as in espree.\n\t\t\treturn previous?.type.label === '=' && before_previous?.type.label === 'jsxName'\n\t\t\t\t? 'JSXText'\n\t\t\t\t: 'String';\n\t}\n\tif (keyword === 'true' || keyword === 'false') return 'Boolean';\n\tif (keyword === 'null') return 'Null';\n\treturn keyword ? 'Keyword' : 'Punctuator';\n}\n\n/**\n * The collected errors ESLint reports as a parse error: broken markup, and a\n * directive's clause that no directive takes (TSRX1012), which the parser\n * reads as text and an expression container, as it throws a clause written\n * without its `@` (TSRX1009).\n */\nfunction is_fatal_parser_diagnostic(error: any): boolean {\n\treturn (\n\t\terror?.code === DIAGNOSTIC_CODES.UNCLOSED_TAG ||\n\t\terror?.code === DIAGNOSTIC_CODES.MISMATCHED_CLOSING_TAG ||\n\t\terror?.code === DIAGNOSTIC_CODES.DETACHED_DIRECTIVE_CLAUSE\n\t);\n}\n\n/**\n * A parse error as ESLint reads one: `lineNumber` and a 1-based `column`. A\n * collected error's `loc` is a range, and a thrown one's is acorn's\n * `{ line, column }`, which its message ends with too, as `(line:column)`. With\n * `code`, an error with only `pos` gets its line and column from there.\n */\nfunction to_eslint_parse_error(error: any, code?: string): SyntaxError {\n\tconst index = error?.start ?? error?.pos;\n\tlet loc = error?.loc?.start ?? error?.loc;\n\tif (typeof loc?.line !== 'number' || typeof loc?.column !== 'number') {\n\t\tloc =\n\t\t\tcode !== undefined && typeof index === 'number'\n\t\t\t\t? create_locator(code)(index, index).start\n\t\t\t\t: null;\n\t}\n\tlet message = error?.message || String(error);\n\tif (loc && message.endsWith(` (${loc.line}:${loc.column})`)) {\n\t\tmessage = message.slice(0, -` (${loc.line}:${loc.column})`.length);\n\t}\n\tconst parse_error: any = new SyntaxError(message);\n\tif (loc) {\n\t\tparse_error.lineNumber = loc.line;\n\t\tparse_error.column = loc.column + 1;\n\t}\n\tif (typeof index === 'number') {\n\t\tparse_error.index = index;\n\t}\n\treturn parse_error;\n}\n\n/**\n * ESLint parser for TSRX (.tsrx) files\n *\n * This parser uses the shared TSRX parser to parse .tsrx files\n * and returns an ESTree-compatible AST for ESLint to analyze.\n */\nexport function parseForESLint(code: string, options?: Linter.ParserOptions): ParseResult {\n\ttry {\n\t\tconst errors: any[] = [];\n\t\tconst comments: any[] = [];\n\t\t// Parse the TSRX source code using the shared TSRX parser. ESLint passes\n\t\t// `<input>` for in-memory sources (e.g. RuleTester), so a real filename is\n\t\t// only missing when the parser is invoked directly.\n\t\tconst ast = parse_module(code, options?.filePath || 'ESLintParser.tsrx', {\n\t\t\tcollect: true,\n\t\t\terrors,\n\t\t\tcomments,\n\t\t\t// Also records every token, as `tsrx_tokens`.\n\t\t\tkeywordTokens: true,\n\t\t}) as any;\n\t\tif (!ast) throw new Error('Parser returned null or undefined AST');\n\t\tconst lexer_tokens = ast.tsrx_tokens;\n\t\tdelete ast.tsrx_tokens;\n\t\tdelete ast.tsrx_keyword_tokens;\n\t\tanalyze_tsrx(ast, options?.filePath || 'ESLintParser.tsrx', {\n\t\t\tcollect: true,\n\t\t\terrors,\n\t\t\tcomments,\n\t\t});\n\n\t\tconst fatal_error = errors.find(is_fatal_parser_diagnostic);\n\t\tif (fatal_error) {\n\t\t\tthrow to_eslint_parse_error(fatal_error);\n\t\t}\n\n\t\t// Normalize for ESLint traversal (avoid duplicate node visits)\n\t\tconst texts = normalize_tsrx_ast_for_eslint(ast, code);\n\n\t\t// Recursively ensure all nodes have range and loc properties\n\t\tconst locate = create_locator(code);\n\t\tensure_node_properties(ast, locate);\n\n\t\tconst eslint_comments = to_eslint_comments(code, comments, locate);\n\n\t\t// Create a properly structured AST object ensuring all required properties exist\n\t\tconst result: any = {\n\t\t\ttype: ast.type || 'Program',\n\t\t\tstart: ast.start !== undefined ? ast.start : 0,\n\t\t\tend: ast.end !== undefined ? ast.end : code.length,\n\t\t\tloc: ast.loc || {\n\t\t\t\tstart: { line: 1, column: 0 },\n\t\t\t\tend: { line: code.split('\\n').length, column: 0 },\n\t\t\t},\n\t\t\trange: ast.range || [0, code.length],\n\t\t\tbody: ast.body || [],\n\t\t\tsourceType: ast.sourceType || 'module',\n\t\t\tcomments: eslint_comments,\n\t\t\ttokens: to_eslint_tokens(code, lexer_tokens, texts, eslint_comments, locate),\n\t\t};\n\n\t\treturn {\n\t\t\tast: result,\n\t\t\tservices: {\n\t\t\t\ttsrxDiagnostics: errors,\n\t\t\t},\n\t\t\tscopeManager: analyze_scope(result, options),\n\t\t\tvisitorKeys: eslint_visitor_keys,\n\t\t};\n\t} catch (error: any) {\n\t\tif (error instanceof SyntaxError && (error as any).lineNumber != null) {\n\t\t\tthrow error;\n\t\t}\n\t\t// A syntax error the parser throws, at its position.\n\t\tconst parse_error: any = to_eslint_parse_error(error, code);\n\t\tif (parse_error.lineNumber != null) throw parse_error;\n\t\t// Transform TSRX parse errors to ESLint-compatible format\n\t\tthrow new SyntaxError(`Failed to parse TSRX file: ${error.message || error}`);\n\t}\n}\n\n/**\n * Legacy parse function for older ESLint versions\n */\nexport function parse(code: string, options?: Linter.ParserOptions): Program {\n\tconst result = parseForESLint(code, options);\n\treturn result.ast;\n}\n\nexport default {\n\tparseForESLint,\n\tparse,\n};\n"],"x_google_ignoreList":[0,1,2,3],"mappings":";;;;;;;;;;;;;CAaA,MAAM,OAAO;EACZ,iBAAiB,CAAC,UAAU;EAC5B,cAAc,CAAC,UAAU;EACzB,yBAAyB,CAAC,UAAU,MAAM;EAC1C,sBAAsB,CAAC,QAAQ,OAAO;EACtC,mBAAmB,CAAC,QAAQ,OAAO;EACnC,iBAAiB,CAAC,UAAU;EAC5B,kBAAkB,CAAC,QAAQ,OAAO;EAClC,gBAAgB,CAAC,MAAM;EACvB,gBAAgB,CAAC,OAAO;EACxB,gBAAgB,CAAC,UAAU,WAAW;EACtC,aAAa,CA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Ac,cAAc,QAAQ,OAAO;GAC3C,aAAa;EACd;CACD,SAAS,OAAY;EACpB,IAAI,iBAAiB,eAAgB,MAAc,cAAc,MAChE,MAAM;EAGP,MAAM,cAAmB,sBAAsB,OAAO,IAAI;EAC1D,IAAI,YAAY,cAAc,MAAM,MAAM;EAE1C,MAAM,IAAI,YAAY,8BAA8B,MAAM,WAAW,OAAO;CAC7E;AACD;;;;AAKA,SAAgB,MAAM,MAAc,SAAyC;CAE5E,OADe,eAAe,MAAM,OACxB,CAAC,CAAC;AACf;AAEA,IAAA,cAAe;CACd;CACA;AACD"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tsrx/eslint-parser",
3
- "version": "0.7.5",
3
+ "version": "0.7.6",
4
4
  "description": "ESLint parser for TSRX (.tsrx files)",
5
5
  "type": "module",
6
6
  "main": "src/index.ts",
@@ -34,12 +34,13 @@
34
34
  },
35
35
  "dependencies": {
36
36
  "eslint-scope": "^9.1.2",
37
- "@tsrx/core": "0.6.5"
37
+ "@tsrx/core": "0.6.6"
38
38
  },
39
39
  "devDependencies": {
40
40
  "@types/eslint": "^9.6.1",
41
41
  "@types/estree": "^1.0.8",
42
42
  "@types/node": "^24.3.0",
43
+ "@typescript-eslint/visitor-keys": "^8.56.1",
43
44
  "eslint-9": "npm:eslint@9.39.5",
44
45
  "tsdown": "^0.23.0",
45
46
  "typescript": "^5.9.3"
package/src/index.ts CHANGED
@@ -5,13 +5,14 @@ import {
5
5
  DIAGNOSTIC_CODES,
6
6
  parseModule as parse_module,
7
7
  } from '@tsrx/core';
8
+ import { visitorKeys as typescript_visitor_keys } from '@typescript-eslint/visitor-keys';
8
9
  import { Definition, Referencer, ScopeManager } from 'eslint-scope';
9
10
 
10
11
  interface ParseResult {
11
12
  ast: Program;
12
13
  services?: Record<string, any>;
13
14
  scopeManager?: any;
14
- visitorKeys?: Record<string, string[]>;
15
+ visitorKeys?: Record<string, readonly string[]>;
15
16
  }
16
17
 
17
18
  const visitorKeys: Record<string, string[]> = {
@@ -43,6 +44,53 @@ const visitorKeys: Record<string, string[]> = {
43
44
  TryStatement: ['block', 'pending', 'handler', 'finalizer'],
44
45
  };
45
46
 
47
+ const SIGNATURE_KEYS = ['typeParameters', 'parameters', 'typeAnnotation'];
48
+ const CLASS_KEYS = [
49
+ 'decorators',
50
+ 'id',
51
+ 'typeParameters',
52
+ 'superClass',
53
+ 'superTypeParameters',
54
+ 'implements',
55
+ 'body',
56
+ ];
57
+
58
+ /**
59
+ * The keys ESLint walks the tree with. For a type without keys, ESLint visits
60
+ * the node's properties in the order the parser set them, which puts a label
61
+ * after its statement, a switch case's test after its consequent, a call's
62
+ * type arguments after its arguments and decorators last. Rules that follow
63
+ * the code path, such as `no-useless-assignment`, then reported falsely even
64
+ * in plain JavaScript. typescript-eslint's keys list each node's children in
65
+ * source order. The TSRX parser names a few parts of TypeScript nodes as
66
+ * Babel does (a function type's `parameters` and `typeAnnotation`, a class's
67
+ * `superTypeParameters`), so those types list its names, and a `@catch` can
68
+ * take a `reset` function. A function type's `params` is the same array as
69
+ * its `parameters` and isn't listed, so each parameter is visited once. Scope
70
+ * analysis keeps `visitorKeys` and its own fallback.
71
+ */
72
+ const eslint_visitor_keys: Record<string, readonly string[]> = {
73
+ ...typescript_visitor_keys,
74
+ CatchClause: ['param', 'resetParam', 'body'],
75
+ ClassDeclaration: CLASS_KEYS,
76
+ ClassExpression: CLASS_KEYS,
77
+ MethodDefinition: ['decorators', 'key', 'typeParameters', 'value'],
78
+ // The parser keeps the decorators of a static block, which TypeScript
79
+ // rejects (TS1206), and of an index signature, which it accepts.
80
+ StaticBlock: ['decorators', 'body'],
81
+ TSIndexSignature: ['decorators', 'parameters', 'typeAnnotation'],
82
+ TSCallSignatureDeclaration: SIGNATURE_KEYS,
83
+ TSConstructSignatureDeclaration: SIGNATURE_KEYS,
84
+ TSConstructorType: SIGNATURE_KEYS,
85
+ TSFunctionType: SIGNATURE_KEYS,
86
+ TSMethodSignature: ['key', ...SIGNATURE_KEYS],
87
+ TSImportType: ['argument', 'options', 'qualifier', 'typeArguments'],
88
+ TSMappedType: ['typeParameter', 'nameType', 'typeAnnotation'],
89
+ ...visitorKeys,
90
+ // `<Box<Item> />`; a dynamic tag takes no type arguments.
91
+ JSXOpeningElement: ['name', 'tagExpression', 'typeArguments', 'attributes'],
92
+ };
93
+
46
94
  /**
47
95
  * eslint-scope's referencer, plus the `@for` parts: the loop's `index` and
48
96
  * `key` belong to the loop's scope, like its variable, and the `@empty` branch
@@ -738,7 +786,7 @@ export function parseForESLint(code: string, options?: Linter.ParserOptions): Pa
738
786
  tsrxDiagnostics: errors,
739
787
  },
740
788
  scopeManager: analyze_scope(result, options),
741
- visitorKeys,
789
+ visitorKeys: eslint_visitor_keys,
742
790
  };
743
791
  } catch (error: any) {
744
792
  if (error instanceof SyntaxError && (error as any).lineNumber != null) {