Last active
February 8, 2022 11:16
-
-
Save Dremora/e1abbe736be924de25c79cb3ffeb2c82 to your computer and use it in GitHub Desktop.
ESLint configuration
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
const path = require('path'); | |
module.exports = { | |
parserOptions: { | |
tsconfigRootDir: __dirname, // required for VS Code | |
EXPERIMENTAL_useSourceOfProjectReferenceRedirect: true, // required for TS project references | |
}, | |
extends: ['./frontend-app'], // or backend | |
settings: { | |
'import/resolver': { | |
typescript: { | |
project: [ | |
__dirname + '/tsconfig.json', | |
// add more tsconfigs here if using TS project references | |
], // required for VS Code | |
}, | |
}, | |
}, | |
rules: { | |
'import/no-unused-modules': [ | |
'error', | |
{ | |
src: [path.join(__dirname, 'src')], | |
unusedExports: true, | |
missingExports: true, | |
ignoreExports: [ | |
// This is for Next.js app, replace with other roots if necessary | |
// Stories and tests also go here | |
__dirname + '/src/pages/**/*.tsx', | |
__dirname + '/src/pages/**/*.ts', | |
], | |
}, | |
], | |
}, | |
}; |
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
module.exports = { | |
extends: [ | |
'eslint:recommended', | |
'plugin:@typescript-eslint/recommended', | |
'plugin:@typescript-eslint/recommended-requiring-type-checking', | |
'plugin:import/typescript', | |
'plugin:prettier/recommended', | |
'./shared', | |
], | |
env: { | |
es6: true, | |
node: true, | |
} | |
}; |
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
const restrictedGlobals = require('confusing-browser-globals'); | |
module.exports = { | |
plugins: ['react-hooks', 'react'], | |
extends: [ | |
'eslint:recommended', | |
'plugin:react/recommended', | |
'plugin:react-hooks/recommended', | |
'plugin:react/jsx-runtime', | |
'plugin:@typescript-eslint/recommended', | |
'plugin:@typescript-eslint/recommended-requiring-type-checking', | |
'plugin:import/typescript', | |
'plugin:jsx-a11y/recommended', | |
'plugin:prettier/recommended', | |
'./shared', | |
], | |
env: { | |
browser: true, | |
es6: true, | |
node: true, | |
}, | |
settings: { | |
react: { | |
version: 'detect', | |
}, | |
}, | |
rules: { | |
'no-restricted-globals': ['error'].concat(restrictedGlobals), | |
'react-hooks/exhaustive-deps': 'error', | |
'react-hooks/rules-of-hooks': 'error', | |
'react/jsx-boolean-value': 'error', | |
'react/jsx-filename-extension': ['error', { extensions: ['tsx'] }], | |
'react/no-array-index-key': 'error', | |
'react/prefer-stateless-function': 'error', | |
'react/prop-types': 'off', | |
'react/self-closing-comp': 'error', | |
}, | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment