-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Support eslint flat config #2873
base: main
Are you sure you want to change the base?
Support eslint flat config #2873
Conversation
d20d08a
to
b0da628
Compare
b0da628
to
0102dc8
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.
it'd be great to have some kind of test that this actually works, perhaps with a test fixture project that uses the flat config, and we run eslint on it and assert on the output?
@OlivierZal any progress on this? you are a dependency to the airbnb styleguide which can't support eslint 9 & flat config yet |
Hi, I confess I gave up (too many dependencies) and don't use the airbnb config anymore... |
In that case, anyone who wants to continue this PR, please don't open a new PR - instead, comment here with a link to a branch or commit, and I can pull in your changes. |
hey @ljharb , I added flat config support in my fork: https://github.com/vonBrax/eslint-plugin-import/tree/feat/flat-config. There are however a few points to discuss. I based my solution similar to https://github.com/ember-cli/eslint-plugin-ember, which I found when reading eslint/eslint#18095. The advantage is that it is backwards compatible, but not so ergonomic since one does need to individually import the necessary configs instead of just one default import, like here for example: https://github.com/vonBrax/eslint-plugin-import/blob/fbb21b08c344c1306f92d0b466b5c0b647bbbcca/tests/files/flat-config-typescript/eslint.config.js#L1-L2 The eslint recommendation is to rename the old configs by appending "-legacy" to their names. We then would need only a single import, but that would also probably be a breaking change and it would also require fixing all the failing tests. Because this plugin apparently also parse files "manually", I had to include I've included a few test cases alongside my changes, but since I'm not familiar with this project nor with writing eslint plugins, I'm not sure if I'm missing something here. Let me know what you think. I'm also happy to open a PR since I took a very different path than what was initially proposed by this PR. |
Existing entrypoints must continue to work in places they work now. I'd rather force flat config users to use a new entrypoint than force eslintrc users to use a "legacy" one. It would of course be ideal if we could delegate as much parsing as possible to eslint. If your fork's added tests can be made to pass, that seems great! The important part is that every existing test must continue to pass, in order to not have a breaking change. |
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
…adds eslint flat config support - import-js/eslint-plugin-import#2873 Signed-off-by: Deep Panchal <deep302001@gmail.com>
…adds eslint flat config support - import-js/eslint-plugin-import#2873 Signed-off-by: Deep Panchal <deep302001@gmail.com>
…adds eslint flat config support - import-js/eslint-plugin-import#2873 Signed-off-by: Deep Panchal <deep302001@gmail.com>
Obviated by #3018. |
No description provided.