Skip to content

Conversation

@nzakas
Copy link
Member

@nzakas nzakas commented Nov 5, 2024

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:

What changes did you make? (Give an overview)

  • Added support for Language#normalizeLanguageOptions()
  • Moved normalization logic from linter.js into js/index.js
  • Updated the docs about language plugins

fixes #19037

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

I left duplicates of isEspree() and normalizeEcmaVersionForLanguageOptions() in linter.js and js/index.js. The ones in linter.js can be removed when we drop eslintrc support. Another approach would be to export those methods from js/index.js into linter.js directly if we want to remove the duplication. I'm unsure of the best approach (these functions aren't likely to change).

I also wasn't sure if we needed separate tests for this change.

@nzakas nzakas requested a review from a team as a code owner November 5, 2024 22:15
@eslint-github-bot eslint-github-bot bot added the feature This change adds a new feature to ESLint label Nov 5, 2024
@github-actions github-actions bot added the core Relates to ESLint's core APIs and features label Nov 5, 2024
@netlify
Copy link

netlify bot commented Nov 5, 2024

Deploy Preview for docs-eslint canceled.

Name Link
🔨 Latest commit 2e1c096
🔍 Latest deploy log https://app.netlify.com/sites/docs-eslint/deploys/673774e00dd22e0008d307c8

@mdjermanovic mdjermanovic added the accepted There is consensus among the team that this change meets the criteria for inclusion label Nov 6, 2024
}

const settings = config.settings || {};
const languageOptions = language.normalizeLanguageOptions?.(originalLanguageOptions) ?? originalLanguageOptions;
Copy link
Member

Choose a reason for hiding this comment

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

Thoughts about calling language.normalizeLanguageOptions() in the Config constructor instead of here? That way, language options would be normalized only once per config, not for each file.

Copy link
Member Author

Choose a reason for hiding this comment

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

Ah good point! I'll make that change.

@nzakas
Copy link
Member Author

nzakas commented Nov 13, 2024

This is ready for re-review.

@mdjermanovic
Copy link
Member

@nzakas there's still only 1 commit, maybe the latest changes haven't been pushed?

@mdjermanovic
Copy link
Member

@nzakas
Copy link
Member Author

nzakas commented Nov 14, 2024

I'll take a look tomorrow morning.

Copy link
Member

@mdjermanovic mdjermanovic 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! Leaving open until the release in case anyone else would like to take a look.

@mdjermanovic mdjermanovic merged commit 01557ce into main Nov 15, 2024
23 checks passed
@mdjermanovic mdjermanovic deleted the issue19037 branch November 15, 2024 17:10
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.

Change Request: Provide an API to normalize language options

5 participants