-
-
Notifications
You must be signed in to change notification settings - Fork 32
chore: update minimatch #273
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
base: main
Are you sure you want to change the base?
Conversation
|
Can we now remove
|
|
We should also update minimatch dependency in the eslint package: https://github.com/eslint/eslint/blob/e1ac05e2fae779e738f85bd47dda1cc2b7099346/package.json#L139 |
| "@eslint/object-schema": "^2.1.6", | ||
| "debug": "^4.3.1", | ||
| "minimatch": "^3.1.2" | ||
| "minimatch": "^10.0.3" |
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.
Are there any other breaking changes we should be concerned about in these 7 major versions?
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.
I think there are two main breaking changes we need to be aware of beyond the obvious Node.js version bumps and export changes:
1- POSIX character class support (added in v7.3)
Example test that will fail in 3.x but pass in 10.x:
describe("POSIX character classes", () => {
it("[[:alpha:]] matches alphabetic characters", () => {
const configs = new ConfigArray(
[
{
files: ["**/[[:alpha:]].js"],
},
],
{ basePath },
);
configs.normalizeSync();
assert.strictEqual(configs.getConfigStatus("a.js"), "matched");
});
});2- Pattern simplification with .. segments
Minimatch added an optimizationLevel option that controls how patterns are normalized before matching:
- 0 → No changes.
.and..must appear literally in both the pattern and the test string.
Example:a/*/../cmatchesa/b/../c, but nota/c. - 1 (default) → Simplify
..segments when possible.
Example:./a/b/../*is simplified to./a/*, so it matches./a/c, but not./a/b/../c.
Example test that will fail in 3.x but pass in 10.x:
describe("Pattern simplification with '..' segments", () => {
it("'a/b/../*.js' behaves like 'a/*.js'", () => {
const configs = new ConfigArray(
[
{
files: ["a/b/../*.js"],
},
],
{ basePath },
);
configs.normalizeSync();
assert.strictEqual(configs.getConfigStatus("a/x.js"), "matched");
assert.strictEqual(configs.getConfigStatus("a/b/x.js"), "unconfigured");
});
it("'a/b/../**/*.js' behaves like 'a/**/*.js'", () => {
const configs = new ConfigArray(
[
{
files: ["a/b/../**/*.js"],
},
],
{ basePath },
);
configs.normalizeSync();
assert.strictEqual(configs.getConfigStatus("a/x/y.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.
Thanks for the detailed analysis!
Example test that will fail in 3.x but pass in 10.x:
describe("POSIX character classes", () => { it("[[:alpha:]] matches alphabetic characters", () => { const configs = new ConfigArray( [ { files: ["**/[[:alpha:]].js"], }, ], { basePath }, ); configs.normalizeSync(); assert.strictEqual(configs.getConfigStatus("a.js"), "matched"); }); });
Since this is a new feature that will become available in config-array and consequently in ESLint, but at the same time kind of breaking because [[:alpha:]].js can be a valid filename in posix (I think?), it might be best to tag this PR as feat!?
Yeah, it’s on my todo list — I’ll get to it today or tomorrow. |
@Pixel998 I can take it(if you don't have time to look at it.)🙌 |
Prerequisites checklist
What is the purpose of this pull request?
This PR updates the
minimatchpackage to the latest versionWhat changes did you make? (Give an overview)
minimatchto v10.0.3minimatch, in line with the updated API.@types/minimatchpackage sinceminimatchnow includes its own built-in TypeScript type definitions.minimatchv10 requires Node.js v20 or higher, so marking this PR as draft until we drop Node.js v18.Related Issues
Fixes #230
Fixes #66
Is there anything you'd like reviewers to focus on?