ember-eslint-parser 0.14.5 → 0.14.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
@@ -31,6 +31,21 @@ It's recommended to only use _overrides_ when defining your eslint config, so us
31
31
  if we detect a typescript parser, it will also be used for all files, otherwise babel parser will be used.
32
32
  If we cannot find a typescript parser when linting gts we throw an error.
33
33
 
34
+ If you use type-aware rules, route `.js`/`.ts` through this parser too, as
35
+ `eslint-plugin-ember`'s configs do:
36
+
37
+ ```js
38
+ {
39
+ files: ['**/*.{js,ts}'],
40
+ parser: 'ember-eslint-parser',
41
+ // ...
42
+ },
43
+ ```
44
+
45
+ `@typescript-eslint/parser` hands TypeScript the source as ESLint read it, so a
46
+ `.ts` file importing from a `.gts` gets an `error` type for that import. This
47
+ parser rewrites the specifier first.
48
+
34
49
  ## HBS (Handlebars) support
35
50
 
36
51
  For `.hbs` template files, use the `ember-eslint-parser/hbs` parser. In ESLint's flat config format (ESLint 9+):
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ember-eslint-parser",
3
- "version": "0.14.5",
3
+ "version": "0.14.6",
4
4
  "description": "",
5
5
  "keywords": [],
6
6
  "repository": {
@@ -1,6 +1,6 @@
1
1
  import { createRequire } from 'node:module';
2
2
  import { registerParsedFile } from '../preprocessor/noop.js';
3
- import { patchTs, replaceExtensions, syncMtsGtsSourceFiles, typescriptParser } from './ts-patch.js';
3
+ import { replaceExtensions, syncMtsGtsSourceFiles, typescriptParser } from './ts-patch.js';
4
4
  import { buildGlimmerVisitors } from './transforms.js';
5
5
  import { toTree } from 'ember-estree';
6
6
 
@@ -48,10 +48,6 @@ export const meta = {
48
48
  };
49
49
 
50
50
  export function parseForESLint(code, options) {
51
- // Only patch TypeScript if we actually need it.
52
- if (options.programs || options.projectService || options.project) {
53
- patchTs();
54
- }
55
51
  registerParsedFile(options.filePath);
56
52
 
57
53
  const isTypescript = options.filePath.endsWith('.gts') || options.filePath.endsWith('.ts');
@@ -123,6 +123,12 @@ try {
123
123
  return jsCode;
124
124
  };
125
125
 
126
+ // typescript-eslint copies `ts.sys` by value when it builds a program or
127
+ // project service, on the first type-aware parse in the process — which may be
128
+ // a plain .ts file that never reaches this parser. Patching at module load is
129
+ // what puts the wrappers in that copy, and in the project's first file scan.
130
+ patchTs();
131
+
126
132
  /**
127
133
  *
128
134
  * @param program {ts.Program}