-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy path.eslintrc.js
More file actions
86 lines (81 loc) · 2.34 KB
/
.eslintrc.js
File metadata and controls
86 lines (81 loc) · 2.34 KB
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
const baseConfig = require('../../.eslintrc.js');
// From the tslint.json we used previously
const leftoverTsLintRules = {
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/explicit-function-return-type': 'off',
'@typescript-eslint/no-use-before-define': 'off'
};
const jestViolations = {
'jest/no-disabled-tests': 'off',
'jest/expect-expect': 'off',
// Below rules should probably be revisited
'jest/prefer-to-have-length': 'off',
'jest/prefer-to-contain': 'off',
'jest/no-identical-title': 'off',
'jest/no-jasmine-globals': 'off',
'jest/no-try-expect': 'off',
'jest/no-test-callback': 'off'
};
const otherViolations = {
'@typescript-eslint/camelcase': 'off',
// Below rules should probably be revisited
'@typescript-eslint/no-inferrable-types': 'off',
'@typescript-eslint/ban-ts-ignore': 'off',
'@typescript-eslint/no-non-null-assertion': 'off',
'@typescript-eslint/no-this-alias': 'off',
'@typescript-eslint/no-empty-function': 'off',
'@typescript-eslint/no-var-requires': 'off',
'import/no-duplicates': 'off',
'import/no-unresolved': 'off',
'prefer-rest-params': 'off',
'react/no-unescaped-entities': 'off',
'react/prop-types': 'off'
};
// From https://github.com/yannickcr/eslint-plugin-react#configuration
const reactSettings = {
react: {
createClass: 'createReactClass',
pragma: 'React',
version: 'detect',
flowVersion: '0.53'
},
propWrapperFunctions: [
'forbidExtraProps',
{property: 'freeze', object: 'Object'},
{property: 'myFavoriteWrapper'}
],
linkComponents: ['Hyperlink', {name: 'Link', linkAttribute: 'to'}]
};
module.exports = {
...baseConfig,
env: {
browser: true,
es6: true
},
plugins: [...baseConfig.plugins, 'jest', 'react-hooks'],
extends: [
'plugin:jest/recommended',
'plugin:jest/style',
'plugin:import/errors',
'plugin:import/warnings',
'plugin:import/typescript',
'plugin:react/recommended',
...baseConfig.extends
],
rules: {
...baseConfig.rules,
...leftoverTsLintRules,
...jestViolations,
...otherViolations,
'react-hooks/rules-of-hooks': 'error',
'react-hooks/exhaustive-deps': 'warn'
},
globals: {
fail: 'readonly',
process: 'readonly',
module: 'readonly',
global: 'readonly',
Buffer: 'readonly'
},
settings: {...baseConfig.settings, ...reactSettings}
};