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

docs: Migrating eslint-env configuration comments #17390

Merged
merged 3 commits into from Jul 22, 2023
Merged

Conversation

fasttime
Copy link
Member

@fasttime fasttime commented Jul 19, 2023

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.

@eslint-github-bot eslint-github-bot bot added the documentation Relates to ESLint's documentation label Jul 19, 2023
@netlify
Copy link

netlify bot commented Jul 19, 2023

Deploy Preview for docs-eslint ready!

Name Link
🔨 Latest commit 3b55bb8
🔍 Latest deploy log https://app.netlify.com/sites/docs-eslint/deploys/64b95f7b81eb5f00081345f8
😎 Deploy Preview https://deploy-preview-17390--docs-eslint.netlify.app/use/configure/migration-guide
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

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.
Copy link
Member Author

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).

Copy link
Member

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.

Copy link
Member Author

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.

Copy link
Member

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 [
];
```

Copy link
Member Author

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?

Copy link
Member

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.

@fasttime fasttime marked this pull request as ready for review July 19, 2023 17:58
@fasttime fasttime requested a review from a team as a code owner July 19, 2023 17:58
@@ -255,6 +255,63 @@ export default [
];
```

Copy link
Member

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.
Copy link
Member

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.

docs/src/use/configure/migration-guide.md Outdated Show resolved Hide resolved
fasttime and others added 2 commits July 20, 2023 18:15
Co-authored-by: Nicholas C. Zakas <nicholas@humanwhocodes.com>
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. 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.
Copy link
Member

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.

@mdjermanovic mdjermanovic added the accepted There is consensus among the team that this change meets the criteria for inclusion label Jul 22, 2023
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!

@mdjermanovic mdjermanovic merged commit da73e58 into main Jul 22, 2023
22 checks passed
@mdjermanovic mdjermanovic deleted the migrate-eslint-env branch July 22, 2023 10:01
bmish added a commit to bmish/eslint that referenced this pull request Jul 23, 2023
* 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)
  ...
@eslint-github-bot eslint-github-bot bot locked and limited conversation to collaborators Jan 19, 2024
@eslint-github-bot eslint-github-bot bot added the archived due to age This issue has been archived; please open a new issue for any further discussion label Jan 19, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
accepted There is consensus among the team that this change meets the criteria for inclusion archived due to age This issue has been archived; please open a new issue for any further discussion documentation Relates to ESLint's documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants