Skip to content

Bug: Patterns in arrays are not considered explicit match #19814

@mdjermanovic

Description

@mdjermanovic

Environment

Node version: v22.14.0
npm version: v10.9.2
Local ESLint version: v9.28.0
Global ESLint version: no
Operating System: windows

What parser are you using?

Default (Espree)

What did you do?

Configuration
export default [
    {
        files: [["**/*.myjs", "src/**"]],
        rules: {
            "no-undef": 2
        }
    }
];
// src/foo.myjs
foo

What did you expect to happen?

I'd expect all .myjs files in src directory to be included in linting.

What actually happened?

$ npx eslint src/foo.myjs

C:\projects\tmp\tmp\src\foo.myjs
  0:0  warning  File ignored because no matching configuration was supplied

✖ 1 problem (0 errors, 1 warning)

Link to Minimal Reproducible Example

https://stackblitz.com/edit/stackblitz-starters-vajknonf

Participation

  • I am willing to submit a pull request for this issue.

Additional comments

This is because the code that checks whether a pattern is an explicit match doesn't account for arrays in files:

https://github.com/eslint/rewrite/blob/cb858ffb8b77ea76187a857546c7a838a1fb4881/packages/config-array/src/config-array.js#L1013-L1054

If the order is changed to files: [["src/**", "**/*.myjs"]], then it is considered explicit match, by chance due to the way arrays are coerced to strings.

Metadata

Metadata

Assignees

Labels

acceptedThere is consensus among the team that this change meets the criteria for inclusionbugESLint is working incorrectlyrepro:yesIssues with a reproducible example

Type

No type

Projects

Status

Complete

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions