You need to add unicorn in eslintConfig section for plugins
"plugins": [
"unicorn"
],
Reference: Usage Documentation
Answer from hendrixchord on Stack Overflow
» npm install eslint-plugin-unicorn
You need to add unicorn in eslintConfig section for plugins
"plugins": [
"unicorn"
],
Reference: Usage Documentation
The accepted answer didn't work for me. After playing around with the configuration, I found the following to work:
"devDependencies": {
"xo": "^0.42.0"
},
"xo": {
"rules": {
"unicorn/prefer-module": 0
}
}
I'm using all the defaults - just not ready to change ALL my doe to modules just yet. Thought I'd share since it's a bit more concise.
» npm install @sanv/eslint-config-unicorn-typescript
Recently created my own eslint config and stumbled across https://github.com/sindresorhus/eslint-plugin-unicorn which has a few reasonable rules in there that have the potential to massively contribute to code quality, e.g. prefer-array-find, prefer-modern-dom-apis.
I was also unaware of https://github.com/testing-library/eslint-plugin-testing-library as well as the included eslint-plugin-jest which... should definitely have your attention if you use testing-library and/or jest.
https://github.com/benmosher/eslint-plugin-import also has import/order which may alphabetically group your imports, improving readability.
Anything else I've been missing out on?
Hey all, I am in the process of creating my own eslint version 9 set of rules with a flat config for the first time and I am wondering what you guys are using or recommending as a must have?
I use Typescript with React so thought to definitely include eslint-plugin-react and typescript-eslint. What else? I saw there is sonar eslint too but this one seems not so popular?
Do you have any "gems" that are not enabled by default or not popular but still a great addition?
I also see that many rules can be customized a bit, do you recommend that or rather not?
Really curious and interested about your experience on this, thanks!