Default to eslint.config.js when syntax-detection is supported
We could also consider implementing a check in
@eslint/create-configduring 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 versions[^1], 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?
[^1]: v22.7.0 and v20.19.0 enabled by default
related: https://github.com/eslint/create-config/pull/206
It looks like we're already doing this, so closing: https://github.com/eslint/create-config/blob/3fccf98672ea230981a52fbd6c5f435010edca00/lib/config-generator.js#L148
@nzakas you may misread the issue. :)
To clarify, the issue proposes, for not setting pkg.type="module" projects, to generate eslint.config.js. The current behavior, however, creates eslint.config.mjs.
Ah I see. I still don't think it's worth it. People may not understand this feature and I think it could cause more confusion than it helps.
Oops! It looks like we lost track of this issue. What do we want to do here? This issue will auto-close in 7 days without an update.