getEcmaVersionIfUseEspree
should respect user-installed espree, too
#238
Labels
getEcmaVersionIfUseEspree
should respect user-installed espree, too
#238
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
andvue-eslint-parser
are 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
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
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
espree
10.x, the latestecmaVersion
is2025
, but the project loads theespree
9.x depended byvue-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, sovue-eslint-parser
doesn't have to normalize the version string before passing it along:eslint/js@b068cea
The
getEcmaVersionIfUseEspree
can be removed entirely.The text was updated successfully, but these errors were encountered: