question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Support eslint.config.cjs

See original GitHub issue

The problem you want to solve.

The upcoming simplified configuration system (RFC), or flat config (#13481), only supports eslint.config.js, but it can’t be used if there’s "type": "module" in the project’s package.json, since ESLint doesn’t currently support loading an ECMAScript module as a config file.

Your take on the correct solution to problem.

ESLint should also support eslint.config.cjs by default, so that "type": "module" can be used along with ESLint.

Are you willing to submit a pull request to implement this change?

Maybe if it’s not too hard to implement.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:7
  • Comments:12 (9 by maintainers)

github_iconTop GitHub Comments

4reactions
mdjermanoviccommented, Mar 5, 2021

We’re thinking about using import() to load eslint.config.js. In that case, I think that support for .cjs and .mjs extensions doesn’t seem necessary: in "type": "module" projects eslint.config.js should be written as ESM, in other projects as CJS.

If it turns out that we still have to use require() to load configs, then I think we should support eslint.config.cjs, because require("eslint.config.js") doesn’t work in "type": "module" projects.

2reactions
aladdin-addcommented, Aug 24, 2021

you can use .eslintrc.cjs.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Configuration Files - ESLint - Pluggable JavaScript Linter
ESLint supports adding shared settings into configuration files. Plugins use settings to specify the information that should be shared across all of its...
Read more >
ESLint's new config system, Part 2: Introduction to flat config
A pluggable and configurable linter tool for identifying and reporting on patterns in JavaScript. Maintain your code quality with ease.
Read more >
Configuring ESLint - ESLint - Pluggable JavaScript Linter
A pluggable and configurable linter tool for identifying and reporting on patterns in JavaScript. Maintain your code quality with ease.
Read more >
Configuration Files (New) - ESLint - Pluggable JavaScript Linter
A pluggable and configurable linter tool for identifying and reporting on patterns in JavaScript. Maintain your code quality with ease.
Read more >
Language Options - ESLint - Pluggable JavaScript Linter
ESLint allows you to specify the JavaScript language options you want to support. By default, ESLint expects ECMAScript 5 syntax. You can override...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found