Closed vfan closed 6 months ago
Hi @vfan, thanks for the issue. I believe this is working as intended. By default, the generated ESLint config always follows JavaScript modules
syntax (import/export
).
import globals from "globals";
import pluginJs from "@eslint/js";
export default [
{languageOptions: { globals: globals.node }},
pluginJs.configs.recommended,
];
In your case since your project follows commonjs
syntax (require
), the config file will have the .mjs
extension to indicate that this file must be evaluated using JavaScript modules
syntax.
If your package.json
had type: module
, which indicates that the project follows JavaScript modules
syntax, then a eslint.config.js
file would be generated instead of a eslint.config.mjs
.
https://github.com/eslint/create-config/blob/dbd874289676e3b1442bf3d3984070b6fed5586b/lib/config-generator.js#L136
When my module is commonjs type,it generate eslint.config.mjs