-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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
[New] support new config system #3429
Conversation
- add configs/ entry points for recommended configs - add documentation to readme
Codecov Report
@@ Coverage Diff @@
## master #3429 +/- ##
==========================================
+ Coverage 97.58% 97.62% +0.04%
==========================================
Files 124 123 -1
Lines 9055 8959 -96
Branches 3308 3272 -36
==========================================
- Hits 8836 8746 -90
+ Misses 219 213 -6
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
a3f8f5b
to
5654271
Compare
um, what? The new system is ESM? Why can’t it be CJS? |
@ljharb Your point is right. So, in conclusion,
For supporting the new config system in CJS, I patched .mjs to .js and introduced |
Native ESM doesn't have any benefits over CJS (or transpiled ESM), and lacks the majority of the relevant tooling capabilities, so I'd strongly prefer to avoid using it entirely - let's keep everything in CJS. What is the benefit of the new config system? Why does an eslint user care what config system this plugin is using? |
You may want to read these if you haven't.
Personally, I felt the resolution of this issue eslint/eslint#3458 is an impressive benefit.
Because the current config is not compatible with the new system. |
I added a new dependency named globals.
|
That issue benefits shared configs, not plugins. |
663ccec
to
f9b812c
Compare
Okay, I rewrote the config without |
6da5609
to
e75bebf
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I fixed up the code samples, added the missing mjs/cjs/mtsx/mjsx extensions (native ESM should always be .mjs, not .js, so it's critical to allow that), converted the CJS files you added to ESM, and decided to put the configs under a top-level configs
directory instead, and refactored index.js
to pull from those.
I'm dismayed that eslint's new config system removes the env key; users shouldn't have to import globals themselves, especially if they'd have to depend directly on the globals package.
e75bebf
to
d6cdc8a
Compare
d6cdc8a
to
17858be
Compare
Supporting eslint's new config system of eslint.
Note that the legacy config system always has
require()
d plugins and sharable configs, while the new system is ESM.Thus conditional export is great to keep compatibility.
plugin:
protocol(e.g.plugin:react/recommended
) is not valid any more. Thus the new plugin doesn't haveconfigs
.Sharable configs for the new config system are now exported as
eslint-plugin-react/all
,eslint-plugin-react/recommended
,eslint-plugin-react/jsx-runtime