Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions packages/config-array/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,10 @@
"dependencies": {
"@eslint/object-schema": "^2.1.6",
"debug": "^4.3.1",
"minimatch": "^3.1.2"
"minimatch": "^10.0.3"
Copy link
Member

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?

Copy link
Contributor Author

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/*/../c matches a/b/../c, but not a/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");
  });
});

},
"devDependencies": {
"@jsr/std__path": "^1.0.4",
"@types/minimatch": "^3.0.5",
"rollup-plugin-copy": "^3.5.0"
},
"engines": {
Expand Down
12 changes: 6 additions & 6 deletions packages/config-array/src/config-array.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

import * as posixPath from "@jsr/std__path/posix";
import * as windowsPath from "@jsr/std__path/windows";
import minimatch from "minimatch";
import { minimatch } from "minimatch";
import createDebug from "debug";

import { ObjectSchema } from "@eslint/object-schema";
Expand All @@ -23,8 +23,8 @@ import { filesAndIgnoresSchema } from "./files-and-ignores-schema.js";
/** @typedef {import("@eslint/object-schema").PropertyDefinition} PropertyDefinition */
/** @typedef {import("@eslint/object-schema").ObjectDefinition} ObjectDefinition */
/** @typedef {import("./types.ts").ConfigObject} ConfigObject */
/** @typedef {import("minimatch").IMinimatchStatic} IMinimatchStatic */
/** @typedef {import("minimatch").IMinimatch} IMinimatch */
/** @typedef {import("minimatch").Minimatch} Minimatch */
/** @typedef {import("minimatch").MinimatchOptions} MinimatchOptions */
/** @typedef {import("@jsr/std__path")} PathImpl */

/*
Expand All @@ -45,19 +45,19 @@ const debug = createDebug("@eslint/config-array");

/**
* A cache for minimatch instances.
* @type {Map<string, IMinimatch>}
* @type {Map<string, Minimatch>}
*/
const minimatchCache = new Map();

/**
* A cache for negated minimatch instances.
* @type {Map<string, IMinimatch>}
* @type {Map<string, Minimatch>}
*/
const negatedMinimatchCache = new Map();

/**
* Options to use with minimatch.
* @type {Object}
* @type {MinimatchOptions}
*/
const MINIMATCH_OPTIONS = {
// matchBase: true,
Expand Down
Loading