forked from WoWAnalyzer/WoWAnalyzer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.eslintrc.js
138 lines (133 loc) · 6.7 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
138
module.exports = {
extends: "react-app",
rules: {
'import/first': ['warn', 'absolute-first'],
// https://github.com/airbnb/javascript#commas--dangling
'comma-dangle': ['warn', 'always-multiline'],
// Semicolons:
'no-extra-semi': 'warn',
// https://github.com/airbnb/javascript#semicolons--required
semi: ['warn', 'always'],
'semi-spacing': ['warn', { before: false, after: true }],
// Vars:
'no-var': 'warn',
'prefer-const': ['warn', {
destructuring: 'any',
ignoreReadBeforeAssign: true,
}],
'one-var': ['warn', 'never'],
'one-var-declaration-per-line': ['warn', 'always'],
// https://github.com/airbnb/javascript#comparison--switch-blocks
'no-case-declarations': 'warn',
// PropTypes:
'react/prop-types': ['warn', { ignore: [], customValidators: [] }],
'react/no-unused-prop-types': ['warn', {
customValidators: [
],
skipShapeProps: true,
}],
// Based on https://github.com/airbnb/javascript/blob/master/packages/eslint-config-airbnb-base/rules/best-practices.js:
// require return statements to either always or never specify values
'consistent-return': 'warn',
// specify curly brace conventions for all control statements
curly: ['warn', 'multi-line'],
// encourages use of dot notation whenever possible
'dot-notation': ['warn', { allowKeywords: true }],
// disallow use of multiple spaces
'no-multi-spaces': ['warn', {
ignoreEOLComments: false,
}],
// disallow use of new operator when not part of the assignment or comparison
'no-new': 'warn',
// disallow use of assignment in return statement
'no-return-assign': ['warn', 'always'],
// disallow redundant `return await`
'no-return-await': 'warn',
// disallow use of void operator
// https://eslint.org/docs/rules/no-void
'no-void': 'warn',
// require or disallow Yoda conditions
yoda: 'warn',
// Disallow await inside of loops
// https://eslint.org/docs/rules/no-await-in-loop
'no-await-in-loop': 'warn',
// disallow use of constant expressions in conditions
'no-constant-condition': 'warn',
// disallow use of debugger
'no-debugger': 'warn',
// disallow empty statements
'no-empty': 'warn',
// Disallow using indexOf when we have includes
'no-restricted-syntax': [
'warn',
{
selector: "BinaryExpression > CallExpression > MemberExpression > Identifier[name = 'indexOf']",
message: 'Please use `includes` instead of `indexOf`. If you use `indexOf` to actually get the index of something, this is a false positive that can be ignored with // eslint-disable-next-line no-restricted-syntax',
},
'WithStatement',
{
selector: "BinaryExpression[operator='in']",
message: 'Please do a comparison for `undefined` rather than use the `in` operator (consistent with the rest of the codebase)',
},
],
// disallow negating the left operand of relational operators
// https://eslint.org/docs/rules/no-unsafe-negation
'no-unsafe-negation': 'warn',
// React
// Specify whether double or single quotes should be used in JSX attributes
// https://eslint.org/docs/rules/jsx-quotes
'jsx-quotes': ['warn', 'prefer-double'],
// Enforce boolean attributes notation in JSX
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-boolean-value.md
'react/jsx-boolean-value': ['warn', 'never', { always: [] }],
// Enforce or disallow spaces inside of curly braces in JSX attributes
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-curly-spacing.md
'react/jsx-curly-spacing': ['warn', 'never', { allowMultiline: true }],
// Validate props indentation in JSX
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-indent-props.md
'react/jsx-indent-props': ['warn', 2],
// Require that the first prop in a JSX element be on a new line when the element is multiline
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-first-prop-new-line.md
// 'react/jsx-first-prop-new-line': ['warn', 'multiline'],
// Enforce spacing around jsx equals signs
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-equals-spacing.md
'react/jsx-equals-spacing': ['warn', 'never'],
// warn against using findDOMNode()
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-find-dom-node.md
'react/no-find-dom-node': 'warn',
// Prevent passing of children as props
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-children-prop.md
'react/no-children-prop': 'warn',
// Validate whitespace in and around the JSX opening and closing brackets
// https://github.com/yannickcr/eslint-plugin-react/blob/843d71a432baf0f01f598d7cf1eea75ad6896e4b/docs/rules/jsx-tag-spacing.md
'react/jsx-tag-spacing': ['warn', {
closingSlash: 'never',
beforeSelfClosing: 'always',
afterOpening: 'never',
// beforeClosing: 'never',
}],
// Prevent void DOM elements from receiving children
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/void-dom-elements-no-children.md
'react/void-dom-elements-no-children': 'warn',
// Prevent usage of shouldComponentUpdate when extending React.PureComponent
// https://github.com/yannickcr/eslint-plugin-react/blob/9e13ae2c51e44872b45cc15bf1ac3a72105bdd0e/docs/rules/no-redundant-should-component-update.md
'react/no-redundant-should-component-update': 'warn',
// Prevents common casing typos
// https://github.com/yannickcr/eslint-plugin-react/blob/73abadb697034b5ccb514d79fb4689836fe61f91/docs/rules/no-typos.md
'react/no-typos': 'warn',
// Enforce curly braces or disallow unnecessary curly braces in JSX props and/or children
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-curly-brace-presence.md
// props can't be "never" because multiline template literals would be broken
'react/jsx-curly-brace-presence': ['warn', { props: 'ignore', children: 'never' }],
// Prevent extra closing tags for components without children
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/self-closing-comp.md
'react/self-closing-comp': 'warn',
// TODO: Let's try to have a more consistent codestyle
// enforce one true brace style
'brace-style': ['warn', '1tbs', { allowSingleLine: true }],
// require camel case names
camelcase: ['warn', { properties: 'never', ignoreDestructuring: false, allow: ["^on_"] }],
// // enforce spacing before and after comma
// 'comma-spacing': ['warn', { before: false, after: true }],
},
};