-
-
Notifications
You must be signed in to change notification settings - Fork 637
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
feat: support new config system #891
Conversation
- add top-level entry points for recommended configs - add documentation to readme
Codecov Report
@@ Coverage Diff @@
## main #891 +/- ##
=======================================
Coverage 99.29% 99.29%
=======================================
Files 104 103 -1
Lines 1555 1571 +16
Branches 523 514 -9
=======================================
+ Hits 1544 1560 +16
Misses 11 11 |
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 understand that the shared configs provided by this plugin need to be in their own entrypoints to work with the new system.
However, why can't the existing "main" Just Work with the new config system? What's in legacy.js
that's different from index.js
?
I have never said the existing "main" just doesn't work. It works because the only difference is the existence of |
I'm not sure why a user would be confused, and if they are, I think that's on eslint to fix, not individual plugins in the ecosystem. |
Okay. I respect that. I'd patch as long as this is resolved. |
Pushed a new commit :) |
be22bed
to
fe746c8
Compare
This comment was marked as resolved.
This comment was marked as resolved.
fe746c8
to
995d36d
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 extensions (native ESM should always be .mjs, not .js, so it's critical to allow that), and converted the CJS files you added in src/
to ESM.
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.
77a0186
to
a6750f7
Compare
hmm, i'm having second thoughts on the |
Well, my opinion is yes, if so. |
I didn't understand your reply. What I realized is that it's critical for all of these extensions to be included, and highly unlikely devs will remember to include them all, so it's valuable to provide them by default. However, I want the plugin object to be able to be usable in both config systems. |
It seems there's confusion between us?
To my understanding, |
@jjangga0214 what i mean is, in the legacy config, is the presence of a "files" property problematic? or is it ignored? |
I don't understand the point. Legacy config should not be used in the new config. They're just different and incompatible. The exception is when the legacy config only has So I still don't grasp what your concern is. |
"Different and incompatible" is what I'm trying to confirm. If in fact the same object can't serve in both configs, then that's a massive design mistake on eslint's side - and I'd prefer to impose the cost on the users of the new config, since the legacy config is the most important (and will remain so for a good number of years). |
Does this mean you're not supposed to support the new config system, which also means you'd not merge this PR? |
@jjangga0214 oh no, not at all! it just means the main entrypoint of the package will be the legacy config, and flat config users will need to import, eg, However, if the same object can be used in both config systems, then the main entrypoint can support both, which is the ideal. I've just rebased this, and if tests pass, and we can confirm that the main entrypoint works in both configs, then it'd be good to go :-) |
fe5bb49
to
3e48857
Compare
@ljharb is this being maintained? the last update was four months ago when you said it would be merged |
@pauliesnug of course it is. I'm waiting for confirmation that the plugin works in both config formats. |
Okay, I now understand it.
Unfortunately, no. eslint-plugin-jsx-a11y/src/index.js Lines 47 to 54 in 1adec35
For example, as I've said before, Note that the spec of plugin itself(not config) is compatible, by the way. So in conclusion, we should provide a different object by a different entry point. |
Just an example, but yes, it'd need to be some other entry point. |
FWIW |
+1 on this. This would be useful for importing recommended/strict settings via CLI (e.g. |
Is this still being worked on? Otherwise I can always start a PR |
@soerenmartius please don't open a new PR; if you want to rebase this PR and keep working on it, please comment a branch link and i'll pull in your changes. |
Thanks - I am on PTO this and next week but will try to contribute once I am back unless you have time to finish this until then! Thanks |
Is this still being worked on? I might be able to help out, if nobody's working on it. Really eager for the v9 & flat config support. |
@michaelfaith if you have updates, please comment a link to a branch or sha (not a new PR) and i'll pull in the changes. |
@ljharb I know you mentioned not creating a new PR, but I went in a totally different direction with this, in order to address some of your concerns, so I opened a new PR: #993 Totally cool if you'd rather bring those changes into this PR, but figured I'd leave that up to you. (But note, this PR shouldn't close the v9 issue, since it's just focused on flat config support). With my changes, we can use the same |
Closing in favor of #993. |
Supporting eslint's new config system of eslint.
Note that the legacy config system always has
require()
d plugins and sharable configs, whereas the new system is available with both of ESM and CJS.Thus conditional export is introduced to keep compatibility while providing a new config/plugin at the same time.
plugin:
protocol(e.g.plugin:react-hooks/recommended
) is not valid any more. Thus the new plugin doesn't haveconfigs
.Blocker for #978.