Skip to content

Instantly share code, notes, and snippets.

@jgonera
Created March 28, 2020 17:00
Show Gist options
  • Save jgonera/c91eb82d2fb49ca87f72f2e0a9463608 to your computer and use it in GitHub Desktop.
Save jgonera/c91eb82d2fb49ca87f72f2e0a9463608 to your computer and use it in GitHub Desktop.
// without TypeScript (not tested)
module.exports = {
root: true,
extends: [
'airbnb',
'airbnb/hooks',
'plugin:import/errors',
'plugin:import/warnings',
'prettier',
'prettier/react',
],
env: {
browser: true,
},
overrides: [
{
files: ['**/*.test.js', '**/*.test.jsx'],
env: {
jest: true,
},
},
],
settings: {
'import/ignore': ['node_modules'],
},
};
// with TypeScript (original)
module.exports = {
root: true,
extends: [
'airbnb',
'airbnb/hooks',
'plugin:@typescript-eslint/recommended',
'plugin:import/errors',
'plugin:import/warnings',
'plugin:import/typescript',
'prettier',
'prettier/react',
],
env: {
browser: true,
},
overrides: [
{
files: ['**/*.test.ts', '**/*.test.tsx'],
env: {
jest: true,
},
},
{
files: ['*.js'],
rules: {
// Allow `require()` in config files.
'@typescript-eslint/no-var-requires': 'off',
},
},
],
rules: {
'import/extensions': [
'error',
'ignorePackages',
{
js: 'never',
mjs: 'never',
jsx: 'never',
ts: 'never',
tsx: 'never',
},
],
// Not needed with TypeScript
'import/default': 'off',
'import/named': 'off',
'import/namespace': 'off',
'import/no-unresolved': 'off',
// Doesn't play well with Formik's Field.
'jsx-a11y/label-has-associated-control': 'off',
// TODO: Enable this with same config as in api
'@typescript-eslint/explicit-function-return-type': 'off',
'react/jsx-filename-extension': ['error', { extensions: ['.tsx'] }],
},
settings: {
'import/ignore': ['node_modules'],
'import/resolver': {
typescript: {}, // this loads <rootdir>/tsconfig.json
},
},
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment