forked from broadinstitute/gnomad-browser
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.eslintrc.js
97 lines (97 loc) · 3.5 KB
/
.eslintrc.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
module.exports = {
extends: [
'airbnb',
'airbnb/hooks',
'prettier',
'prettier/react',
'plugin:@typescript-eslint/recommended',
],
env: {
browser: true,
},
parser: '@typescript-eslint/parser',
plugins: ['prettier', '@typescript-eslint'],
rules: {
// Using prettier rules here is redundant with the pre-commit hook.
// Also, since we currently have a lot of non-compliant files, prettying
// up every file in the codebase (as opposed to just changed files)
// would add (even more) noise. Hence, the decision not to do it, at least
// in the scope of the current PR.
//
// However, we want to keep the prettier eslint plugin itself, since that
// disables a lot of eslint formatting rules we don't want.
'prettier/prettier': 'off',
'func-names': ['warn', 'as-needed'],
'react/jsx-filename-extension': ['error', { extensions: ['.js', '.jsx', 'ts', '.tsx'] }],
'import/prefer-default-export': 0,
// https://github.com/airbnb/javascript/blob/6d05dd898acfec3299cc2be8b6188be542824965/packages/eslint-config-airbnb/rules/react.js#L489
'react/static-property-placement': ['error', 'static public field'],
// Does not handle initial state derived from props in constructor
// TODO: Use shorthand
'react/jsx-fragments': 'off',
camelcase: 'off',
'@typescript-eslint/no-unused-vars': [
'error',
{ argsIgnorePattern: '^_', varsIgnorePattern: '^_' },
],
'no-underscore-dangle': 'off',
'no-bitwise': ['error', { int32Hint: true }],
'import/extensions': ['error', { ts: 'allow', tsx: 'allow', json: 'allow' }],
'@typescript-eslint/ban-ts-comment': 'off',
'no-empty-function': 'off',
'@typescript-eslint/no-empty-function': 'off',
'react/prop-types': 'off',
'react/require-default-props': 'off',
'react/default-props-match-prop-types': 'off',
'react/no-unused-prop-types': 'off',
'no-restricted-globals': 'off',
'@typescript-eslint/no-extra-semi': 'off',
'import/order': 'off',
// Rules disabled below this line are ones that we might want to re-enable
// someday but that will entail more work, either because lots of distinct
// LOCs will have to be updated, or because it's not immediately obvious
// why eslint is flagging something.
'react/state-in-constructor': 'off',
'react/jsx-props-no-spreading': 'off',
'@typescript-eslint/no-var-requires': 'off',
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/no-non-null-assertion': 'off',
'import/no-extraneous-dependencies': 'off',
'import/no-unresolved': 'off',
'no-use-before-define': 'off',
'react/destructuring-assignment': 'off',
'prefer-destructuring': 'off',
"no-shadow": "off",
"@typescript-eslint/no-shadow": ["error"]
},
overrides: [
{
// Set environment for tests
files: ['**/*spec.ts', '**/*test.ts', 'tests/**/*.ts'],
env: {
jest: true,
},
},
{
// Allow using devDependencies from workspace root in browser webpack config
files: ['browser/webpack.config.js', 'browser/build/*.js'],
rules: {
'import/no-extraneous-dependencies': ['error', { packageDir: ['./browser', '.'] }],
},
},
{
// Set environment for server-side code
files: ['graphql-api/**/*.ts', 'graphql-api/**/*.js'],
env: {
browser: false,
node: true,
},
rules: {
'no-restricted-syntax': 'off',
},
},
],
parserOptions: {
ecmaVersion: '2018',
},
}