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.

Add mjs to --ext default

See original GitHub issue

Currently, the only default file extension for the --ext CLI option is js.

It would be good to add mjs to the default, since it is the emerging standard for native Node.js modules. Then the increasingly common lint npm script could go from "eslint . --ext js,mjs" back to simply eslint ..

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:10
  • Comments:27 (14 by maintainers)

github_iconTop GitHub Comments

7reactions
albertocommented, Mar 15, 2018

Given it’s still marked as experimental by node terms and it could be removed or changed in backwards incompatible ways, I am against adding it at this moment.

Stability: 1 - Experimental This feature is still under active development and subject to non-backwards compatible changes, or even removal, in any future version. Use of the feature is not recommended in production environments. Experimental features are not subject to the Node.js Semantic Versioning model.

6reactions
not-an-aardvarkcommented, Apr 12, 2018

In today’s TSC meeting, the TSC decided to not accept this issue for 5.0 because Node’s support for .mjs is still experimental. We anticipate that we will add support for this eventually when it becomes stable, unless Node’s roadmap changes. (As noted earlier in this issue, you can use the --ext=.js,.mjs flag to lint .mjs files today.)

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to use MJS files in Node.js? - DEV Community ‍ ‍
By default, the Node.js platform doesn't use ES modules but ... Tip: Don't forget to add the *.mjs extension to you import statement....
Read more >
Files with .mjs extension for JavaScript modules - Medium
mjs is the extension for EcmaScript module files. ... can configure to load ES modules by default, so no matter what extension the...
Read more >
"module" in the package.json or use the .mjs extension - Stack ...
The main problem is that Node.js need commonJs imports in .js files and allow to use es6modules in .mjs. Typescript by default generates...
Read more >
Using ECMAScript modules (ESM) with Node.js
Go and save this code into an mjs extension file, and just as we saw in the React example, you can import it...
Read more >
How to Use ECMAScript Modules in Node.js
The default format of modules in Node.js is the CommonJS. ... Let's detail into the first ( .mjs extension) and second ( {...
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