DEV Community

Sarthak Sharma
Sarthak Sharma

Posted on

17 4

What's your favorite ESLint Config and Plugins?๐Ÿ‘ฎ๐Ÿฝ๐Ÿšจ๐Ÿž

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
}
}
]
}
};
view raw .eslintrc.js hosted with โค by GitHub

Add your config in the comment section and share your personal hack if any.

Also๐Ÿ‘‡

Simple Junkyard Tumblr Banner

Image of Datadog

The Essential Toolkit for Front-end Developers

Take a user-centric approach to front-end monitoring that evolves alongside increasingly complex frameworks and single-page applications.

Get The Kit

Top comments (6)

Collapse
 
yoursunny profile image
Junxiao Shi โ€ข

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.

Collapse
 
sarthology profile image
Sarthak Sharma โ€ข

XO is now part of Unicorn I think ๐Ÿค”

Collapse
 
smitray profile image
Smit Ray โ€ข

Yup

Collapse
 
tbroyer profile image
Thomas Broyer โ€ข

Wait, you're not using eslint-plugin-compatโ‰๏ธ

Collapse
 
sarthology profile image
Sarthak Sharma โ€ข

oooooo What's that? ๐Ÿ˜ฒ

Collapse
 
Sloan, the sloth mascot
Comment deleted

Billboard image

Try REST API Generation for MS SQL Server.

DevOps for Private APIs. With DreamFactory API Generation, you get:

  • Auto-generated live APIs mapped from database schema
  • Interactive Swagger API documentation
  • Scripting engine to customize your API
  • Built-in role-based access control

Learn more

๐Ÿ‘‹ Kindness is contagious

Please leave a โค๏ธ or a friendly comment on this post if you found it helpful!

Okay