-
-
Notifications
You must be signed in to change notification settings - Fork 26
fix: explicit match in array elements of files
#218
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
Conversation
const nonUniversalFiles = []; | ||
const universalFiles = config.files.filter(element => { | ||
if (Array.isArray(element)) { | ||
if ( |
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.
Maybe we can add a comment here to explain that because an array is an AND operation, then all items in the array need to be universal for it to be considered universal? (Assuming I'm reading this correctly.)
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.
Added a comment in e5d3270
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 @fasttime to review before merging.
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.
Is it intended that an empty array no longer matches any files? For example, this test will stop passing after this PR is merged:
configs = new ConfigArray(
[
{
files: [[]],
},
],
{
basePath,
},
);
configs.normalizeSync();
assert.strictEqual(
configs.getConfigStatus("foo/a.js"),
"matched",
);
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.
It still matches all files, but is no longer considered an explicit match (non-universal pattern), which I think was a part of this bug. I added tests in 89ee195 to clarify this.
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!
Prerequisites checklist
What is the purpose of this pull request?
Fixes the problem described in eslint/eslint#19814.
What changes did you make? (Give an overview)
Fixed the code that checks for explicit matches in
files
to account for array elements offiles
.Related Issues
eslint/eslint#19814
Is there anything you'd like reviewers to focus on?