Skip to content

Default to eslint.config.js when syntax-detection is supported #205

@kecrily

Description

@kecrily

We could also consider implementing a check in @eslint/create-config during init to verify whether the Node version supports this feature, then determine the output extension accordingly.

Originally posted by @kecrily in #20129


On some Node.js versions1, syntax-detection feature can determine if a file is an ES Module (ESM). This means it's not necessary to use an .mjs extension for an ESM-style eslint.config.* file, even in a CJS environment (i.e., a project with no "type" field in package.json).

If the feature is supported but "type" is set to "commonjs", should we still create an ESM-style eslint.config.js?

Footnotes

  1. v22.7.0 and v20.19.0 enabled by default

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Status

    Needs Triage

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions