Skip to content

Instantly share code, notes, and snippets.

@aluissp
Created February 3, 2023 02:11
Show Gist options
  • Save aluissp/254fef0a6a6eeedf7cb7db0a13580e4f to your computer and use it in GitHub Desktop.
Save aluissp/254fef0a6a6eeedf7cb7db0a13580e4f to your computer and use it in GitHub Desktop.
Eslint setup for reactjs
module.exports = {
env: {
browser: true,
es2021: true,
},
settings: {
react: {
version: 'detect',
},
},
extends: [
'plugin:react/recommended',
'plugin:react/jsx-runtime',
'standard',
'eslint-config-prettier',
],
overrides: [],
parserOptions: {
ecmaVersion: 'latest',
sourceType: 'module',
},
plugins: ['react'],
rules: {
// 'no-unused-vars': 'off',
// 'no-unused-expressions': 'off',
// 'react/prop-types': 0,
},
};
@aluissp
Copy link
Author

aluissp commented Feb 3, 2023

Steps to install eslint with prettier

Commands

I'm usign yarn, but you can use another package manager.

yarn add -D eslint
yarn add -D eslint-config-prettier

If you're going to use jest for tests, install this plugin

yarn add -D eslint-plugin-jest

Then create eslint config file with the following command.

yarn eslint --init

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment