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
fix: validate ignorePatterns
constructor option in FlatESLint
class
#17139
Conversation
✅ Deploy Preview for docs-eslint ready!
To edit notification comments on pull requests, go to your Netlify site settings. |
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. I'll leave it open for others to review.
I'm not sure if this option should be accepting string value as that could be misleading. ignorePatterns: string might be interpreted as if the string can contain multiple patterns (e.g., a newline-delimited list).
I believe the string type comes when using CLI --ignore-pattern '!.build'
. Or does this also evaluates to ignorePatterns: ['!.build']
?
This evaluates to |
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. Didn't realize we weren't validating this option.
Oops, missed this. I think we can enforce that this option must take an array of strings and not a single string. Since the option is passed an array from the CLI, and |
Updated to disallow |
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. Just waiting until after we're cleared of a patch release to merge.
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.
Thanks, LGTM!
Prerequisites checklist
What is the purpose of this pull request? (put an "X" next to an item)
[ ] Documentation update
[x] 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:
Adds missing validation for
ignorePatterns
constructor option of theFlatESLint
class.What changes did you make? (Give an overview)
Updated
function processOptions
to throw a readable message whenignorePatterns
is not a non-empty string, an array of non-empty strings, ornull
.Is there anything you'd like reviewers to focus on?
I'm not sure if this option should be accepting
string
value as that could be misleading.ignorePatterns: string
might be interpreted as if the string can contain multiple patterns (e.g., a newline-delimited list).