Skip to content

Commit

Permalink
fix: explicitly set ecmaVersion to 2024 for vue-eslint-parser
Browse files Browse the repository at this point in the history
Fixes #87
  • Loading branch information
haoqunjiang committed Oct 10, 2024
1 parent 70815e1 commit aae95d6
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,14 @@ export default function createConfig({
// Leave the template parser unspecified,
// so that it could be determined by `<script lang="...">`
},
// The internal espree version used by vue-eslint-parser is 9.x, which supports ES2024 at most.
// While the parser may try to load the latest version of espree, it's not guaranteed to work.
// For example, if npm accidentally hoists the older version to the top of the node_modules,
// or if the user installs the older version of espree at the project root,
// the older versions would be used.
// But ESLint 9 allows setting the ecmaVersion to 2025, which may cause a crash.
// So we set the ecmaVersion to 2024 here to avoid the potential issue.
ecmaVersion: 2024,
ecmaFeatures: {
jsx: mayHaveJsxInSfc,
},
Expand Down

0 comments on commit aae95d6

Please sign in to comment.