Created
June 16, 2023 05:05
-
-
Save fatgy/62e544899bb3ab3dca102be9e4234ed1 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//.eslintrc.js | |
module.exports = { | |
root: true, | |
extends: [ | |
'eslint:recommended', | |
'plugin:react/recommended', | |
'plugin:react-hooks/recommended', | |
'plugin:react/jsx-runtime', | |
'plugin:storybook/recommended', | |
'plugin:import/recommended', | |
'plugin:jsx-a11y/recommended', | |
'prettier', | |
], | |
plugins: ['react', 'react-hooks', 'storybook', 'import', 'jsx-a11y'], | |
env: { | |
node: true, | |
browser: true, | |
}, | |
settings: { | |
ecmaVersion: 'latest', | |
react: { | |
version: 'detect', | |
}, | |
'import/resolver': { | |
node: true, | |
typescript: true, | |
}, | |
}, | |
parserOptions: { | |
ecmaFeatures: { | |
jsx: true, | |
}, | |
}, | |
ignorePatterns: [ | |
'!*.js', | |
'!.storybook', | |
'.*.js', | |
'*.json', | |
'scripts', | |
'src/graphql/generated/*', | |
], | |
rules: { | |
'no-console': 'warn', | |
'no-debugger': 'warn', | |
'no-warning-comments': 'warn', | |
'object-shorthand': 'error', | |
'no-param-reassign': [ | |
'error', | |
{ | |
props: true, | |
ignorePropertyModificationsFor: ['acc', 'next'], | |
}, | |
], | |
'react/prop-types': 'off', | |
'react/self-closing-comp': [ | |
'error', | |
{ | |
component: true, | |
html: true, | |
}, | |
], | |
'react/jsx-props-no-spreading': 'off', | |
'react/jsx-curly-brace-presence': [ | |
'error', | |
{ props: 'never', children: 'never' }, | |
], | |
'jsx-a11y/anchor-is-valid': [ | |
'error', | |
{ | |
components: ['Link', 'NextLink', 'RouterLink'], | |
aspects: ['invalidHref'], | |
}, | |
], | |
'import/order': [ | |
'error', | |
{ | |
'newlines-between': 'always', | |
pathGroups: [ | |
{ | |
pattern: '$/**', | |
group: 'internal', | |
}, | |
], | |
pathGroupsExcludedImportTypes: ['builtin'], | |
groups: [ | |
['builtin', 'external'], | |
['internal'], | |
['parent', 'sibling', 'index'], | |
'unknown', | |
], | |
alphabetize: { | |
order: 'asc', | |
caseInsensitive: true, | |
}, | |
}, | |
], | |
'import/no-default-export': 'error', | |
'import/no-extraneous-dependencies': 'error', | |
}, | |
overrides: [ | |
{ | |
files: ['*.ts', '*.tsx'], | |
extends: [ | |
'plugin:@typescript-eslint/eslint-recommended', | |
'plugin:@typescript-eslint/recommended', | |
'plugin:@typescript-eslint/recommended-requiring-type-checking', | |
'plugin:import/typescript', | |
], | |
plugins: ['@typescript-eslint/eslint-plugin'], | |
parser: '@typescript-eslint/parser', | |
parserOptions: { | |
project: ['./tsconfig.json', './cypress/tsconfig.json'], | |
}, | |
rules: { | |
'@typescript-eslint/no-use-before-define': [ | |
'error', | |
{ functions: false }, | |
], | |
'@typescript-eslint/no-floating-promises': [ | |
'error', | |
{ ignoreVoid: true }, | |
], | |
}, | |
}, | |
{ | |
files: [ | |
'*stories.*', | |
'src/pages/**/*.tsx', | |
'additional.d.ts', | |
'**/__mocks__/**', | |
'cypress.config.ts', | |
], | |
rules: { | |
'import/no-anonymous-default-export': 'off', | |
'import/no-default-export': 'off', | |
}, | |
}, | |
{ | |
files: ['**/__tests__/**', '**/__mocks__/**'], | |
env: { | |
jest: true, | |
}, | |
extends: ['plugin:testing-library/react', 'plugin:jest-dom/recommended'], | |
rules: { | |
'testing-library/no-render-in-setup': 'error', | |
'testing-library/no-wait-for-empty-callback': 'error', | |
'testing-library/prefer-explicit-assert': 'error', | |
'testing-library/prefer-presence-queries': 'error', | |
'testing-library/prefer-screen-queries': 'error', | |
'testing-library/prefer-wait-for': 'error', | |
}, | |
}, | |
{ | |
files: ['**/cypress/**'], | |
plugins: ['cypress'], | |
extends: ['plugin:cypress/recommended'], | |
env: { | |
'cypress/globals': true, | |
}, | |
}, | |
], | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment