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

Bump: Add --ext mjs to default file extensions #13301

Closed
cookiengineer opened this issue May 15, 2020 · 4 comments
Closed

Bump: Add --ext mjs to default file extensions #13301

cookiengineer opened this issue May 15, 2020 · 4 comments
Labels
archived due to age This issue has been archived; please open a new issue for any further discussion auto closed The bot closed this issue bug ESLint is working incorrectly triage An ESLint team member will look at this issue soon

Comments

@cookiengineer
Copy link

This is the same issue as #9592 that was closed due to old age (and that the TSC, at the time, decided against its consideration).

  1. Now we have 2020, and Browser Modules have shipped in all stable Browser channels, see https://caniuse.com/#feat=es6-module

  2. All Browsers (meaning Firefox, Chromium, Edgium, Safari 12+ and all downstream forks, including WebKitGTK / QTWebKit) accept the .mjs ESM module file extension by default and expressively check against the application/javascript header for that specific file extension when being used as <script type="module"> and it can be assumed that this is the defacto standard file extension for ESM modules now.

  3. Node.js removed the --experimental flag in its stable release channel.

  4. The IETF is working on an RFC to include mjs as the official file extension in the following Draft: https://tools.ietf.org/html/draft-ietf-dispatch-javascript-mjs-05

  5. The Python language adapted mjs as the file extension for ESM modules: https://bugs.python.org/issue31715

  6. Golang adapted mjs as the file extension for ESM modules: net/http: add built-in mime type for *.mjs golang/go#30547

Given the circumstances and the state that ESM modules are in, right now, and that mjs as a file extension was already pushed out on stable channels of above mentioned implementations - and considering the IETF effort that is put this into an RFC - I think it is safe to say that mjs will be the official file extension soon.

I hope that the file extension mjs can now be reconsidered to be included in the default file extensions that are linted by eslint.

Paste the command you used to run ESLint:

eslint --ext js,mjs ./*; # mjs should not be necessary

What did you expect to happen?

eslint ./*; # should behave the same way as above

Are you willing to submit a pull request to fix this bug?

Yes, of course.

@cookiengineer cookiengineer added bug ESLint is working incorrectly triage An ESLint team member will look at this issue soon labels May 15, 2020
@cookiengineer cookiengineer changed the title Round 2: Add --ext mjs to default file extensions Bump: Add --ext mjs to default file extensions May 15, 2020
@anikethsaha
Copy link
Member

Thanks for the issue.

if I am not wrong, this might need sourceType : module by default then, 🤔 ?

@cookiengineer
Copy link
Author

@anikethsaha Yep, mjs are the extension that forces node and the Browser into using ESM import syntax, whereas js files cannot use import and neither export.

@anikethsaha
Copy link
Member

yes, it needs ecmaVersion to 2015 by default as well. (breaking)

This might need RFC

let's hear from others.

@eslint-deprecated eslint-deprecated bot added the auto closed The bot closed this issue label Jun 17, 2020
@eslint-deprecated
Copy link

Unfortunately, it looks like there wasn't enough interest from the team
or community to implement this change. While we wish we'd be able to
accommodate everyone's requests, we do need to prioritize. We've found
that issues failing to reach accepted status after 21 days tend to
never be accepted, and as such, we close those issues.
This doesn't mean the idea isn't interesting or useful, just that it's
not something the team can commit to.

Thanks for contributing to ESLint and we appreciate your understanding.

@eslint-deprecated eslint-deprecated bot locked and limited conversation to collaborators Dec 15, 2020
@eslint-deprecated eslint-deprecated bot added the archived due to age This issue has been archived; please open a new issue for any further discussion label Dec 15, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
archived due to age This issue has been archived; please open a new issue for any further discussion auto closed The bot closed this issue bug ESLint is working incorrectly triage An ESLint team member will look at this issue soon
Projects
None yet
Development

No branches or pull requests

2 participants