-
Notifications
You must be signed in to change notification settings - Fork 21
/
.eslintrc.js
137 lines (132 loc) · 3.54 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
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
// http://eslint.org/docs/user-guide/configuring
const reactVersion = require('./package.json').dependencies.react;
module.exports = {
root: true,
parser: 'babel-eslint',
parserOptions: {
ecmaVersion: 7,
sourceType: 'module',
ecmaFeatures: {
jsx: true,
modules: true,
/*
prevent:
``
Parsing error: Using the export keyword between a decorator and a class is not allowed.
Please use `export @dec class` instead.
``
*/
legacyDecorators: true
}
},
env: {
browser: true,
node: true,
es6: true,
commonjs: true,
jest: true
},
globals: {
HOSTNAME: true,
PORT: true
},
settings: {
react: {
// fix Warning: React version not specified in eslint-plugin-react settings
// see: https://github.com/yannickcr/eslint-plugin-react/issues/1955
version: reactVersion
}
},
extends: [
'airbnb-base',
'plugin:react/recommended',
'plugin:import/errors',
'plugin:import/warnings'
],
plugins: [
// 'react'
],
// add your custom rules here
rules: {
// basic
quotes: [
'error',
'single',
{
allowTemplateLiterals: true,
avoidEscape: true
}
],
'prefer-destructuring': 'off',
'no-restricted-globals': ['warn', 'event'],
'no-unexpected-multiline': 'off',
'no-useless-constructor': 'warn',
'max-nested-callbacks': ['error', 3],
'no-multi-assign': 'warn',
'no-lonely-if': 'off',
// allow paren-less arrow functions
'arrow-parens': 'off',
// import
'import/no-extraneous-dependencies': ['error', { devDependencies: true }],
'import/no-dynamic-require': 'warn',
'import/no-unresolved': 'off',
'import/extensions': 'off',
'import/prefer-default-export': 'off',
'import/first': 'warn',
'import/no-duplicates': 'error',
// allow async-await
'generator-star-spacing': 'off',
// allow debugger during development
'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'off',
'global-require': 'off',
'no-console': 'error',
'dot-notation': 'off',
'no-underscore-dangle': 'off',
'no-param-reassign': 'off',
'no-unused-expressions': 'off',
'no-mixed-operators': 'off',
'no-return-await': 'off',
'no-restricted-syntax': 'off',
'no-await-in-loop': 'off',
camelcase: 'off',
'max-len': [
'warn',
{
code: 100,
tabWidth: 2,
ignoreUrls: true,
ignoreComments: true,
ignoreRegExpLiterals: true,
ignoreTrailingComments: true,
ignoreStrings: true,
ignoreTemplateLiterals: true,
ignorePattern:
"^(\\s*[a-zA-Z_]+: '[^']+'[,;]*)|(.*gettext.*)|(.*interpolate.*)|(.*require.*)|(.*_\\.template.*)$"
}
],
'no-eval': 'warn',
'no-plusplus': 'off',
'no-empty': 'off',
'no-empty-function': 'off',
'func-names': 'off',
'consistent-return': 'off',
'class-methods-use-this': 'off',
'no-use-before-define': 'off',
'comma-dangle': 'off',
'no-unused-vars': 'warn',
radix: 'off',
'one-var': 'off',
'prefer-const': 'warn',
'no-return-assign': 'warn',
// react
'react/jsx-uses-react': 'error',
'react/jsx-uses-vars': 'error',
'react/prop-types': 'off', // fixme: off => warn
'react/sort-comp': 'warn',
'react/sort-prop-types': 'warn',
'react/display-name': 'off',
'react/no-string-refs': 'warn',
'react/no-find-dom-node': 'warn',
'react/no-unescaped-entities': ['error', { forbid: ['>', '}'] }]
}
};