Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Eslint config file genrate error #102

Closed
vfan opened this issue Apr 20, 2024 · 1 comment
Closed

Eslint config file genrate error #102

vfan opened this issue Apr 20, 2024 · 1 comment

Comments

@vfan
Copy link

vfan commented Apr 20, 2024

this.result.configFilename = isESMModule ? "eslint.config.js" : "eslint.config.mjs";

When my module is commonjs type,it generate eslint.config.mjs

@Rec0iL99
Copy link
Member

Rec0iL99 commented Apr 20, 2024

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

No branches or pull requests

3 participants