Before You File a Bug Report Please Confirm You Have Done The Following...
What version of ESLint are you using?
9.12.0
What version of eslint-plugin-vue and vue-eslint-parser are you using?
- vue-eslint-parser@9.28.0
- eslint-plugin-vue@9.4.3
What did you do?
Use Flat Config in ESLint 9 with the default configuration.
What did you expect to happen?
No parsing error.
What actually happened?
0:0 error Parsing error: Invalid ecmaVersion
(If the espree parser is used for an SFC)
Link to Minimal Reproducible Example
The issue report is at vuejs/eslint-config-typescript#87
And a stable reproduction can be found at https://github.com/vuejs/eslint-config-typescript/tree/8954ae82336dc53fecc656bb613af1bd42c808cb/test/fixtures/with-older-espree
Additional comments
I explained the fix at my downstream config here:
https://github.com/vuejs/eslint-config-typescript/blob/aae95d60eaae711de8eccd55ee33ffd799cd188a/src/index.ts#L84-L91
But I think there's a bug in vue-eslint-parser too:
According to https://github.com/vuejs/vue-eslint-parser/blob/b0e0ccc6d302bb40c5cb496528536bd355ee5151/src/script/index.ts#L569C10-L603
The espree in the user project takes precedence over the others.
However, in
|
if (parserOptions.ecmaVersion === "latest") { |
|
return normalizeEcmaVersion(getLatestEcmaVersion(getNewestEspree())) |
|
} |
only the newest espree version is used to determine the latest
ecmaVersion.
In the issue report above, as ESLint 9 now depends on espree 10.x, the latest ecmaVersion is 2025, but the project loads the espree 9.x depended by vue-eslint-parser, which doesn't recognize that version, thus the error.
By the way, if I understand correctly, as of espree 8.0.0, ecmaVersion: 'latest' is supported, so vue-eslint-parser doesn't have to normalize the version string before passing it along:
eslint/js@b068cea
The getEcmaVersionIfUseEspree can be removed entirely.
Before You File a Bug Report Please Confirm You Have Done The Following...
What version of ESLint are you using?
9.12.0
What version of
eslint-plugin-vueandvue-eslint-parserare you using?What did you do?
Use Flat Config in ESLint 9 with the default configuration.
What did you expect to happen?
No parsing error.
What actually happened?
0:0 error Parsing error: Invalid ecmaVersion(If the
espreeparser is used for an SFC)Link to Minimal Reproducible Example
The issue report is at vuejs/eslint-config-typescript#87
And a stable reproduction can be found at https://github.com/vuejs/eslint-config-typescript/tree/8954ae82336dc53fecc656bb613af1bd42c808cb/test/fixtures/with-older-espree
Additional comments
I explained the fix at my downstream config here:
https://github.com/vuejs/eslint-config-typescript/blob/aae95d60eaae711de8eccd55ee33ffd799cd188a/src/index.ts#L84-L91
But I think there's a bug in
vue-eslint-parsertoo:According to https://github.com/vuejs/vue-eslint-parser/blob/b0e0ccc6d302bb40c5cb496528536bd355ee5151/src/script/index.ts#L569C10-L603
The
espreein the user project takes precedence over the others.However, in
vue-eslint-parser/src/common/espree.ts
Lines 96 to 98 in b0e0ccc
only the newest espree version is used to determine the latest
ecmaVersion.In the issue report above, as ESLint 9 now depends on
espree10.x, the latestecmaVersionis2025, but the project loads theespree9.x depended byvue-eslint-parser, which doesn't recognize that version, thus the error.By the way, if I understand correctly, as of
espree8.0.0,ecmaVersion: 'latest'is supported, sovue-eslint-parserdoesn't have to normalize the version string before passing it along:eslint/js@b068cea
The
getEcmaVersionIfUseEspreecan be removed entirely.