Skip to content

Bug: empty name should be allowed in globalIgnores #522

Open

Description

@liangmiQwQ

Which packages are affected?

  • @eslint/compat
  • @eslint/config-array
  • @eslint/config-helpers
  • @eslint/core
  • @eslint/mcp
  • @eslint/migrate-config
  • @eslint/object-schema
  • @eslint/plugin-kit

Environment

Node version: 24
npm version: 12
ESLint version: 10
Operating System: macOS

What did you do?

If you pass an empty name to the globalIgnores function, its return object will actually include globalIgnores <id> name .

What did you expect to happen?

Empty name is allowed in the flat config object.

What's more, in most config helper, like includeIgnoreFile, empty name is accepted. globalIgnores should follow this as this is also highly likely to be a mistake.

const name = optionsObject.name ?? `Imported .gitignore patterns`;

What actually happened?

When passing empty names, the name field is re-generated.

Link to Minimal Reproducible Example

https://github.com/liang-demos/eslint-global-ignores-empty-name-repro/tree/main

Participation

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

AI acknowledgment

  • I did not use AI to generate this issue report.
  • (If the above is not checked) I have reviewed the AI-generated content before submitting.

Additional comments

I found this problem while developing a personal project and viewing ESLint's source code, I used AI tools to generate a PR (#521) to fix this inconsistency which didn't follow the AI policy, this is the issue for discussion.

Activity

  1. added
    bugSomething isn't working
    repro:neededThis issue should include a reproducible example
    on Oct 5, 2026
  2. moved this to Needs Triage in Triageon Oct 5, 2026
  3. DMartens commented on Oct 5, 2026

    @DMartens

    As I asked on the PR, what is the purpose of using an empty name?
    The purpose of the property is that you can more easily understand your config, e.g. via tools like eslint config inspector.
    An empty name does not help with debugging your configuration while the generated name does help.

  4. added
    repro:yesIssues with a reproducible example
    and removed
    repro:neededThis issue should include a reproducible example
    on Oct 5, 2026
  5. liangmiQwQ commented on Oct 5, 2026

    @liangmiQwQ
    ContributorAuthor

    As I asked on the PR, what is the purpose of using an empty name? The purpose of the property is that you can more easily understand your config, e.g. via tools like eslint config inspector. An empty name does not help with debugging your configuration while the generated name does help.

    I don't have an exact purpose here, I just noticed while browsing the code that the two helpers handle empty names inconsistently (includeIgnoreFile vs globalIgnores).

    If the team decides to disallow empty name for generated config item, we should also follow it in other helpers like includeIgnoreFile.

    And the reason why I suggest to allow empty name rather than using generated name in other helpers is using || to provide a fallback/default value for a nullable string instead of ?? is uncommon as a typescript developer, there is even an ESLint rule in typescript-eslint plugin to find this typescript/prefer-nullish-coalescing.

    And, thanks for your time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingrepro:yesIssues with a reproducible example

Type

No type

Projects

  • Status
    Evaluating

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions