Add mjs to --ext default
See original GitHub issueCurrently, 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:
- Created 6 years ago
- Reactions:10
- Comments:27 (14 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
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.
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.)