-
-
Notifications
You must be signed in to change notification settings - Fork 4.4k
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
docs: Migrating eslint-env
configuration comments
#17390
Conversation
✅ Deploy Preview for docs-eslint ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
@@ -255,6 +255,63 @@ export default [ | |||
]; | |||
``` | |||
|
|||
In the eslintrc config system it was possible to use `eslint-env` configuration comments to define globals for a file. | |||
These comments are no longer recognized when linting with flat config: in a future version of ESLint, `eslint-env` comments will be reported as errors. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure about this part. This issue suggests that eslint-env
config comments will start to throw errors (in Phase 5: Remove eslintrc
), but I guess the actual intent was to have these comments reported as problems by the linter? The RFC only mentions that eslint-env
comments should be ignored (this is the current behavior).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, the intent was that these would be reported as linter warnings. We aren't doing that yet, but that's where we are going.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, the intent was that these would be reported as linter warnings.
Thanks! I've updated the wording in issue #13481 to clarify.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll also try adding this next as I'm sure this will be helpful for people as they transition to the new config system.
@@ -255,6 +255,63 @@ export default [ | |||
]; | |||
``` | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should there be a new heading here like ### `eslint-env` Configuration Comments
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I'd add a new heading.
@@ -255,6 +255,63 @@ export default [ | |||
]; | |||
``` | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I'd add a new heading.
@@ -255,6 +255,63 @@ export default [ | |||
]; | |||
``` | |||
|
|||
In the eslintrc config system it was possible to use `eslint-env` configuration comments to define globals for a file. | |||
These comments are no longer recognized when linting with flat config: in a future version of ESLint, `eslint-env` comments will be reported as errors. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, the intent was that these would be reported as linter warnings. We aren't doing that yet, but that's where we are going.
Co-authored-by: Nicholas C. Zakas <nicholas@humanwhocodes.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Would like another review to verify being merging.
@@ -255,6 +255,63 @@ export default [ | |||
]; | |||
``` | |||
|
|||
In the eslintrc config system it was possible to use `eslint-env` configuration comments to define globals for a file. | |||
These comments are no longer recognized when linting with flat config: in a future version of ESLint, `eslint-env` comments will be reported as errors. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll also try adding this next as I'm sure this will be helpful for people as they transition to the new config system.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks!
* main: (101 commits) docs: Migrating `eslint-env` configuration comments (eslint#17390) Merge pull request from GHSA-qwh7-v8hg-w8rh feat: adds option for allowing empty object patterns as parameter (eslint#17365) fix: FlatESLint#getRulesMetaForResults shouldn't throw on unknown rules (eslint#17393) docs: fix Ignoring Files section in config migration guide (eslint#17392) docs: Update README feat: Improve config error messages (eslint#17385) fix: Update no-loop-func to not overlap with no-undef (eslint#17358) docs: Update README docs: Update README 8.45.0 Build: changelog update for 8.45.0 chore: package.json update for @eslint/js release docs: add playground links to correct and incorrect code blocks (eslint#17306) docs: Expand rule option schema docs (eslint#17198) docs: Config Migration Guide (eslint#17230) docs: Update README fix: Fix suggestion message in `no-useless-escape` (eslint#17339) docs: Update README chore: update eslint-config-eslint exports (eslint#17336) ...
Prerequisites checklist
What is the purpose of this pull request? (put an "X" next to an item)
[X] Documentation update
[ ] Bug fix (template)
[ ] New rule (template)
[ ] Changes an existing rule (template)
[ ] Add autofix to a rule
[ ] Add a CLI option
[ ] Add something to the core
[ ] Other, please explain:
What changes did you make? (Give an overview)
This PR extends the migration guide with information on how to replace
eslint-env
configuration comments in files when switching from eslintrc to flat config.Is there anything you'd like reviewers to focus on?
Please, check my comments in the PR. I haven't found anything specific about how to deal with
eslint-env
comments in the discussions I reviewed, so I'm sorry if I went a little rogue. I'd be thankful for any suggestions on how to improve/correct my changes.