Skip to content

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

Merged
merged 3 commits into from
Jun 6, 2025
Merged

Conversation

mdjermanovic
Copy link
Member

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 of files.

Related Issues

eslint/eslint#19814

Is there anything you'd like reviewers to focus on?

@github-project-automation github-project-automation bot moved this to Needs Triage in Triage Jun 5, 2025
@eslint-github-bot eslint-github-bot bot added the bug Something isn't working label Jun 5, 2025
const nonUniversalFiles = [];
const universalFiles = config.files.filter(element => {
if (Array.isArray(element)) {
if (
Copy link
Member

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

Copy link
Member Author

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

@nzakas nzakas moved this from Needs Triage to Implementing in Triage Jun 5, 2025
nzakas
nzakas previously approved these changes Jun 5, 2025
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 @fasttime to review before merging.

@nzakas nzakas moved this from Implementing to Second Review Needed in Triage Jun 5, 2025
Copy link
Member

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",
);

Copy link
Member Author

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.

Copy link
Member

@fasttime fasttime 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!

@fasttime fasttime merged commit e84cbd7 into main Jun 6, 2025
21 checks passed
@github-project-automation github-project-automation bot moved this from Second Review Needed to Complete in Triage Jun 6, 2025
@fasttime fasttime deleted the issue-eslint19814 branch June 6, 2025 14:03
@github-actions github-actions bot mentioned this pull request Jun 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
accepted bug Something isn't working
Projects
Status: Complete
Development

Successfully merging this pull request may close these issues.

4 participants