Skip to content

Instantly share code, notes, and snippets.

@DouglasdeMoura
Created March 29, 2022 16:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save DouglasdeMoura/845020f42e68dc2672cf4d75f05fd874 to your computer and use it in GitHub Desktop.
Save DouglasdeMoura/845020f42e68dc2672cf4d75f05fd874 to your computer and use it in GitHub Desktop.
My ESLint config
module.exports = {
env: {
browser: true,
node: true,
},
settings: {
react: {
version: 'detect',
},
node: {
extensions: ['.js', '.jsx', '.json', '.node', '.ts', '.tsx'],
project: ['tsconfig.json', 'package/tsconfig.json'],
},
typescript: {
alwaysTryTypes: true,
project: ['tsconfig.json', 'package/tsconfig.json'],
},
},
parser: '@typescript-eslint/parser',
parserOptions: {
ecmaVersion: 2018,
sourceType: 'module',
ecmaFeatures: {
jsx: true,
},
},
plugins: [
'react',
'react-hooks',
'@typescript-eslint',
'eslint-plugin-import-helpers',
],
extends: [
'eslint:recommended',
'plugin:react/recommended',
'plugin:@typescript-eslint/eslint-recommended',
'plugin:@typescript-eslint/recommended',
'plugin:storybook/recommended',
'plugin:prettier/recommended',
],
rules: {
'prettier/prettier': [
'error',
{
semi: false,
singleQuote: true,
trailingComma: 'all',
},
{
usePrettierrc: false,
},
],
'import-helpers/order-imports': [
'warn',
{
newlinesBetween: 'always',
groups: [
'/^react/',
'module',
'/^styles.*/',
['parent', 'sibling', 'index'],
],
alphabetize: {
order: 'asc',
ignoreCase: true,
},
},
],
'react-hooks/rules-of-hooks': 'error',
'react-hooks/exhaustive-deps': 'warn',
'react/prop-types': 'off',
'react/jsx-props-no-spreading': 'off',
'react/react-in-jsx-scope': 'off',
'@typescript-eslint/explicit-module-boundary-types': 'off',
'@typescript-eslint/no-non-null-assertion': 'off',
'@typescript-eslint/no-var-requires': 'off',
},
overrides: [
{
env: {
jest: true,
},
files: ['**/?(*.)+(spec|test).[jt]s?(x)'],
extends: ['plugin:jest/recommended', 'plugin:testing-library/react'],
rules: {
'import/no-extraneous-dependencies': [
'off',
{
devDependencies: ['**/?(*.)+(spec|test).[jt]s?(x)'],
},
],
},
},
{
env: {
'cypress/globals': true
},
files: ['**/?(*.)+e2e.[jt]s?(x)'],
extends: ['plugin:cypress/recommended'],
},
],
}
{
"name": "eslint-config",
"version": "1.0.0",
"license": "MIT",
"dependencies": {
"@typescript-eslint/eslint-plugin": "^5.17.0",
"@typescript-eslint/parser": "^5.17.0",
"eslint-config-prettier": "^8.5.0",
"eslint-plugin-cypress": "^2.12.1",
"eslint-plugin-import-helpers": "^1.2.1",
"eslint-plugin-jest": "^26.1.3",
"eslint-plugin-jest-dom": "^4.0.1",
"eslint-plugin-jsx-a11y": "^6.5.1",
"eslint-plugin-prettier": "^4.0.0",
"eslint-plugin-react": "^7.29.4",
"eslint-plugin-react-hooks": "^4.3.0",
"eslint-plugin-storybook": "^0.5.7",
"eslint-plugin-testing-library": "^5.1.0",
"prettier": "^2.6.1",
"eslint": "latest",
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment