This repository was archived by the owner on Jun 8, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path.eslintrc.js
104 lines (104 loc) · 3.68 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
98
99
100
101
102
103
104
module.exports = {
parser: 'babel-eslint',
extends: [
'airbnb',
'eslint:recommended',
'plugin:import/recommended',
'plugin:react/recommended',
'plugin:flowtype/recommended',
],
plugins: ['redux-saga', 'react', 'react-hooks', 'jsx-a11y', 'flowtype'],
env: {
jest: true,
browser: true,
node: true,
es6: true,
},
parserOptions: {
ecmaVersion: 6,
sourceType: 'module',
ecmaFeatures: {
jsx: true,
},
},
rules: {
'class-methods-use-this': 'off',
'no-param-reassign': 'off',
'no-throw-literal': 'off',
'no-alert': 'off',
'no-unused-vars': 'off',
'max-len': 'off',
'object-curly-spacing': ['error', 'never'],
'prefer-destructuring': 'off',
'comma-dangle': ['error', 'always-multiline'],
'no-underscore-dangle': ['error', {allow: ['__NEXT_DATA__']}],
'no-script-url': 'off',
'consistent-return': 'off',
indent: ['error', 4, {SwitchCase: 1}],
semi: 'error',
'react/jsx-indent': [2, 4],
'react/jsx-indent-props': ['error', 'first'],
'react/jsx-tag-spacing': ['error', {
closingSlash: 'never', beforeSelfClosing: 'never', afterOpening: 'never', beforeClosing: 'never',
}],
'react/jsx-filename-extension': [1, {extensions: ['.js', '.jsx']}],
'react/jsx-one-expression-per-line': 'off',
'react/no-danger': 'off',
'react/prefer-stateless-function': 'off',
'react/display-name': 'off',
'jsx-a11y/no-static-element-interactions': 'off',
'jsx-a11y/anchor-is-valid': 'off',
'jsx-a11y/label-has-for': 'off',
'jsx-a11y/alt-text': 'off',
'import/no-extraneous-dependencies': 'off',
'import/extensions': 'off',
'import/no-unresolved': [2, {caseSensitive: false}],
'import/prefer-default-export': 'off',
'import/no-named-as-default': 'off',
'import/no-named-as-default-member': 'off',
'react/jsx-key': 'error',
'react/state-in-constructor': 'off',
'react/static-property-placement': 'off',
'react/jsx-props-no-spreading': 'off',
'react/prop-types': 'off',
'react-hooks/rules-of-hooks': 'error',
'react-hooks/exhaustive-deps': 'off',
quotes: ['error', 'single'],
'global-require': 'off',
'space-in-brackets': 'off',
'no-plusplus': 'off',
'flowtype/delimiter-dangle': ['error', 'always-multiline'],
'no-use-before-define': 'off',
'func-names': 'off',
radix: ['error', 'as-needed'],
'arrow-parens': ['error', 'as-needed'],
'no-trailing-spaces': ['error', {ignoreComments: true, skipBlankLines: true}],
'no-multiple-empty-lines': ['error', {max: 1, maxEOF: 1}],
'padded-blocks': 'off',
'prefer-object-spread': 'off',
},
settings: {
'import/resolver': {
webpack: {
config: './webpack.config.js'
}
},
react: {
createClass: 'createReactClass', // Regex for Component Factory to use,
// default to "createReactClass"
pragma: 'React', // Pragma to use, default to "React"
version: '16.12.0', // React version, default to the latest React stable release
flowVersion: '0.112.0', // Flow version
},
flowtype: {
onlyFilesWithFlowAnnotation: true, // 只在添加flow註釋的文件才做檢查
},
},
globals: {
alert: true,
window: true,
document: true,
__global__: true,
__cookie__: true,
},
};