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

feat: maintain latest ecma version in ESLint #17958

Merged
merged 1 commit into from Jan 9, 2024
Merged

feat: maintain latest ecma version in ESLint #17958

merged 1 commit into from Jan 9, 2024

Conversation

mdjermanovic
Copy link
Member

Prerequisites checklist

What is the purpose of this pull request? (put an "X" next to an item)

[ ] Documentation update
[ ] Bug fix (template)
[ ] New rule (template)
[ ] Changes an existing rule (template)
[ ] Add autofix to a rule
[ ] Add a CLI option
[x] Add something to the core
[ ] Other, please explain:

Fixes #15366

What changes did you make? (Give an overview)

I added configuration for the latest ECMAScript version to ESLint and updated Linter to use it instead of espree.latestEcmaVersion when resolving "latest" value of languageOptions.ecmaVersion.

Is there anything you'd like reviewers to focus on?

I didn't change the eslintrc logic:

eslint/lib/linter/linter.js

Lines 553 to 559 in 9507525

function normalizeEcmaVersion(parser, ecmaVersion) {
if (isEspree(parser)) {
if (ecmaVersion === "latest") {
return espree.latestEcmaVersion;
}
}

because, in eslintrc configs, ecmaVersion is in parserOptions:

// .eslintrc.js
module.exports = {
    parserOptions: {
        ecmaVersion: "latest"
    }
}

thus, in this case, I think it makes more sense to keep getting the version from the parser.

@mdjermanovic mdjermanovic added core Relates to ESLint's core APIs and features accepted There is consensus among the team that this change meets the criteria for inclusion feature This change adds a new feature to ESLint labels Jan 5, 2024
@mdjermanovic mdjermanovic requested a review from a team as a code owner January 5, 2024 19:59
Copy link

netlify bot commented Jan 5, 2024

Deploy Preview for docs-eslint canceled.

Name Link
🔨 Latest commit 0e2f4c5
🔍 Latest deploy log https://app.netlify.com/sites/docs-eslint/deploys/65985f93f5c3970007d95632

Copy link
Contributor

@snitin315 snitin315 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

I'll leave it open for others to review.

Copy link
Member

@nzakas nzakas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Thanks.

@nzakas nzakas merged commit a630edd into main Jan 9, 2024
17 checks passed
@nzakas nzakas deleted the issue15366 branch January 9, 2024 19:13
bmish added a commit to bmish/eslint that referenced this pull request Jan 16, 2024
* main:
  chore: Split Docs CI from core CI (eslint#17897)
  fix: Ensure config keys are printed for config errors (eslint#17980)
  chore: delete relative-module-resolver.js (eslint#17981)
  docs: migration guide entry for `no-inner-declarations` (eslint#17977)
  docs: Update README
  feat: maintain latest ecma version in ESLint (eslint#17958)
  feat!: no-inner-declaration new default behaviour and option (eslint#17885)
  feat: add `no-useless-assignment` rule (eslint#17625)
  fix: `no-misleading-character-class` edge cases with granular errors (eslint#17970)
  feat: `no-misleading-character-class` granular errors (eslint#17515)
  docs: fix number of code-path events on custom rules page (eslint#17969)
  docs: reorder entries in v9 migration guide (eslint#17967)
  fix!: handle `--output-file` for empty output when saving to disk (eslint#17957)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
accepted There is consensus among the team that this change meets the criteria for inclusion core Relates to ESLint's core APIs and features feature This change adds a new feature to ESLint
Projects
Status: Complete
Development

Successfully merging this pull request may close these issues.

[flat config] ecmaVersion: "latest"
3 participants