-
-
Notifications
You must be signed in to change notification settings - Fork 353
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 new config system #1886
Support ESLint new config system #1886
Conversation
If I try to create a "drop-in" replacement for the old config system, recommended.js would be like this. import unicorn from '../index.mjs'
import globals from 'globals'
export default {
languageOptions: {
globals: {
...globals.node,
...globals.es2021
}
},
plugins: {
unicorn,
},
rules: { /* ... */ }
} However, in the new config system, there is actually no such "root" config.
If we include the default Which one do you prefer? |
@sindresorhus And I also want to ask how you think about including export default {
files: ['**/*.{js,cjs,mjs,jsx,ts,tsx}'],
plugins: {
unicorn,
},
rules: { /* ... */ }
} |
I would prefer to keep including them. We can reevaluate it when the new config system is more mature and has established conventions. |
If that's not the default in the new system, it makes sense to include it here for convenience. |
You need to fix the lint issues. |
✅ Done.
✅ It's not default and I've configured it.
✅ Right. Forgot to do so. Fixed :) |
Linting is still failing |
@sindresorhus Well.. right, fixed again. |
I wrote a guide for the new config system and usage in readme. |
Co-authored-by: Ari Perkkiö <ari.perkkio@gmail.com>
I think the docs are a bit too verbose. It's not our job to document how the ESLint config system works. We should just show a small example and then link to ESLint docs for more. |
Yes, I agree that's 100% right logically. |
I decided to remain CommonJS support in this PR, at least before eslint/eslint#17863 gets solved, people still need the config file in CommonJS. |
Questions:
|
I think we should stick to what ESLint recommends, just |
No, I don't think that makes sense. We can rather document it and also include it in the recommended config. |
Just make sure it follows the recommendations in https://eslint.org/docs/latest/extend/plugin-migration-flat-config#backwards-compatibility |
We can't, we already have |
Yes. Let's do it like that and we can switch it around later on when we fully move to flat config. |
This would be better then, IMHO. import unicorn from 'eslint-plugin-unicorn/flat'
export default [
unicorn.configs.recommended,
] |
We can switch back to |
@fisker I know. But I mean |
If we don't add If we add
and
I think |
I think it's ready for review. |
Supporting eslint's new config system of eslint.
Note that legacy config system always has
require()
d plugins and sharable configs, while the system is ESM.Thus conditional export is great to keep compatibility.
Fixes #1885
Fixes #2220