ember-eslint-parser 0.11.0 → 0.11.1

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ember-eslint-parser",
3
- "version": "0.11.0",
3
+ "version": "0.11.1",
4
4
  "description": "",
5
5
  "keywords": [],
6
6
  "repository": {
@@ -25,6 +25,7 @@
25
25
  "content-tag": "^4.1.1",
26
26
  "ember-estree": "^0.6.2",
27
27
  "eslint-scope": "^9.1.2",
28
+ "espree": "^10.4.0",
28
29
  "html-tags": "^5.1.0",
29
30
  "mathml-tag-names": "^4.0.0",
30
31
  "svg-tags": "^1.0.0"
@@ -5,6 +5,7 @@ import { patchTs, replaceExtensions, syncMtsGtsSourceFiles, typescriptParser } f
5
5
  import { buildGlimmerVisitors } from './transforms.js';
6
6
  import { toTree } from 'ember-estree';
7
7
  import * as eslintScope from 'eslint-scope';
8
+ import * as espree from 'espree';
8
9
 
9
10
  const require = createRequire(import.meta.url);
10
11
 
@@ -185,12 +186,24 @@ export function parseForESLint(code, options) {
185
186
  return tsResult;
186
187
  }
187
188
  : (placeholderJS) => {
188
- // JS path: parse with oxc, create scope manager from placeholder AST
189
- const { parseSync } = require('oxc-parser');
190
- const oxcResult = parseSync(filePath || 'input.js', placeholderJS);
191
- const program = oxcResult.program;
192
- program.tokens = oxcResult.tokens || [];
193
- program.comments = oxcResult.comments || [];
189
+ // JS path: parse with espree so the AST already carries loc/range,
190
+ // tokens, and comments — what ESLint validates and rules consume.
191
+ //
192
+ // We'd prefer oxc-parser here (faster, already used elsewhere in
193
+ // the pipeline), but its JS API exposes only `start`/`end` byte
194
+ // offsets and an opt-in `range` array — no `loc`, no token
195
+ // stream — so its output fails ESLint's SourceCode validation
196
+ // on the Program node and breaks any rule that walks tokens.
197
+ // Switch back once oxc lands native loc support:
198
+ // https://github.com/oxc-project/oxc/issues/10307
199
+ const program = espree.parse(placeholderJS, {
200
+ ecmaVersion: 'latest',
201
+ sourceType: 'module',
202
+ loc: true,
203
+ range: true,
204
+ tokens: true,
205
+ comment: true,
206
+ });
194
207
  scopeManager = eslintScope.analyze(program, {
195
208
  ecmaVersion: 2022,
196
209
  sourceType: 'module',