Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

14.0.0 Parsing error: Invalid ecmaVersion on components with no <script> tag #87

Closed
chrisnruud opened this issue Oct 10, 2024 · 5 comments

Comments

@chrisnruud
Copy link

Vue components doesn't need script tags, eslint fails when trying to parse components with no script tag with

npx eslint src/components/FailingBecauseNoScript.vue

/Users/repositories/eslint9test/src/components/FailingBecauseNoScript.vue
  0:0  error  Parsing error: Invalid ecmaVersion

✖ 1 problem (1 error, 0 warnings)

reproduction available in https://github.com/chrisnruud/eslint9test

@chrisnruud
Copy link
Author

chrisnruud commented Oct 10, 2024

Debugging via espree seems that ecmaversion that is passed in is "2025"

debug: ecmaversion is 2025
eslint:languages:js Invalid ecmaVersion.
  eslint:languages:js Error: Invalid ecmaVersion.
    at normalizeEcmaVersion (/Users/aurora/repositories/eslint9test/node_modules/espree/dist/espree.cjs:354:15)
    at normalizeOptions (/Users/aurora/repositories/eslint9test/node_modules/espree/dist/espree.cjs:385:25)
    at new Espree (/Users/aurora/repositories/eslint9test/node_modules/espree/dist/espree.cjs:486:29)
    at Object.parse (/Users/aurora/repositories/eslint9test/node_modules/espree/dist/espree.cjs:836:12)
    at parseScript$1 (/Users/aurora/repositories/eslint9test/node_modules/vue-eslint-parser/index.js:1142:18)
    at parseAsSFC (/Users/aurora/repositories/eslint9test/node_modules/vue-eslint-parser/index.js:6435:18)
    at Object.parseForESLint (/Users/aurora/repositories/eslint9test/node_modules/vue-eslint-parser/index.js:6402:53)
    at Object.parse (/Users/aurora/repositories/eslint9test/node_modules/eslint/lib/languages/js/index.js:186:26)
    at ParserService.parseSync (/Users/aurora/repositories/eslint9test/node_modules/eslint/lib/services/parser-service.js:36:33)
    at #flatVerifyWithoutProcessors (/Users/aurora/repositories/eslint9test/node_modules/eslint/lib/linter/linter.js:1683:47) +3ms

And this again seems to be an upstream issue with eslint-plugin-vue that supplies espree 9.6.1 that doesnt support es2025 (16) but v10 does.

@chrisnruud
Copy link
Author

Seems like this issue was resolvable by re-creating package.json, which suggests that the current npm create vue@latest does some minor package mismanagment

@karachungen
Copy link

Adding "espree": "^10.2.0", to package.json helped me as well

@haoqunjiang
Copy link
Member

It is indeed a bug, though very subtle.
Fixed in 14.0.1.

Thanks for reporting!

@Djuvl
Copy link

Djuvl commented Dec 14, 2024

same issue in 14.1.3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants