Skip to content

Commit 480ac33

Browse files
committed
Bug in astro-eslint-plugin
It seems that DEPRECATED__createDefaultProgram is needed Otherwise it only does the `---` top section with EXPERIMENTAL_useProjectService turned off, or ONLY the `<script>` version when EXPERIMENTAL_useProjectService is true, you get a syntax error on the top version The first error doesn't get reported except with --debug on, because it is reporting on a file that doesn't really exist
1 parent 7e712f3 commit 480ac33

8 files changed

+709
-1064
lines changed

eslint.config.mjs

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,21 @@ export default [
77
...eslintPluginAstro.configs['flat/all'],
88
{
99
rules: {
10-
// If this is turned on, it fails.
11-
'@typescript-eslint/await-thenable': "off",
12-
// '@typescript-eslint/await-thenable': "error",
10+
'@typescript-eslint/await-thenable': "error",
1311
// Error: Error while loading rule '@typescript-eslint/await-thenable': You have used a rule which requires parserServices to be generated. You must therefore provide a value for the "parserOptions.project" property for @typescript-eslint/parser.
1412
"@typescript-eslint/no-explicit-any": "error",
1513
},
1614
},
15+
{
16+
languageOptions: {
17+
parserOptions: {
18+
project: ["./tsconfig.json"],
19+
// When typescript/eslint v8 comes out this will become projectService
20+
// https://github.com/typescript-eslint/typescript-eslint/issues/9141
21+
// EXPERIMENTAL_useProjectService: true,
22+
DEPRECATED__createDefaultProgram: true,
23+
tsconfigRootDir: import.meta.dirname,
24+
},
25+
},
26+
}
1727
];

package-lock.json

Lines changed: 272 additions & 1052 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,13 @@
1111
},
1212
"dependencies": {
1313
"@astrojs/check": "^0.7.0",
14-
"astro": "^4.10.0",
15-
"typescript": "^5.4.5"
14+
"astro": "^4.11.3",
15+
"typescript": "^5.5.2"
1616
},
1717
"devDependencies": {
18-
"@typescript-eslint/parser": "^7.12.0",
18+
"@typescript-eslint/parser": "^7.14.1",
1919
"eslint": "^8.57.0",
20-
"eslint-plugin-astro": "^1.2.0",
21-
"typescript-eslint": "^7.12.0"
20+
"eslint-plugin-astro": "^1.2.2",
21+
"typescript-eslint": "^7.14.1"
2222
}
2323
}

results-with-deprecated.md

