Skip to content

Bug: Impossible to configure flat config for folder overrides? #125

@TotallyInformation

Description

@TotallyInformation

Environment

Node version: v20.18.1
npm version: N/A
Local ESLint version: 9.20.1
Global ESLint version: None
Operating System: Windows 11

What parser are you using?

Default (Espree)

What did you do?

Configuration
export default [
    {
        languageOptions: {
            // sourceType: 'script',
            ecmaVersion: 2018,
        },
    },
    {
        files: ['**/*'],
        languageOptions: {
            sourceType: 'script',
            ecmaVersion: 'latest',
        },
    },
    {
        files: ['nodes/**/*'],
        languageOptions: {
            sourceType: 'commonjs',
            ecmaVersion: 2019,
        },
    },
]

I have tried the above configurations in multiple orders and combinations.

What did you expect to happen?

Any js file in the nodes/ folder or any of its sub-folders should be treated as commonjs using ES2019.

Files in other folders or in the root should be treated as module (which seems to be the current default) and using the latest ES version.

What actually happened?

Any js file in the nodes/ folder or any of its sub-folders is treated according to the default or the section with files: ['**/*'].

The section with files: ['nodes/**/*'] is completely ignored.

files: ['nodes/**/*'] can be written as files: ['nodes'] or files: ['nodes/*'] and it is still completely ignored no matter what order the configs come in.

Link to Minimal Reproducible Example

https://github.com/TotallyInformation/eslintv9test

Participation

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

Additional comments

Obviously the provided config is simply a minimal example.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions