@dartess/eslint-plugin 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +7 -0
- package/README.md +134 -0
- package/dist/configs/mobx.d.ts +3 -0
- package/dist/configs/mobx.js +13 -0
- package/dist/configs/next.d.ts +3 -0
- package/dist/configs/next.js +17 -0
- package/dist/configs/react.d.ts +3 -0
- package/dist/configs/react.js +78 -0
- package/dist/configs/recommended.d.ts +3 -0
- package/dist/configs/recommended.js +211 -0
- package/dist/configs/storybook.d.ts +3 -0
- package/dist/configs/storybook.js +20 -0
- package/dist/configs/vendor-rules/best-practices.d.ts +120 -0
- package/dist/configs/vendor-rules/best-practices.js +248 -0
- package/dist/configs/vendor-rules/errors.d.ts +40 -0
- package/dist/configs/vendor-rules/errors.js +92 -0
- package/dist/configs/vendor-rules/es6.d.ts +47 -0
- package/dist/configs/vendor-rules/es6.js +108 -0
- package/dist/configs/vendor-rules/imports.d.ts +41 -0
- package/dist/configs/vendor-rules/imports.js +119 -0
- package/dist/configs/vendor-rules/next-config.d.ts +16 -0
- package/dist/configs/vendor-rules/next-config.js +22 -0
- package/dist/configs/vendor-rules/react-hooks.d.ts +10 -0
- package/dist/configs/vendor-rules/react-hooks.js +17 -0
- package/dist/configs/vendor-rules/react.d.ts +228 -0
- package/dist/configs/vendor-rules/react.js +513 -0
- package/dist/configs/vendor-rules/strict.d.ts +4 -0
- package/dist/configs/vendor-rules/strict.js +9 -0
- package/dist/configs/vendor-rules/style.d.ts +34 -0
- package/dist/configs/vendor-rules/style.js +78 -0
- package/dist/configs/vendor-rules/typescript-disablings.d.ts +5 -0
- package/dist/configs/vendor-rules/typescript-disablings.js +13 -0
- package/dist/configs/vendor-rules/typescript.d.ts +40 -0
- package/dist/configs/vendor-rules/typescript.js +69 -0
- package/dist/configs/vendor-rules/variables.d.ts +28 -0
- package/dist/configs/vendor-rules/variables.js +39 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +25 -0
- package/dist/rules/jsx-text-as-child.d.ts +13 -0
- package/dist/rules/jsx-text-as-child.js +90 -0
- package/dist/rules/max-parent-import-depth.d.ts +3 -0
- package/dist/rules/max-parent-import-depth.js +50 -0
- package/dist/rules/prevent-mixing-external-and-internal-classes.d.ts +13 -0
- package/dist/rules/prevent-mixing-external-and-internal-classes.js +72 -0
- package/dist/rules/require-observer.d.ts +3 -0
- package/dist/rules/require-observer.js +138 -0
- package/dist/rules/stories-export-meta.d.ts +3 -0
- package/dist/rules/stories-export-meta.js +37 -0
- package/dist/rules/stories-export-typed.d.ts +3 -0
- package/dist/rules/stories-export-typed.js +51 -0
- package/dist/rules/strict-observable-components-declaration.d.ts +14 -0
- package/dist/rules/strict-observable-components-declaration.js +118 -0
- package/dist/utils/index.d.ts +1 -0
- package/dist/utils/index.js +1 -0
- package/dist/utils/parse-git-ignore.d.ts +2 -0
- package/dist/utils/parse-git-ignore.js +7 -0
- package/docs/rules/jsx-text-as-child.md +101 -0
- package/docs/rules/max-parent-import-depth.md +31 -0
- package/docs/rules/prevent-mixing-external-and-internal-classes.md +42 -0
- package/docs/rules/require-observer.md +43 -0
- package/docs/rules/stories-export-meta.md +37 -0
- package/docs/rules/stories-export-typed.md +42 -0
- package/docs/rules/strict-observable-components-declaration.md +57 -0
- package/package.json +91 -0
|
@@ -0,0 +1,513 @@
|
|
|
1
|
+
// This file contains code from the `eslint-config-airbnb` project
|
|
2
|
+
// Original author: Jake Teton-Landis (https://twitter.com/@jitl)
|
|
3
|
+
// License: MIT (see LICENSE-eslint-config-airbnb.md file)
|
|
4
|
+
const rules = {
|
|
5
|
+
/**
|
|
6
|
+
* react
|
|
7
|
+
* copied from
|
|
8
|
+
* https://github.com/airbnb/javascript/blob/c25bce83be4db06e6a221d79686c485cd2ed5d5d/packages/eslint-config-airbnb/rules/react-a11y.js
|
|
9
|
+
* */
|
|
10
|
+
'no-underscore-dangle': [
|
|
11
|
+
'error',
|
|
12
|
+
{
|
|
13
|
+
allowAfterThis: false,
|
|
14
|
+
allowAfterSuper: false,
|
|
15
|
+
enforceInMethodNames: true,
|
|
16
|
+
allow: ['__REDUX_DEVTOOLS_EXTENSION_COMPOSE__'],
|
|
17
|
+
},
|
|
18
|
+
],
|
|
19
|
+
// Prevent missing displayName in a React component definition
|
|
20
|
+
// https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/display-name.md
|
|
21
|
+
'react/display-name': ['off', { ignoreTranspilerName: false }],
|
|
22
|
+
// Enforce boolean attributes notation in JSX
|
|
23
|
+
// https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-boolean-value.md
|
|
24
|
+
'react/jsx-boolean-value': ['error', 'never', { always: [] }],
|
|
25
|
+
// Validate closing bracket location in JSX
|
|
26
|
+
// https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-closing-bracket-location.md
|
|
27
|
+
'react/jsx-closing-bracket-location': ['error', 'line-aligned'],
|
|
28
|
+
// Validate closing tag location in JSX
|
|
29
|
+
// https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-closing-tag-location.md
|
|
30
|
+
'react/jsx-closing-tag-location': 'error',
|
|
31
|
+
// Enforce or disallow spaces inside of curly braces in JSX attributes
|
|
32
|
+
// https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-curly-spacing.md
|
|
33
|
+
'react/jsx-curly-spacing': ['error', 'never', { allowMultiline: true }],
|
|
34
|
+
// Validate props indentation in JSX
|
|
35
|
+
// https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-indent-props.md
|
|
36
|
+
'react/jsx-indent-props': ['error', 2],
|
|
37
|
+
// Limit maximum of props on a single line in JSX
|
|
38
|
+
// https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-max-props-per-line.md
|
|
39
|
+
'react/jsx-max-props-per-line': ['error', { maximum: 1, when: 'multiline' }],
|
|
40
|
+
// Prevent usage of .bind() in JSX props
|
|
41
|
+
// https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-no-bind.md
|
|
42
|
+
'react/jsx-no-bind': [
|
|
43
|
+
'error',
|
|
44
|
+
{
|
|
45
|
+
ignoreRefs: true,
|
|
46
|
+
allowArrowFunctions: true,
|
|
47
|
+
allowFunctions: false,
|
|
48
|
+
allowBind: false,
|
|
49
|
+
ignoreDOMComponents: true,
|
|
50
|
+
},
|
|
51
|
+
],
|
|
52
|
+
// Enforce PascalCase for user-defined JSX components
|
|
53
|
+
// https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-pascal-case.md
|
|
54
|
+
'react/jsx-pascal-case': [
|
|
55
|
+
'error',
|
|
56
|
+
{
|
|
57
|
+
allowAllCaps: true,
|
|
58
|
+
ignore: [],
|
|
59
|
+
},
|
|
60
|
+
],
|
|
61
|
+
// Prevent variables used in JSX to be incorrectly marked as unused
|
|
62
|
+
// https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-uses-vars.md
|
|
63
|
+
'react/jsx-uses-vars': 'error',
|
|
64
|
+
// Prevent usage of dangerous JSX properties
|
|
65
|
+
// https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/no-danger.md
|
|
66
|
+
'react/no-danger': 'error',
|
|
67
|
+
// Prevent usage of deprecated methods
|
|
68
|
+
// https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/no-deprecated.md
|
|
69
|
+
'react/no-deprecated': ['error'],
|
|
70
|
+
// Prevent usage of setState in componentDidUpdate
|
|
71
|
+
// https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/no-did-update-set-state.md
|
|
72
|
+
'react/no-did-update-set-state': 'error',
|
|
73
|
+
// Prevent usage of setState in componentWillUpdate
|
|
74
|
+
// https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/no-will-update-set-state.md
|
|
75
|
+
'react/no-will-update-set-state': 'error',
|
|
76
|
+
// Prevent direct mutation of this.state
|
|
77
|
+
// https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/no-direct-mutation-state.md
|
|
78
|
+
'react/no-direct-mutation-state': 'off',
|
|
79
|
+
// Prevent usage of isMounted
|
|
80
|
+
// https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/no-is-mounted.md
|
|
81
|
+
'react/no-is-mounted': 'error',
|
|
82
|
+
// Prevent using string references
|
|
83
|
+
// https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/no-string-refs.md
|
|
84
|
+
'react/no-string-refs': 'error',
|
|
85
|
+
// Prevent usage of unknown DOM property
|
|
86
|
+
// https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/no-unknown-property.md
|
|
87
|
+
'react/no-unknown-property': 'error',
|
|
88
|
+
// Require ES6 class declarations over React.createClass
|
|
89
|
+
// https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/prefer-es6-class.md
|
|
90
|
+
'react/prefer-es6-class': ['error', 'always'],
|
|
91
|
+
// Require stateless functions when not using lifecycle methods, setState or ref
|
|
92
|
+
// https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/prefer-stateless-function.md
|
|
93
|
+
'react/prefer-stateless-function': ['error', { ignorePureComponents: true }],
|
|
94
|
+
// Require render() methods to return something
|
|
95
|
+
// https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/require-render-return.md
|
|
96
|
+
'react/require-render-return': 'error',
|
|
97
|
+
// Prevent extra closing tags for components without children
|
|
98
|
+
// https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/self-closing-comp.md
|
|
99
|
+
'react/self-closing-comp': 'error',
|
|
100
|
+
// Enforce component methods order
|
|
101
|
+
// https://github.com/jsx-eslint/eslint-plugin-react/blob/843d71a432baf0f01f598d7cf1eea75ad6896e4b/docs/rules/sort-comp.md
|
|
102
|
+
'react/sort-comp': [
|
|
103
|
+
'error',
|
|
104
|
+
{
|
|
105
|
+
order: [
|
|
106
|
+
'static-variables',
|
|
107
|
+
'static-methods',
|
|
108
|
+
'instance-variables',
|
|
109
|
+
'lifecycle',
|
|
110
|
+
'/^handle.+$/',
|
|
111
|
+
'/^on.+$/',
|
|
112
|
+
'getters',
|
|
113
|
+
'setters',
|
|
114
|
+
'/^(get|set)(?!(InitialState$|DefaultProps$|ChildContext$)).+$/',
|
|
115
|
+
'instance-methods',
|
|
116
|
+
'everything-else',
|
|
117
|
+
'rendering',
|
|
118
|
+
],
|
|
119
|
+
groups: {
|
|
120
|
+
lifecycle: [
|
|
121
|
+
'displayName',
|
|
122
|
+
'propTypes',
|
|
123
|
+
'contextTypes',
|
|
124
|
+
'childContextTypes',
|
|
125
|
+
'mixins',
|
|
126
|
+
'statics',
|
|
127
|
+
'defaultProps',
|
|
128
|
+
'constructor',
|
|
129
|
+
'getDefaultProps',
|
|
130
|
+
'getInitialState',
|
|
131
|
+
'state',
|
|
132
|
+
'getChildContext',
|
|
133
|
+
'getDerivedStateFromProps',
|
|
134
|
+
'componentWillMount',
|
|
135
|
+
'UNSAFE_componentWillMount',
|
|
136
|
+
'componentDidMount',
|
|
137
|
+
'componentWillReceiveProps',
|
|
138
|
+
'UNSAFE_componentWillReceiveProps',
|
|
139
|
+
'shouldComponentUpdate',
|
|
140
|
+
'componentWillUpdate',
|
|
141
|
+
'UNSAFE_componentWillUpdate',
|
|
142
|
+
'getSnapshotBeforeUpdate',
|
|
143
|
+
'componentDidUpdate',
|
|
144
|
+
'componentDidCatch',
|
|
145
|
+
'componentWillUnmount',
|
|
146
|
+
],
|
|
147
|
+
rendering: ['/^render.+$/', 'render'],
|
|
148
|
+
},
|
|
149
|
+
},
|
|
150
|
+
],
|
|
151
|
+
// Prevent missing parentheses around multilines JSX
|
|
152
|
+
// https://github.com/jsx-eslint/eslint-plugin-react/blob/843d71a432baf0f01f598d7cf1eea75ad6896e4b/docs/rules/jsx-wrap-multilines.md
|
|
153
|
+
'react/jsx-wrap-multilines': [
|
|
154
|
+
'error',
|
|
155
|
+
{
|
|
156
|
+
declaration: 'parens-new-line',
|
|
157
|
+
assignment: 'parens-new-line',
|
|
158
|
+
return: 'parens-new-line',
|
|
159
|
+
arrow: 'parens-new-line',
|
|
160
|
+
condition: 'parens-new-line',
|
|
161
|
+
logical: 'parens-new-line',
|
|
162
|
+
prop: 'parens-new-line',
|
|
163
|
+
},
|
|
164
|
+
],
|
|
165
|
+
// Require that the first prop in a JSX element be on a new line when the element is multiline
|
|
166
|
+
// https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-first-prop-new-line.md
|
|
167
|
+
'react/jsx-first-prop-new-line': ['error', 'multiline-multiprop'],
|
|
168
|
+
// Enforce spacing around jsx equals signs
|
|
169
|
+
// https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-equals-spacing.md
|
|
170
|
+
'react/jsx-equals-spacing': ['error', 'never'],
|
|
171
|
+
// Enforce JSX indentation
|
|
172
|
+
// https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-indent.md
|
|
173
|
+
'react/jsx-indent': ['error', 2],
|
|
174
|
+
// Disallow target="_blank" on links
|
|
175
|
+
// https://github.com/jsx-eslint/eslint-plugin-react/blob/ac102885765be5ff37847a871f239c6703e1c7cc/docs/rules/jsx-no-target-blank.md
|
|
176
|
+
'react/jsx-no-target-blank': ['error', { enforceDynamicLinks: 'always' }],
|
|
177
|
+
// only .jsx files may have JSX
|
|
178
|
+
// https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-filename-extension.md
|
|
179
|
+
'react/jsx-filename-extension': ['error', { extensions: ['.jsx'] }],
|
|
180
|
+
// prevent accidental JS comments from being injected into JSX as text
|
|
181
|
+
// https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-no-comment-textnodes.md
|
|
182
|
+
'react/jsx-no-comment-textnodes': 'error',
|
|
183
|
+
// disallow using React.render/ReactDOM.render's return value
|
|
184
|
+
// https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/no-render-return-value.md
|
|
185
|
+
'react/no-render-return-value': 'error',
|
|
186
|
+
// warn against using findDOMNode()
|
|
187
|
+
// https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/no-find-dom-node.md
|
|
188
|
+
'react/no-find-dom-node': 'error',
|
|
189
|
+
// Prevent problem with children and props.dangerouslySetInnerHTML
|
|
190
|
+
// https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/no-danger-with-children.md
|
|
191
|
+
'react/no-danger-with-children': 'error',
|
|
192
|
+
// Require style prop value be an object or var
|
|
193
|
+
// https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/style-prop-object.md
|
|
194
|
+
'react/style-prop-object': 'error',
|
|
195
|
+
// Prevent invalid characters from appearing in markup
|
|
196
|
+
// https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/no-unescaped-entities.md
|
|
197
|
+
'react/no-unescaped-entities': 'error',
|
|
198
|
+
// Prevent passing of children as props
|
|
199
|
+
// https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/no-children-prop.md
|
|
200
|
+
'react/no-children-prop': 'error',
|
|
201
|
+
// Validate whitespace in and around the JSX opening and closing brackets
|
|
202
|
+
// https://github.com/jsx-eslint/eslint-plugin-react/blob/843d71a432baf0f01f598d7cf1eea75ad6896e4b/docs/rules/jsx-tag-spacing.md
|
|
203
|
+
'react/jsx-tag-spacing': [
|
|
204
|
+
'error',
|
|
205
|
+
{
|
|
206
|
+
closingSlash: 'never',
|
|
207
|
+
beforeSelfClosing: 'always',
|
|
208
|
+
afterOpening: 'never',
|
|
209
|
+
beforeClosing: 'never',
|
|
210
|
+
},
|
|
211
|
+
],
|
|
212
|
+
// Enforce a defaultProps definition for every prop that is not a required prop
|
|
213
|
+
// https://github.com/jsx-eslint/eslint-plugin-react/blob/843d71a432baf0f01f598d7cf1eea75ad6896e4b/docs/rules/require-default-props.md
|
|
214
|
+
'react/require-default-props': [
|
|
215
|
+
'error',
|
|
216
|
+
{
|
|
217
|
+
forbidDefaultForRequired: true,
|
|
218
|
+
},
|
|
219
|
+
],
|
|
220
|
+
// Prevent void DOM elements from receiving children
|
|
221
|
+
// https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/void-dom-elements-no-children.md
|
|
222
|
+
'react/void-dom-elements-no-children': 'error',
|
|
223
|
+
// Prevent usage of shouldComponentUpdate when extending React.PureComponent
|
|
224
|
+
// https://github.com/jsx-eslint/eslint-plugin-react/blob/9e13ae2c51e44872b45cc15bf1ac3a72105bdd0e/docs/rules/no-redundant-should-component-update.md
|
|
225
|
+
'react/no-redundant-should-component-update': 'error',
|
|
226
|
+
// Prevent unused state values
|
|
227
|
+
// https://github.com/jsx-eslint/eslint-plugin-react/pull/1103/
|
|
228
|
+
'react/no-unused-state': 'error',
|
|
229
|
+
// Prevents common casing typos
|
|
230
|
+
// https://github.com/jsx-eslint/eslint-plugin-react/blob/73abadb697034b5ccb514d79fb4689836fe61f91/docs/rules/no-typos.md
|
|
231
|
+
'react/no-typos': 'error',
|
|
232
|
+
// Enforce curly braces or disallow unnecessary curly braces in JSX props and/or children
|
|
233
|
+
// https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-curly-brace-presence.md
|
|
234
|
+
'react/jsx-curly-brace-presence': ['error', { props: 'never', children: 'never' }],
|
|
235
|
+
// One JSX Element Per Line
|
|
236
|
+
// https://github.com/jsx-eslint/eslint-plugin-react/blob/843d71a432baf0f01f598d7cf1eea75ad6896e4b/docs/rules/jsx-one-expression-per-line.md
|
|
237
|
+
'react/jsx-one-expression-per-line': ['error', { allow: 'single-child' }],
|
|
238
|
+
// Prevent using this.state within a this.setState
|
|
239
|
+
// https://github.com/jsx-eslint/eslint-plugin-react/blob/843d71a432baf0f01f598d7cf1eea75ad6896e4b/docs/rules/no-access-state-in-setstate.md
|
|
240
|
+
'react/no-access-state-in-setstate': 'error',
|
|
241
|
+
// Prevent usage of button elements without an explicit type attribute
|
|
242
|
+
// https://github.com/jsx-eslint/eslint-plugin-react/blob/843d71a432baf0f01f598d7cf1eea75ad6896e4b/docs/rules/button-has-type.md
|
|
243
|
+
'react/button-has-type': [
|
|
244
|
+
'error',
|
|
245
|
+
{
|
|
246
|
+
button: true,
|
|
247
|
+
submit: true,
|
|
248
|
+
reset: false,
|
|
249
|
+
},
|
|
250
|
+
],
|
|
251
|
+
// Prevent this from being used in stateless functional components
|
|
252
|
+
// https://github.com/jsx-eslint/eslint-plugin-react/blob/843d71a432baf0f01f598d7cf1eea75ad6896e4b/docs/rules/no-this-in-sfc.md
|
|
253
|
+
'react/no-this-in-sfc': 'error',
|
|
254
|
+
// Disallow multiple spaces between inline JSX props
|
|
255
|
+
// https://github.com/jsx-eslint/eslint-plugin-react/blob/ac102885765be5ff37847a871f239c6703e1c7cc/docs/rules/jsx-props-no-multi-spaces.md
|
|
256
|
+
'react/jsx-props-no-multi-spaces': 'error',
|
|
257
|
+
// Enforce shorthand or standard form for React fragments
|
|
258
|
+
// https://github.com/jsx-eslint/eslint-plugin-react/blob/bc976b837abeab1dffd90ac6168b746a83fc83cc/docs/rules/jsx-fragments.md
|
|
259
|
+
'react/jsx-fragments': ['error', 'syntax'],
|
|
260
|
+
// Enforce linebreaks in curly braces in JSX attributes and expressions.
|
|
261
|
+
// https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-curly-newline.md
|
|
262
|
+
'react/jsx-curly-newline': [
|
|
263
|
+
'error',
|
|
264
|
+
{
|
|
265
|
+
multiline: 'consistent',
|
|
266
|
+
singleline: 'consistent',
|
|
267
|
+
},
|
|
268
|
+
],
|
|
269
|
+
// Disallow JSX props spreading
|
|
270
|
+
// https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-props-no-spreading.md
|
|
271
|
+
'react/jsx-props-no-spreading': [
|
|
272
|
+
'error',
|
|
273
|
+
{
|
|
274
|
+
html: 'enforce',
|
|
275
|
+
custom: 'enforce',
|
|
276
|
+
explicitSpread: 'ignore',
|
|
277
|
+
exceptions: [],
|
|
278
|
+
},
|
|
279
|
+
],
|
|
280
|
+
// Prevent usage of `javascript:` URLs
|
|
281
|
+
// https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-no-script-url.md
|
|
282
|
+
'react/jsx-no-script-url': [
|
|
283
|
+
'error',
|
|
284
|
+
[
|
|
285
|
+
{
|
|
286
|
+
name: 'Link',
|
|
287
|
+
props: ['to'],
|
|
288
|
+
},
|
|
289
|
+
],
|
|
290
|
+
],
|
|
291
|
+
// Disallow unnecessary fragments
|
|
292
|
+
// https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-no-useless-fragment.md
|
|
293
|
+
'react/jsx-no-useless-fragment': 'error',
|
|
294
|
+
// Prevent react contexts from taking non-stable values
|
|
295
|
+
// https://github.com/jsx-eslint/eslint-plugin-react/blob/e2eaadae316f9506d163812a09424eb42698470a/docs/rules/jsx-no-constructed-context-values.md
|
|
296
|
+
'react/jsx-no-constructed-context-values': 'error',
|
|
297
|
+
// Prevent creating unstable components inside components
|
|
298
|
+
// https://github.com/jsx-eslint/eslint-plugin-react/blob/c2a790a3472eea0f6de984bdc3ee2a62197417fb/docs/rules/no-unstable-nested-components.md
|
|
299
|
+
'react/no-unstable-nested-components': 'error',
|
|
300
|
+
// Enforce that namespaces are not used in React elements
|
|
301
|
+
// https://github.com/jsx-eslint/eslint-plugin-react/blob/8785c169c25b09b33c95655bf508cf46263bc53f/docs/rules/no-namespace.md
|
|
302
|
+
'react/no-namespace': 'error',
|
|
303
|
+
// Prefer exact proptype definitions
|
|
304
|
+
// https://github.com/jsx-eslint/eslint-plugin-react/blob/8785c169c25b09b33c95655bf508cf46263bc53f/docs/rules/prefer-exact-props.md
|
|
305
|
+
'react/prefer-exact-props': 'error',
|
|
306
|
+
// Lifecycle methods should be methods on the prototype, not class fields
|
|
307
|
+
// https://github.com/jsx-eslint/eslint-plugin-react/blob/21e01b61af7a38fc86d94f27eb66cda8054582ed/docs/rules/no-arrow-function-lifecycle.md
|
|
308
|
+
'react/no-arrow-function-lifecycle': 'error',
|
|
309
|
+
// Prevent usage of invalid attributes
|
|
310
|
+
// https://github.com/jsx-eslint/eslint-plugin-react/blob/21e01b61af7a38fc86d94f27eb66cda8054582ed/docs/rules/no-invalid-html-attribute.md
|
|
311
|
+
'react/no-invalid-html-attribute': 'error',
|
|
312
|
+
// Prevent declaring unused methods of component class
|
|
313
|
+
// https://github.com/jsx-eslint/eslint-plugin-react/blob/21e01b61af7a38fc86d94f27eb66cda8054582ed/docs/rules/no-unused-class-component-methods.md
|
|
314
|
+
'react/no-unused-class-component-methods': 'error',
|
|
315
|
+
// Ensure destructuring and symmetric naming of useState hook value and setter variables
|
|
316
|
+
// https://github.com/jsx-eslint/eslint-plugin-react/blob/c8833f301314dab3e79ef7ac4cf863e4d5fa0019/docs/rules/hook-use-state.md
|
|
317
|
+
'react/hook-use-state': 'error',
|
|
318
|
+
// Enforce sandbox attribute on iframe elements
|
|
319
|
+
// https://github.com/jsx-eslint/eslint-plugin-react/blob/c8833f301314dab3e79ef7ac4cf863e4d5fa0019/docs/rules/iframe-missing-sandbox.md
|
|
320
|
+
'react/iframe-missing-sandbox': 'error',
|
|
321
|
+
/**
|
|
322
|
+
* react-a11y
|
|
323
|
+
* copied from
|
|
324
|
+
* https://github.com/airbnb/javascript/blob/c25bce83be4db06e6a221d79686c485cd2ed5d5d/packages/eslint-config-airbnb/rules/react-a11y.js
|
|
325
|
+
* */
|
|
326
|
+
// Enforce that all elements that require alternative text have meaningful information
|
|
327
|
+
// https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/master/docs/rules/alt-text.md
|
|
328
|
+
'jsx-a11y/alt-text': [
|
|
329
|
+
'error',
|
|
330
|
+
{
|
|
331
|
+
elements: ['img', 'object', 'area', 'input[type="image"]'],
|
|
332
|
+
img: [],
|
|
333
|
+
object: [],
|
|
334
|
+
area: [],
|
|
335
|
+
'input[type="image"]': [],
|
|
336
|
+
},
|
|
337
|
+
],
|
|
338
|
+
// Enforce that anchors have content
|
|
339
|
+
// https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/master/docs/rules/anchor-has-content.md
|
|
340
|
+
'jsx-a11y/anchor-has-content': ['error', { components: [] }],
|
|
341
|
+
// ensure <a> tags are valid
|
|
342
|
+
// https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/0745af376cdc8686d85a361ce36952b1fb1ccf6e/docs/rules/anchor-is-valid.md
|
|
343
|
+
'jsx-a11y/anchor-is-valid': [
|
|
344
|
+
'error',
|
|
345
|
+
{
|
|
346
|
+
components: ['Link'],
|
|
347
|
+
specialLink: ['to'],
|
|
348
|
+
aspects: ['noHref', 'invalidHref', 'preferButton'],
|
|
349
|
+
},
|
|
350
|
+
],
|
|
351
|
+
// elements with aria-activedescendant must be tabbable
|
|
352
|
+
// https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/master/docs/rules/aria-activedescendant-has-tabindex.md
|
|
353
|
+
'jsx-a11y/aria-activedescendant-has-tabindex': 'error',
|
|
354
|
+
// Enforce all aria-* props are valid.
|
|
355
|
+
// https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/master/docs/rules/aria-props.md
|
|
356
|
+
'jsx-a11y/aria-props': 'error',
|
|
357
|
+
// Enforce ARIA state and property values are valid.
|
|
358
|
+
// https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/master/docs/rules/aria-proptypes.md
|
|
359
|
+
'jsx-a11y/aria-proptypes': 'error',
|
|
360
|
+
// Require ARIA roles to be valid and non-abstract
|
|
361
|
+
// https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/master/docs/rules/aria-role.md
|
|
362
|
+
'jsx-a11y/aria-role': ['error', { ignoreNonDOM: false }],
|
|
363
|
+
// Enforce that elements that do not support ARIA roles, states, and
|
|
364
|
+
// properties do not have those attributes.
|
|
365
|
+
// https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/master/docs/rules/aria-unsupported-elements.md
|
|
366
|
+
'jsx-a11y/aria-unsupported-elements': 'error',
|
|
367
|
+
// Ensure the autocomplete attribute is correct and suitable for the form field it is used with
|
|
368
|
+
// https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/29c68596b15c4ff0a40daae6d4a2670e36e37d35/docs/rules/autocomplete-valid.md
|
|
369
|
+
'jsx-a11y/autocomplete-valid': [
|
|
370
|
+
'off',
|
|
371
|
+
{
|
|
372
|
+
inputComponents: [],
|
|
373
|
+
},
|
|
374
|
+
],
|
|
375
|
+
// require onClick be accompanied by onKeyUp/onKeyDown/onKeyPress
|
|
376
|
+
// https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/master/docs/rules/click-events-have-key-events.md
|
|
377
|
+
'jsx-a11y/click-events-have-key-events': 'error',
|
|
378
|
+
// ensure <hX> tags have content and are not aria-hidden
|
|
379
|
+
// https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/master/docs/rules/heading-has-content.md
|
|
380
|
+
'jsx-a11y/heading-has-content': ['error', { components: [''] }],
|
|
381
|
+
// require HTML elements to have a "lang" prop
|
|
382
|
+
// https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/master/docs/rules/html-has-lang.md
|
|
383
|
+
'jsx-a11y/html-has-lang': 'error',
|
|
384
|
+
// ensure iframe elements have a unique title
|
|
385
|
+
// https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/master/docs/rules/iframe-has-title.md
|
|
386
|
+
'jsx-a11y/iframe-has-title': 'error',
|
|
387
|
+
// Prevent img alt text from containing redundant words like "image", "picture", or "photo"
|
|
388
|
+
// https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/master/docs/rules/img-redundant-alt.md
|
|
389
|
+
'jsx-a11y/img-redundant-alt': 'error',
|
|
390
|
+
// Elements with an interactive role and interaction handlers must be focusable
|
|
391
|
+
// https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/master/docs/rules/interactive-supports-focus.md
|
|
392
|
+
'jsx-a11y/interactive-supports-focus': 'error',
|
|
393
|
+
// Enforce that a label tag has a text label and an associated control.
|
|
394
|
+
// https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/b800f40a2a69ad48015ae9226fbe879f946757ed/docs/rules/label-has-associated-control.md
|
|
395
|
+
'jsx-a11y/label-has-associated-control': [
|
|
396
|
+
'error',
|
|
397
|
+
{
|
|
398
|
+
labelComponents: [],
|
|
399
|
+
labelAttributes: [],
|
|
400
|
+
controlComponents: [],
|
|
401
|
+
assert: 'both',
|
|
402
|
+
depth: 25,
|
|
403
|
+
},
|
|
404
|
+
],
|
|
405
|
+
// require HTML element's lang prop to be valid
|
|
406
|
+
// https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/master/docs/rules/lang.md
|
|
407
|
+
'jsx-a11y/lang': 'error',
|
|
408
|
+
// media elements must have captions
|
|
409
|
+
// https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/master/docs/rules/media-has-caption.md
|
|
410
|
+
'jsx-a11y/media-has-caption': [
|
|
411
|
+
'error',
|
|
412
|
+
{
|
|
413
|
+
audio: [],
|
|
414
|
+
video: [],
|
|
415
|
+
track: [],
|
|
416
|
+
},
|
|
417
|
+
],
|
|
418
|
+
// require that mouseover/out come with focus/blur, for keyboard-only users
|
|
419
|
+
// https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/master/docs/rules/mouse-events-have-key-events.md
|
|
420
|
+
'jsx-a11y/mouse-events-have-key-events': 'error',
|
|
421
|
+
// Prevent use of `accessKey`
|
|
422
|
+
// https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/master/docs/rules/no-access-key.md
|
|
423
|
+
'jsx-a11y/no-access-key': 'error',
|
|
424
|
+
// prevent distracting elements, like <marquee> and <blink>
|
|
425
|
+
// https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/master/docs/rules/no-distracting-elements.md
|
|
426
|
+
'jsx-a11y/no-distracting-elements': [
|
|
427
|
+
'error',
|
|
428
|
+
{
|
|
429
|
+
elements: ['marquee', 'blink'],
|
|
430
|
+
},
|
|
431
|
+
],
|
|
432
|
+
// WAI-ARIA roles should not be used to convert an interactive element to non-interactive
|
|
433
|
+
// https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/master/docs/rules/no-interactive-element-to-noninteractive-role.md
|
|
434
|
+
'jsx-a11y/no-interactive-element-to-noninteractive-role': [
|
|
435
|
+
'error',
|
|
436
|
+
{
|
|
437
|
+
tr: ['none', 'presentation'],
|
|
438
|
+
},
|
|
439
|
+
],
|
|
440
|
+
// A non-interactive element does not support event handlers (mouse and key handlers)
|
|
441
|
+
// https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/master/docs/rules/no-noninteractive-element-interactions.md
|
|
442
|
+
'jsx-a11y/no-noninteractive-element-interactions': [
|
|
443
|
+
'error',
|
|
444
|
+
{
|
|
445
|
+
handlers: ['onClick', 'onMouseDown', 'onMouseUp', 'onKeyPress', 'onKeyDown', 'onKeyUp'],
|
|
446
|
+
},
|
|
447
|
+
],
|
|
448
|
+
// WAI-ARIA roles should not be used to convert a non-interactive element to interactive
|
|
449
|
+
// https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/master/docs/rules/no-noninteractive-element-to-interactive-role.md
|
|
450
|
+
'jsx-a11y/no-noninteractive-element-to-interactive-role': [
|
|
451
|
+
'error',
|
|
452
|
+
{
|
|
453
|
+
ul: ['listbox', 'menu', 'menubar', 'radiogroup', 'tablist', 'tree', 'treegrid'],
|
|
454
|
+
ol: ['listbox', 'menu', 'menubar', 'radiogroup', 'tablist', 'tree', 'treegrid'],
|
|
455
|
+
li: ['menuitem', 'option', 'row', 'tab', 'treeitem'],
|
|
456
|
+
table: ['grid'],
|
|
457
|
+
td: ['gridcell'],
|
|
458
|
+
},
|
|
459
|
+
],
|
|
460
|
+
// Tab key navigation should be limited to elements on the page that can be interacted with.
|
|
461
|
+
// https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/master/docs/rules/no-noninteractive-tabindex.md
|
|
462
|
+
'jsx-a11y/no-noninteractive-tabindex': [
|
|
463
|
+
'error',
|
|
464
|
+
{
|
|
465
|
+
tags: [],
|
|
466
|
+
roles: ['tabpanel'],
|
|
467
|
+
allowExpressionValues: true,
|
|
468
|
+
},
|
|
469
|
+
],
|
|
470
|
+
// ensure HTML elements do not specify redundant ARIA roles
|
|
471
|
+
// https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/master/docs/rules/no-redundant-roles.md
|
|
472
|
+
'jsx-a11y/no-redundant-roles': [
|
|
473
|
+
'error',
|
|
474
|
+
{
|
|
475
|
+
nav: ['navigation'],
|
|
476
|
+
},
|
|
477
|
+
],
|
|
478
|
+
// Enforce that DOM elements without semantic behavior not have interaction handlers
|
|
479
|
+
// https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/master/docs/rules/no-static-element-interactions.md
|
|
480
|
+
'jsx-a11y/no-static-element-interactions': [
|
|
481
|
+
'error',
|
|
482
|
+
{
|
|
483
|
+
handlers: ['onClick', 'onMouseDown', 'onMouseUp', 'onKeyPress', 'onKeyDown', 'onKeyUp'],
|
|
484
|
+
},
|
|
485
|
+
],
|
|
486
|
+
// Enforce that elements with ARIA roles must have all required attributes
|
|
487
|
+
// for that role.
|
|
488
|
+
// https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/master/docs/rules/role-has-required-aria-props.md
|
|
489
|
+
'jsx-a11y/role-has-required-aria-props': 'error',
|
|
490
|
+
// Enforce that elements with explicit or implicit roles defined contain
|
|
491
|
+
// only aria-* properties supported by that role.
|
|
492
|
+
// https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/master/docs/rules/role-supports-aria-props.md
|
|
493
|
+
'jsx-a11y/role-supports-aria-props': 'error',
|
|
494
|
+
// only allow <th> to have the "scope" attr
|
|
495
|
+
// https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/master/docs/rules/scope.md
|
|
496
|
+
'jsx-a11y/scope': 'error',
|
|
497
|
+
// Enforce tabIndex value is not greater than zero.
|
|
498
|
+
// https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/master/docs/rules/tabindex-no-positive.md
|
|
499
|
+
'jsx-a11y/tabindex-no-positive': 'error',
|
|
500
|
+
// ----------------------------------------------------
|
|
501
|
+
// Rules that no longer exist in eslint-plugin-jsx-a11y
|
|
502
|
+
// ----------------------------------------------------
|
|
503
|
+
// Ensures anchor text is not ambiguous
|
|
504
|
+
// https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/93f78856655696a55309440593e0948c6fb96134/docs/rules/anchor-ambiguous-text.md
|
|
505
|
+
'jsx-a11y/anchor-ambiguous-text': 'error',
|
|
506
|
+
// Enforce that aria-hidden="true" is not set on focusable elements.
|
|
507
|
+
// https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/93f78856655696a55309440593e0948c6fb96134/docs/rules/no-aria-hidden-on-focusable.md
|
|
508
|
+
'jsx-a11y/no-aria-hidden-on-focusable': 'error',
|
|
509
|
+
// Enforces using semantic DOM elements over the ARIA role property.
|
|
510
|
+
// https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/93f78856655696a55309440593e0948c6fb96134/docs/rules/prefer-tag-over-role.md
|
|
511
|
+
'jsx-a11y/prefer-tag-over-role': 'error',
|
|
512
|
+
};
|
|
513
|
+
export default rules;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
// This file contains code from the `eslint-config-airbnb` project
|
|
2
|
+
// Original author: Jake Teton-Landis (https://twitter.com/@jitl)
|
|
3
|
+
// License: MIT (see LICENSE-eslint-config-airbnb.md file)
|
|
4
|
+
// Permalink: https://github.com/airbnb/javascript/blob/c25bce83be4db06e6a221d79686c485cd2ed5d5d/packages/eslint-config-airbnb-base/rules/strict.js
|
|
5
|
+
const rules = {
|
|
6
|
+
// babel inserts `'use strict';` for us
|
|
7
|
+
strict: ['error', 'never'],
|
|
8
|
+
};
|
|
9
|
+
export default rules;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
declare const rules: {
|
|
2
|
+
'func-names': "error";
|
|
3
|
+
'logical-assignment-operators': ["error", string, {
|
|
4
|
+
enforceForIfStatements: boolean;
|
|
5
|
+
}];
|
|
6
|
+
'new-cap': ["error", {
|
|
7
|
+
newIsCap: boolean;
|
|
8
|
+
newIsCapExceptions: never[];
|
|
9
|
+
capIsNew: boolean;
|
|
10
|
+
capIsNewExceptions: string[];
|
|
11
|
+
}];
|
|
12
|
+
'no-bitwise': "error";
|
|
13
|
+
'no-continue': "error";
|
|
14
|
+
'no-lonely-if': "error";
|
|
15
|
+
'no-multi-assign': ["error"];
|
|
16
|
+
'no-nested-ternary': "error";
|
|
17
|
+
'no-plusplus': "error";
|
|
18
|
+
'no-underscore-dangle': ["error", {
|
|
19
|
+
allow: never[];
|
|
20
|
+
allowAfterThis: boolean;
|
|
21
|
+
allowAfterSuper: boolean;
|
|
22
|
+
enforceInMethodNames: boolean;
|
|
23
|
+
}];
|
|
24
|
+
'no-unneeded-ternary': ["error", {
|
|
25
|
+
defaultAssignment: boolean;
|
|
26
|
+
}];
|
|
27
|
+
'one-var': ["error", string];
|
|
28
|
+
'operator-assignment': ["error", string];
|
|
29
|
+
'prefer-exponentiation-operator': "error";
|
|
30
|
+
'prefer-object-spread': "error";
|
|
31
|
+
'require-jsdoc': "off";
|
|
32
|
+
'unicode-bom': ["error", string];
|
|
33
|
+
};
|
|
34
|
+
export default rules;
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
// This file contains code from the `eslint-config-airbnb` project
|
|
2
|
+
// Original author: Jake Teton-Landis (https://twitter.com/@jitl)
|
|
3
|
+
// License: MIT (see LICENSE-eslint-config-airbnb.md file)
|
|
4
|
+
// Permalink: https://github.com/airbnb/javascript/blob/c25bce83be4db06e6a221d79686c485cd2ed5d5d/packages/eslint-config-airbnb-base/rules/style.js
|
|
5
|
+
const rules = {
|
|
6
|
+
// require function expressions to have a name
|
|
7
|
+
// https://eslint.org/docs/rules/func-names
|
|
8
|
+
'func-names': 'error',
|
|
9
|
+
// Require or disallow logical assignment logical operator shorthand
|
|
10
|
+
// https://eslint.org/docs/latest/rules/logical-assignment-operators
|
|
11
|
+
'logical-assignment-operators': [
|
|
12
|
+
'error',
|
|
13
|
+
'always',
|
|
14
|
+
{
|
|
15
|
+
enforceForIfStatements: true,
|
|
16
|
+
},
|
|
17
|
+
],
|
|
18
|
+
// require a capital letter for constructors
|
|
19
|
+
'new-cap': [
|
|
20
|
+
'error',
|
|
21
|
+
{
|
|
22
|
+
newIsCap: true,
|
|
23
|
+
newIsCapExceptions: [],
|
|
24
|
+
capIsNew: false,
|
|
25
|
+
capIsNewExceptions: ['Immutable.Map', 'Immutable.Set', 'Immutable.List'],
|
|
26
|
+
},
|
|
27
|
+
],
|
|
28
|
+
// disallow use of bitwise operators
|
|
29
|
+
// https://eslint.org/docs/rules/no-bitwise
|
|
30
|
+
'no-bitwise': 'error',
|
|
31
|
+
// disallow use of the continue statement
|
|
32
|
+
// https://eslint.org/docs/rules/no-continue
|
|
33
|
+
'no-continue': 'error',
|
|
34
|
+
// disallow if as the only statement in an else block
|
|
35
|
+
// https://eslint.org/docs/rules/no-lonely-if
|
|
36
|
+
'no-lonely-if': 'error',
|
|
37
|
+
// disallow use of chained assignment expressions
|
|
38
|
+
// https://eslint.org/docs/rules/no-multi-assign
|
|
39
|
+
'no-multi-assign': ['error'],
|
|
40
|
+
// disallow nested ternary expressions
|
|
41
|
+
'no-nested-ternary': 'error',
|
|
42
|
+
// disallow use of unary operators, ++ and --
|
|
43
|
+
// https://eslint.org/docs/rules/no-plusplus
|
|
44
|
+
'no-plusplus': 'error',
|
|
45
|
+
// disallow dangling underscores in identifiers
|
|
46
|
+
// https://eslint.org/docs/rules/no-underscore-dangle
|
|
47
|
+
'no-underscore-dangle': [
|
|
48
|
+
'error',
|
|
49
|
+
{
|
|
50
|
+
allow: [],
|
|
51
|
+
allowAfterThis: false,
|
|
52
|
+
allowAfterSuper: false,
|
|
53
|
+
enforceInMethodNames: true,
|
|
54
|
+
},
|
|
55
|
+
],
|
|
56
|
+
// disallow the use of Boolean literals in conditional expressions
|
|
57
|
+
// also, prefer `a || b` over `a ? a : b`
|
|
58
|
+
// https://eslint.org/docs/rules/no-unneeded-ternary
|
|
59
|
+
'no-unneeded-ternary': ['error', { defaultAssignment: false }],
|
|
60
|
+
// allow just one var statement per function
|
|
61
|
+
'one-var': ['error', 'never'],
|
|
62
|
+
// require assignment operator shorthand where possible or prohibit it entirely
|
|
63
|
+
// https://eslint.org/docs/rules/operator-assignment
|
|
64
|
+
'operator-assignment': ['error', 'always'],
|
|
65
|
+
// Disallow the use of Math.pow in favor of the ** operator
|
|
66
|
+
// https://eslint.org/docs/rules/prefer-exponentiation-operator
|
|
67
|
+
'prefer-exponentiation-operator': 'error',
|
|
68
|
+
// Prefer use of an object spread over Object.assign
|
|
69
|
+
// https://eslint.org/docs/rules/prefer-object-spread
|
|
70
|
+
'prefer-object-spread': 'error',
|
|
71
|
+
// do not require jsdoc
|
|
72
|
+
// https://eslint.org/docs/rules/require-jsdoc
|
|
73
|
+
'require-jsdoc': 'off',
|
|
74
|
+
// require or disallow the Unicode Byte Order Mark
|
|
75
|
+
// https://eslint.org/docs/rules/unicode-bom
|
|
76
|
+
'unicode-bom': ['error', 'never'],
|
|
77
|
+
};
|
|
78
|
+
export default rules;
|