Lines changed: 125 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,125 @@
1+
Running `npx eslint . --debug`
2+
3+
```js
4+
[
5+
// ...
6+
{
7+
languageOptions: {
8+
parserOptions: {
9+
project: ["./tsconfig.json"],
10+
DEPRECATED__createDefaultProgram: true,
11+
tsconfigRootDir: import.meta.dirname,
12+
},
13+
},
14+
}
15+
];
16+
```
17+
18+
19+
```bash
20+
2024-06-26T15:50:41.878Z eslint:cli CLI args: [ '.', '--debug' ]
21+
2024-06-26T15:50:41.881Z eslint:cli Using flat config? true
22+
2024-06-26T15:50:41.884Z eslint:cli Running on files
23+
2024-06-26T15:50:41.886Z eslint:flat-eslint Searching for eslint.config.js
24+
2024-06-26T15:50:41.887Z eslint:flat-eslint Loading config from /Volumes/Workspace/external/astro-eslint-plugin-report-issue/eslint.config.mjs
25+
2024-06-26T15:50:41.887Z eslint:flat-eslint Config file URL is file:///Volumes/Workspace/external/astro-eslint-plugin-report-issue/eslint.config.mjs
26+
2024-06-26T15:50:42.397Z eslint:rules Loading rule 'block-spacing' (remaining=290)
27+
2024-06-26T15:50:42.403Z eslint:rules Loading rule 'brace-style' (remaining=289)
28+
2024-06-26T15:50:42.405Z eslint:rules Loading rule 'comma-dangle' (remaining=288)
29+
2024-06-26T15:50:42.409Z eslint:rules Loading rule 'consistent-return' (remaining=287)
30+
2024-06-26T15:50:42.415Z eslint:rules Loading rule 'dot-notation' (remaining=286)
31+
2024-06-26T15:50:42.420Z eslint:rules Loading rule 'indent' (remaining=285)
32+
2024-06-26T15:50:42.422Z eslint:rules Loading rule 'init-declarations' (remaining=284)
33+
2024-06-26T15:50:42.423Z eslint:rules Loading rule 'key-spacing' (remaining=283)
34+
2024-06-26T15:50:42.424Z eslint:rules Loading rule 'keyword-spacing' (remaining=282)
35+
2024-06-26T15:50:42.426Z eslint:rules Loading rule 'lines-around-comment' (remaining=281)
36+
2024-06-26T15:50:42.427Z eslint:rules Loading rule 'lines-between-class-members' (remaining=280)
37+
2024-06-26T15:50:42.428Z eslint:rules Loading rule 'max-params' (remaining=279)
38+
2024-06-26T15:50:42.441Z eslint:rules Loading rule 'no-dupe-class-members' (remaining=278)
39+
2024-06-26T15:50:42.443Z eslint:rules Loading rule 'no-empty-function' (remaining=277)
40+
2024-06-26T15:50:42.445Z eslint:rules Loading rule 'no-extra-parens' (remaining=276)
41+
2024-06-26T15:50:42.446Z eslint:rules Loading rule 'no-extra-semi' (remaining=275)
42+
2024-06-26T15:50:42.457Z eslint:rules Loading rule 'no-invalid-this' (remaining=274)
43+
2024-06-26T15:50:42.458Z eslint:rules Loading rule 'no-loop-func' (remaining=273)
44+
2024-06-26T15:50:42.458Z eslint:rules Loading rule 'no-loss-of-precision' (remaining=272)
45+
2024-06-26T15:50:42.459Z eslint:rules Loading rule 'no-magic-numbers' (remaining=271)
46+
2024-06-26T15:50:42.471Z eslint:rules Loading rule 'no-restricted-imports' (remaining=270)
47+
2024-06-26T15:50:42.499Z eslint:rules Loading rule 'no-unused-expressions' (remaining=269)
48+
2024-06-26T15:50:42.501Z eslint:rules Loading rule 'no-useless-constructor' (remaining=268)
49+
2024-06-26T15:50:42.505Z eslint:rules Loading rule 'object-curly-spacing' (remaining=267)
50+
2024-06-26T15:50:42.509Z eslint:rules Loading rule 'prefer-destructuring' (remaining=266)
51+
2024-06-26T15:50:42.537Z eslint:rules Loading rule 'quotes' (remaining=265)
52+
2024-06-26T15:50:42.543Z eslint:rules Loading rule 'semi' (remaining=264)
53+
2024-06-26T15:50:42.544Z eslint:rules Loading rule 'space-before-blocks' (remaining=263)
54+
2024-06-26T15:50:42.545Z eslint:rules Loading rule 'space-infix-ops' (remaining=262)
55+
2024-06-26T15:50:42.562Z eslint:flat-eslint Deleting cache file at /Volumes/Workspace/external/astro-eslint-plugin-report-issue/.eslintcache
56+
2024-06-26T15:50:42.585Z eslint:rules Loading rule 'no-var' (remaining=261)
57+
2024-06-26T15:50:42.585Z eslint:rules Loading rule 'prefer-const' (remaining=260)
58+
2024-06-26T15:50:42.587Z eslint:rules Loading rule 'prefer-rest-params' (remaining=259)
59+
2024-06-26T15:50:42.587Z eslint:rules Loading rule 'prefer-spread' (remaining=258)
60+
2024-06-26T15:50:42.590Z eslint:flat-eslint 4 files found in: 28ms
61+
2024-06-26T15:50:42.591Z eslint:flat-eslint Lint /Volumes/Workspace/external/astro-eslint-plugin-report-issue/astro.config.mjs
62+
2024-06-26T15:50:42.591Z eslint:linter Linting code for /Volumes/Workspace/external/astro-eslint-plugin-report-issue/astro.config.mjs (pass 1)
63+
2024-06-26T15:50:42.591Z eslint:linter Verify
64+
2024-06-26T15:50:42.591Z eslint:linter With flat config: /Volumes/Workspace/external/astro-eslint-plugin-report-issue/astro.config.mjs
65+
2024-06-26T15:50:42.592Z eslint:linter Parsing: /Volumes/Workspace/external/astro-eslint-plugin-report-issue/astro.config.mjs
66+
2024-06-26T15:50:43.739Z eslint:linter Parsing successful: /Volumes/Workspace/external/astro-eslint-plugin-report-issue/astro.config.mjs
67+
2024-06-26T15:50:43.739Z eslint:linter Scope analysis: /Volumes/Workspace/external/astro-eslint-plugin-report-issue/astro.config.mjs
68+
2024-06-26T15:50:43.739Z eslint:linter Scope analysis successful: /Volumes/Workspace/external/astro-eslint-plugin-report-issue/astro.config.mjs
69+
2024-06-26T15:50:43.752Z eslint:linter Generating fixed text for /Volumes/Workspace/external/astro-eslint-plugin-report-issue/astro.config.mjs (pass 1)
70+
2024-06-26T15:50:43.752Z eslint:source-code-fixer Applying fixes
71+
2024-06-26T15:50:43.752Z eslint:source-code-fixer shouldFix parameter was false, not attempting fixes
72+
2024-06-26T15:50:43.754Z eslint:flat-eslint Lint /Volumes/Workspace/external/astro-eslint-plugin-report-issue/eslint.config.mjs
73+
2024-06-26T15:50:43.754Z eslint:linter Linting code for /Volumes/Workspace/external/astro-eslint-plugin-report-issue/eslint.config.mjs (pass 1)
74+
2024-06-26T15:50:43.754Z eslint:linter Verify
75+
2024-06-26T15:50:43.754Z eslint:linter With flat config: /Volumes/Workspace/external/astro-eslint-plugin-report-issue/eslint.config.mjs
76+
2024-06-26T15:50:43.754Z eslint:linter Parsing: /Volumes/Workspace/external/astro-eslint-plugin-report-issue/eslint.config.mjs
77+
2024-06-26T15:50:43.758Z eslint:linter Parsing successful: /Volumes/Workspace/external/astro-eslint-plugin-report-issue/eslint.config.mjs
78+
2024-06-26T15:50:43.758Z eslint:linter Scope analysis: /Volumes/Workspace/external/astro-eslint-plugin-report-issue/eslint.config.mjs
79+
2024-06-26T15:50:43.758Z eslint:linter Scope analysis successful: /Volumes/Workspace/external/astro-eslint-plugin-report-issue/eslint.config.mjs
80+
2024-06-26T15:50:43.761Z eslint:linter Generating fixed text for /Volumes/Workspace/external/astro-eslint-plugin-report-issue/eslint.config.mjs (pass 1)
81+
2024-06-26T15:50:43.761Z eslint:source-code-fixer Applying fixes
82+
2024-06-26T15:50:43.761Z eslint:source-code-fixer shouldFix parameter was false, not attempting fixes
83+
2024-06-26T15:50:43.761Z eslint:flat-eslint Lint /Volumes/Workspace/external/astro-eslint-plugin-report-issue/src/env.d.ts
84+
2024-06-26T15:50:43.761Z eslint:linter Linting code for /Volumes/Workspace/external/astro-eslint-plugin-report-issue/src/env.d.ts (pass 1)
85+
2024-06-26T15:50:43.761Z eslint:linter Verify
86+
2024-06-26T15:50:43.761Z eslint:linter With flat config: /Volumes/Workspace/external/astro-eslint-plugin-report-issue/src/env.d.ts
87+
2024-06-26T15:50:43.761Z eslint:linter Parsing: /Volumes/Workspace/external/astro-eslint-plugin-report-issue/src/env.d.ts
88+
2024-06-26T15:50:43.763Z eslint:linter Parsing successful: /Volumes/Workspace/external/astro-eslint-plugin-report-issue/src/env.d.ts
89+
2024-06-26T15:50:43.763Z eslint:linter Scope analysis: /Volumes/Workspace/external/astro-eslint-plugin-report-issue/src/env.d.ts
90+
2024-06-26T15:50:43.763Z eslint:linter Scope analysis successful: /Volumes/Workspace/external/astro-eslint-plugin-report-issue/src/env.d.ts
91+
2024-06-26T15:50:43.764Z eslint:linter Generating fixed text for /Volumes/Workspace/external/astro-eslint-plugin-report-issue/src/env.d.ts (pass 1)
92+
2024-06-26T15:50:43.764Z eslint:source-code-fixer Applying fixes
93+
2024-06-26T15:50:43.764Z eslint:source-code-fixer shouldFix parameter was false, not attempting fixes
94+
2024-06-26T15:50:43.764Z eslint:flat-eslint Lint /Volumes/Workspace/external/astro-eslint-plugin-report-issue/src/pages/index.astro
95+
2024-06-26T15:50:43.764Z eslint:linter Linting code for /Volumes/Workspace/external/astro-eslint-plugin-report-issue/src/pages/index.astro (pass 1)
96+
2024-06-26T15:50:43.764Z eslint:linter Verify
97+
2024-06-26T15:50:43.764Z eslint:linter With flat config: /Volumes/Workspace/external/astro-eslint-plugin-report-issue/src/pages/index.astro
98+
2024-06-26T15:50:43.764Z eslint:linter Apply the processor: { preprocess: [Function: preprocess], postprocess: [Function: postprocess], supportsAutofix: true, meta: { name: 'astro/client-side-ts', version: '1.2.2' } }
99+
2024-06-26T15:50:43.884Z eslint:linter A code block was found: '(unnamed)'
100+
2024-06-26T15:50:43.884Z eslint:linter Parsing: /Volumes/Workspace/external/astro-eslint-plugin-report-issue/src/pages/index.astro
101+
2024-06-26T15:50:44.850Z eslint:linter Parsing successful: /Volumes/Workspace/external/astro-eslint-plugin-report-issue/src/pages/index.astro
102+
2024-06-26T15:50:44.850Z eslint:linter Scope analysis: /Volumes/Workspace/external/astro-eslint-plugin-report-issue/src/pages/index.astro
103+
2024-06-26T15:50:44.850Z eslint:linter Scope analysis successful: /Volumes/Workspace/external/astro-eslint-plugin-report-issue/src/pages/index.astro
104+
2024-06-26T15:50:44.855Z eslint:linter A code block was found: '1.ts'
105+
2024-06-26T15:50:44.855Z eslint:linter Resolving configuration again because the file content or extension was changed.
106+
2024-06-26T15:50:44.855Z eslint:linter With flat config: /Volumes/Workspace/external/astro-eslint-plugin-report-issue/src/pages/index.astro/1_1.ts
107+
2024-06-26T15:50:44.866Z eslint:linter Parsing: /Volumes/Workspace/external/astro-eslint-plugin-report-issue/src/pages/index.astro/1_1.ts
108+
2024-06-26T15:50:45.170Z eslint:linter Parsing successful: /Volumes/Workspace/external/astro-eslint-plugin-report-issue/src/pages/index.astro/1_1.ts
109+
2024-06-26T15:50:45.170Z eslint:linter Scope analysis: /Volumes/Workspace/external/astro-eslint-plugin-report-issue/src/pages/index.astro/1_1.ts
110+
2024-06-26T15:50:45.170Z eslint:linter Scope analysis successful: /Volumes/Workspace/external/astro-eslint-plugin-report-issue/src/pages/index.astro/1_1.ts
111+
2024-06-26T15:50:45.174Z eslint:linter Generating fixed text for /Volumes/Workspace/external/astro-eslint-plugin-report-issue/src/pages/index.astro (pass 1)
112+
2024-06-26T15:50:45.174Z eslint:source-code-fixer Applying fixes
113+
2024-06-26T15:50:45.174Z eslint:source-code-fixer shouldFix parameter was false, not attempting fixes
114+
115+
/Volumes/Workspace/external/astro-eslint-plugin-report-issue/src/pages/index.astro
116+
5:7 error 'c' is assigned a value but never used @typescript-eslint/no-unused-vars
117+
5:10 error Unexpected any. Specify a different type @typescript-eslint/no-explicit-any
118+
6:7 error 'b' is assigned a value but never used @typescript-eslint/no-unused-vars
119+
10:9 error 'c' is assigned a value but never used @typescript-eslint/no-unused-vars
120+
11:12 error Unexpected any. Specify a different type @typescript-eslint/no-explicit-any
121+
122+
✖ 5 problems (5 errors, 0 warnings)
123+
124+
125+
```

0 commit comments

Comments
 (0)