-
-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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: Clarify implicit ignore behavior for dotfiles #12600
Conversation
Sorry for the delay on our end. It looks to me like the accepted issue was just the documentation change. Can we scope this PR to just improving documentation and make a new issue for the bug fix? |
Sure. I'll remove the bug fix and just include the documentation changes. Have you made a new issue already? |
I don't think we have an issue for the code changes. You can feel free to create a new proposal for that! |
I reduced this PR down to documentation changes. New issue + PR for code changes will come in a day or two. |
@snhardin sorry we lost track of this. Are you interested in fixing the merge conflicts so we can look at merging this? |
Certainly. I'll have them fixed in the next couple of days. |
Thanks! |
Done. |
docs/user-guide/configuring.md
Outdated
|
||
For example, placing the following `.eslintignore` file in the current working directory will not ignore `node_modules/*` and ignore anything in the `build/` directory except `build/index.js`: | ||
* `node_modules/` as well as `bower_components/` directories are ignored. |
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.
The default ignore patterns have changed in v7.0.0.
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 be fixed in latest push.
docs/user-guide/configuring.md
Outdated
|
||
There are also some exceptions to these rules: | ||
|
||
* If the path to lint is a glob pattern or directory path and contains a Dotfolder, all Dotfiles and Dotfolders will be linted. This includes subDotfiles and subDotfolders that are buried deeper in the directory structure. |
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.
* If the path to lint is a glob pattern or directory path and contains a Dotfolder, all Dotfiles and Dotfolders will be linted. This includes subDotfiles and subDotfolders that are buried deeper in the directory structure. | |
* If the path to lint is a glob pattern or directory path and contains a Dotfolder, all Dotfiles and Dotfolders will be linted. This includes sub-dotfiles and sub-dotfolders that are buried deeper in the directory structure. |
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.
Fixed.
docs/user-guide/configuring.md
Outdated
|
||
```text | ||
# node_modules/* is ignored by default, but can be added using ! | ||
# All .git/* Dotfiles as well as /node_modules/* and /bower_components/* in the project root are ignored by 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.
Technically, all dotfiles and dotfolders (except for .eslintrc.) are ignored, not just `.git/.
@snhardin there are some requested changes on this pull request. Please let us know if you're still working on the changes or if you'd like someone else to pick up this work. Thanks! |
Apologies! Did not see the emails for the requested changes. Will get on those asap. |
Pushed some changes. Let me know what you think! |
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.
A couple editing requests, but otherwise LGTM. Thanks for working on this!
docs/user-guide/configuring.md
Outdated
|
||
For example, `eslint .config/my-config-file.js --no-ignore` will cause `my-config-file.js` to be linted. It should be noted that the same command without the `--no-ignore` line will not lint the `my-config-file.js` file. | ||
|
||
* Whitelist and blacklist rules specified via `--ignore-pattern` or `.eslintignore` are prioritized above implicit ignore rules. |
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.
* Whitelist and blacklist rules specified via `--ignore-pattern` or `.eslintignore` are prioritized above implicit ignore rules. | |
* Allowlist and denylist rules specified via `--ignore-pattern` or `.eslintignore` are prioritized above implicit ignore rules. |
docs/user-guide/configuring.md
Outdated
|
||
* Whitelist and blacklist rules specified via `--ignore-pattern` or `.eslintignore` are prioritized above implicit ignore rules. | ||
|
||
For example, in this scenario, `.build/test.js` is the desired file to whitelist. Because all Dotfolders and their children are ignored by default, `.build` must first be whitelisted so that eslint because aware of its children. Then, `.build/test.js` must be explicitly whitelisted, while the rest of the content is blacklisted. This is done with the following `.eslintignore` file: |
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.
For example, in this scenario, `.build/test.js` is the desired file to whitelist. Because all Dotfolders and their children are ignored by default, `.build` must first be whitelisted so that eslint because aware of its children. Then, `.build/test.js` must be explicitly whitelisted, while the rest of the content is blacklisted. This is done with the following `.eslintignore` file: | |
For example, in this scenario, `.build/test.js` is the desired file to allowlist. Because all Dotfolders and their children are ignored by default, `.build` must first be allowlisted so that eslint becomes aware of its children. Then, `.build/test.js` must be explicitly allowlisted, while the rest of the content is denylisted. This is done with the following `.eslintignore` file: |
docs/user-guide/configuring.md
Outdated
For example, in this scenario, `.build/test.js` is the desired file to whitelist. Because all Dotfolders and their children are ignored by default, `.build` must first be whitelisted so that eslint because aware of its children. Then, `.build/test.js` must be explicitly whitelisted, while the rest of the content is blacklisted. This is done with the following `.eslintignore` file: | ||
|
||
```text | ||
# Whitelist 'test.js' in the '.build' folder |
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.
# Whitelist 'test.js' in the '.build' folder | |
# Allowlist 'test.js' in the '.build' folder |
docs/user-guide/configuring.md
Outdated
✖ 1 problem (0 errors, 1 warning) | ||
``` | ||
|
||
This messages occurs because normally, this file would be ignored by ESLint's implicit ignore rules (as mentioned above). A negated ignore rule in your `.eslintignore` file would override the implicit rule and reinclude this file for linting. Additionally, in this specific case, `--no-ignore` could be used to lint the file as well. |
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.
This messages occurs because normally, this file would be ignored by ESLint's implicit ignore rules (as mentioned above). A negated ignore rule in your `.eslintignore` file would override the implicit rule and reinclude this file for linting. Additionally, in this specific case, `--no-ignore` could be used to lint the file as well. | |
This messages occurs because, normally, this file would be ignored by ESLint's implicit ignore rules (as mentioned above). A negated ignore rule in your `.eslintignore` file would override the implicit rule and reinclude this file for linting. Additionally, in this specific case, `--no-ignore` could be used to lint the file as well. |
Added the comma after "because" and replaced all instances of "whitelist" and "blacklist." |
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, thank you!
What is the purpose of this pull request? (put an "X" next to item)
[ ] Documentation update
[X] Bug fix (template)
[ ] New rule (template)
[ ] Changes an existing rule (template)
[ ] Add autofixing to a rule
[ ] Add a CLI option
[ ] Add something to the core
[ ] Other, please explain:
Addresses issue #12348
What changes did you make? (Give an overview)
This is a small pull request that changes the logic for displaying an error message when a file is ignored by implicit ignore rules. The regular expression for detecting a dotfile was expanded to look for a dotfile in any part of the path rather than just the end of the path. Additionally, documentation that explains the nuances of the implicit ignore rules and a test for the new behavior introduced in this pull request have been added.
Is there anything you'd like reviewers to focus on?
None in particular. This pull request is small enough that I think someone knowledgeable can give good feedback on all aspects (code changes, documentation, testing).