Let's agree on one thing that ESLint is awesome. If used properly this can increase your productivity by 10x, if not then it can be a mess.
While working on connect feature for dev.to, I came across the real power of ESLint (perks of working with a great team). From I became a real fan of ESLint and using it in almost all my projects. I have recently written a complete guide for ESLint on xenox.dev.
So I thought, Let's ask you what's your fav ESLint config and plugin. Here is mine:
module.exports = { | |
parserOptions: { | |
ecmaVersion: 2020, // Allows for the parsing of modern ECMAScript features | |
sourceType: 'module', // Allows for the use of imports | |
ecmaFeatures: { | |
jsx: true // Allows for the parsing of JSX | |
} | |
}, | |
env: { | |
browser: true, | |
node: true, | |
es6: true | |
}, | |
plugins: ['simple-import-sort'], | |
settings: { | |
react: { | |
version: 'detect' // Tells eslint-plugin-react to automatically detect the version of React to use | |
} | |
}, | |
extends: [ | |
'eslint:recommended', | |
'plugin:jsx-a11y/recommended', | |
'plugin:react/recommended', // Uses the recommended rules from @eslint-plugin-react | |
'plugin:prettier/recommended', // Enables eslint-plugin-prettier and eslint-config-prettier. This will display prettier errors as ESLint errors. Make sure this is always the last configuration in the extends array. | |
'plugin:sonarjs/recommended', | |
'plugin:unicorn/recommended', | |
'plugin:security/recommended', | |
'plugin:react-hooks/recommended' | |
], | |
rules: { | |
'no-console': 'error', | |
'react/react-in-jsx-scope': 'off', | |
'react/prop-types': 'off', | |
'simple-import-sort/sort': 'error', | |
'unicorn/prevent-abbreviations': [ | |
'error', | |
{ | |
whitelist: { | |
getStaticProps: true | |
} | |
} | |
], | |
'unicorn/filename-case': [ | |
'error', | |
{ | |
cases: { | |
camelCase: true | |
} | |
} | |
] | |
} | |
}; |
Add your config in the comment section and share your personal hack if any.
Also๐

Top comments (6)
I'm using the XO linter that is based on ESLint. I like its simplicity but disagree with many of its rules.
After adding too many overrides in each project, I collected them into a @yoursunny/xo-config package.
XO is now part of Unicorn I think ๐ค
Yup
Wait, you're not using eslint-plugin-compatโ๏ธ
oooooo What's that? ๐ฒ