Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

getEcmaVersionIfUseEspree should respect user-installed espree, too #238

Open
Labels
@haoqunjiang

Description

@haoqunjiang

Before You File a Bug Report Please Confirm You Have Done The Following...

  • I'm usingeslint-plugin-vue.
  • I'm sure the problem is a parser problem. (If you are not sure, search for the issue ineslint-plugin-vue repo and open the issue ineslint-plugin-vue repo if there is no solution.
  • I have tried restarting my IDE and the issue persists.
  • I have updated to the latest version of the packages.

What version of ESLint are you using?

9.12.0

What version ofeslint-plugin-vue andvue-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 theespree parser is used for an SFC)

Link to Minimal Reproducible Example

The issue report is atvuejs/eslint-config-typescript#87
And a stable reproduction can be found athttps://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 invue-eslint-parser too:

According tohttps://github.com/vuejs/vue-eslint-parser/blob/b0e0ccc6d302bb40c5cb496528536bd355ee5151/src/script/index.ts#L569C10-L603
Theespree in the user project takes precedence over the others.
However, in

if(parserOptions.ecmaVersion==="latest"){
returnnormalizeEcmaVersion(getLatestEcmaVersion(getNewestEspree()))
}

only the newest espree version is used to determine the latestecmaVersion.

In the issue report above, as ESLint 9 now depends onespree 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 ofespree 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
ThegetEcmaVersionIfUseEspree can be removed entirely.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp