@moccu/eslint-config 0.5.0 → 0.8.0
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/.github/workflows/build.yml +6 -4
- package/.nvmrc +1 -1
- package/README.md +13 -41
- package/defaults/sort-class-members.js +0 -2
- package/helper/index.js +0 -1
- package/index.js +26 -197
- package/package.json +8 -6
- package/test/core.js +9 -18
- package/test/helper.js +0 -1
- package/test/index.js +0 -1
- package/react-proptypes.js +0 -20
- package/react.js +0 -81
|
@@ -4,14 +4,18 @@ on: push
|
|
|
4
4
|
jobs:
|
|
5
5
|
build:
|
|
6
6
|
runs-on: ubuntu-latest
|
|
7
|
+
permissions:
|
|
8
|
+
contents: read
|
|
9
|
+
id-token: write
|
|
10
|
+
packages: write
|
|
7
11
|
steps:
|
|
8
12
|
- name: Checkout 🛎️
|
|
9
|
-
uses: actions/checkout@
|
|
13
|
+
uses: actions/checkout@v7
|
|
10
14
|
with:
|
|
11
15
|
persist-credentials: false
|
|
12
16
|
|
|
13
17
|
- name: Setup 🔌
|
|
14
|
-
uses: actions/setup-node@
|
|
18
|
+
uses: actions/setup-node@v6
|
|
15
19
|
with:
|
|
16
20
|
node-version-file: '.nvmrc'
|
|
17
21
|
registry-url: https://registry.npmjs.org/
|
|
@@ -25,8 +29,6 @@ jobs:
|
|
|
25
29
|
- name: Publish 🚀
|
|
26
30
|
if: startsWith(github.ref, 'refs/tags/')
|
|
27
31
|
run: npm publish --access public
|
|
28
|
-
env:
|
|
29
|
-
NODE_AUTH_TOKEN: ${{secrets.NODE_AUTH_TOKEN}}
|
|
30
32
|
|
|
31
33
|
- name: Publish to GitHub 🚀
|
|
32
34
|
if: startsWith(github.ref, 'refs/tags/')
|
package/.nvmrc
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
lts/*
|
package/README.md
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
# eslint-config-moccu
|
|
2
2
|
|
|
3
|
-
](https://github.com/moccu/eslint-config-moccu/actions)
|
|
4
4
|
|
|
5
5
|
|
|
6
|
-
The eslint config we use at
|
|
6
|
+
The eslint config we use at Moccu
|
|
7
7
|
|
|
8
8
|
## Installation
|
|
9
9
|
|
|
@@ -13,49 +13,21 @@ $ npm install --save-dev @moccu/eslint-config
|
|
|
13
13
|
|
|
14
14
|
## Usage
|
|
15
15
|
|
|
16
|
-
### Base
|
|
17
|
-
|
|
18
|
-
This is a customized ruleset based on the [eslint recommended](https://eslint.org/docs/rules/)
|
|
19
|
-
rules.
|
|
20
|
-
|
|
21
|
-
```js
|
|
22
|
-
{
|
|
23
|
-
"extends": [
|
|
24
|
-
"@moccu/eslint-config"
|
|
25
|
-
],
|
|
26
|
-
"rules": {
|
|
27
|
-
// Additional rules...
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
```
|
|
31
|
-
|
|
32
|
-
### React
|
|
33
|
-
|
|
34
|
-
This is a customized ruleset based on the [eslint-plugin-react](https://github.com/yannickcr/eslint-plugin-react)
|
|
35
|
-
rules.
|
|
36
|
-
Separately there is a ruleset for proptypes-validation in `@moccu/eslint-config/react-proptypes`.
|
|
37
|
-
|
|
38
16
|
```js
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
],
|
|
45
|
-
|
|
46
|
-
|
|
17
|
+
// eslint.config.js
|
|
18
|
+
const {defineConfig} = require('eslint/config');
|
|
19
|
+
const moccu = require('@moccu/eslint-config');
|
|
20
|
+
|
|
21
|
+
module.exports = defineConfig([
|
|
22
|
+
moccu.configs['recommended'],
|
|
23
|
+
{
|
|
24
|
+
rules: {
|
|
25
|
+
semi: ['warn', 'always']
|
|
26
|
+
}
|
|
47
27
|
}
|
|
48
|
-
|
|
28
|
+
]);
|
|
49
29
|
```
|
|
50
30
|
|
|
51
|
-
## Contribute
|
|
52
|
-
|
|
53
|
-
* Add / Edit rules after agreements with developers at Moccu
|
|
54
|
-
* Run tests using `npm test`
|
|
55
|
-
* Set new version in [package.json](https://github.com/moccu/eslint-config-moccu/blob/master/package.json)
|
|
56
|
-
* Publish new version on npm using `npm publish --access=public`
|
|
57
|
-
* Add github release and tag including release notes
|
|
58
|
-
|
|
59
31
|
## License
|
|
60
32
|
|
|
61
33
|
[MIT](./LICENSE)
|
package/helper/index.js
CHANGED
package/index.js
CHANGED
|
@@ -1,74 +1,21 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
|
|
4
3
|
const
|
|
5
|
-
{CLASS_MEMBER_GROUPS, CLASS_MEMBER_ORDER} = require('./defaults/sort-class-members')
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
extends: [
|
|
11
|
-
'eslint:recommended'
|
|
12
|
-
],
|
|
13
|
-
plugins: [
|
|
14
|
-
'sort-class-members'
|
|
15
|
-
],
|
|
16
|
-
rules: {
|
|
4
|
+
{CLASS_MEMBER_GROUPS, CLASS_MEMBER_ORDER} = require('./defaults/sort-class-members'),
|
|
5
|
+
js = require('@eslint/js'),
|
|
6
|
+
globals = require('globals'),
|
|
7
|
+
sortClassMembers = require('eslint-plugin-sort-class-members'),
|
|
8
|
+
rules = {
|
|
17
9
|
'accessor-pairs': 'error',
|
|
18
|
-
// 'array-bracket-newline': 'off',
|
|
19
|
-
'array-bracket-spacing': 'error',
|
|
20
10
|
'array-callback-return': 'error',
|
|
21
|
-
// 'array-element-newline': 'off',
|
|
22
|
-
// 'arrow-body-style': 'off',
|
|
23
|
-
// 'arrow-parens': 'off',
|
|
24
|
-
'arrow-spacing': [
|
|
25
|
-
'error', {
|
|
26
|
-
'after': true,
|
|
27
|
-
'before': true
|
|
28
|
-
}
|
|
29
|
-
],
|
|
30
11
|
'block-scoped-var': 'error',
|
|
31
|
-
'block-spacing': [
|
|
32
|
-
'error', 'never'
|
|
33
|
-
],
|
|
34
|
-
'brace-style': [
|
|
35
|
-
'error',
|
|
36
|
-
'1tbs', {
|
|
37
|
-
'allowSingleLine': true
|
|
38
|
-
}
|
|
39
|
-
],
|
|
40
|
-
'callback-return': 'error',
|
|
41
|
-
// 'camelcase': 'off',
|
|
42
|
-
// 'capitalized-comments': 'off',
|
|
43
|
-
// 'class-methods-use-this': 'off',
|
|
44
|
-
// 'comma-dangle': 'off',
|
|
45
|
-
'comma-spacing': [
|
|
46
|
-
'error', {
|
|
47
|
-
'after': true,
|
|
48
|
-
'before': false
|
|
49
|
-
}
|
|
50
|
-
],
|
|
51
|
-
'comma-style': [
|
|
52
|
-
'error', 'last'
|
|
53
|
-
],
|
|
54
12
|
'complexity': 'error',
|
|
55
|
-
'computed-property-spacing': [
|
|
56
|
-
'error', 'never'
|
|
57
|
-
],
|
|
58
|
-
// 'consistent-return': 'off',
|
|
59
13
|
'consistent-this': [
|
|
60
14
|
2, 'self'
|
|
61
15
|
],
|
|
62
16
|
'curly': 'error',
|
|
63
|
-
// 'default-case': 'off',
|
|
64
|
-
'dot-location': [
|
|
65
|
-
'error', 'property'
|
|
66
|
-
],
|
|
67
17
|
'dot-notation': 'error',
|
|
68
|
-
'eol-last': 'error',
|
|
69
18
|
'eqeqeq': 'error',
|
|
70
|
-
// 'for-direction': 'error',
|
|
71
|
-
// 'func-call-spacing': 'off',
|
|
72
19
|
'func-name-matching': 'error',
|
|
73
20
|
'func-names': [
|
|
74
21
|
'error', 'never'
|
|
@@ -79,35 +26,9 @@ module.exports = {
|
|
|
79
26
|
'allowArrowFunctions': true
|
|
80
27
|
}
|
|
81
28
|
],
|
|
82
|
-
// 'function-paren-newline': 'off',
|
|
83
|
-
'generator-star-spacing': 'error',
|
|
84
|
-
// 'getter-return': 'error',
|
|
85
|
-
// 'global-require': 'off',
|
|
86
29
|
'guard-for-in': 'error',
|
|
87
|
-
'handle-callback-err': 'error',
|
|
88
|
-
'id-blacklist': 'error',
|
|
89
|
-
// 'id-length': 'off',
|
|
90
30
|
'id-match': 'error',
|
|
91
|
-
// 'implicit-arrow-linebreak': 'off',
|
|
92
|
-
// 'indent': 'off',
|
|
93
|
-
// 'indent-legacy': 'off',
|
|
94
|
-
// 'init-declarations': 'off',
|
|
95
|
-
'jsx-quotes': 'error',
|
|
96
|
-
'key-spacing': 'error',
|
|
97
|
-
'keyword-spacing': [
|
|
98
|
-
2, {}
|
|
99
|
-
],
|
|
100
|
-
// 'line-comment-position': 'off',
|
|
101
|
-
'linebreak-style': [
|
|
102
|
-
'error', 'unix'
|
|
103
|
-
],
|
|
104
|
-
'lines-around-comment': 'error',
|
|
105
|
-
'lines-around-directive': 'error',
|
|
106
|
-
'lines-between-class-members': [
|
|
107
|
-
'error', 'always'
|
|
108
|
-
],
|
|
109
31
|
'max-depth': 'error',
|
|
110
|
-
// 'max-len': 'off',
|
|
111
32
|
'max-lines': [
|
|
112
33
|
'error', {
|
|
113
34
|
'max': 350,
|
|
@@ -115,37 +36,20 @@ module.exports = {
|
|
|
115
36
|
}
|
|
116
37
|
],
|
|
117
38
|
'max-nested-callbacks': 'error',
|
|
118
|
-
// 'max-params': 'off',
|
|
119
|
-
// 'max-statements': 'off',
|
|
120
|
-
'max-statements-per-line': 'error',
|
|
121
|
-
'multiline-comment-style': [
|
|
122
|
-
'error', 'separate-lines'
|
|
123
|
-
],
|
|
124
|
-
// 'multiline-ternary': 'off',
|
|
125
|
-
// 'new-parens': 'error',
|
|
126
|
-
// 'newline-after-var': 'off',
|
|
127
|
-
// 'newline-before-return': 'off',
|
|
128
|
-
// 'newline-per-chained-call': 'off',
|
|
129
39
|
'no-alert': 'error',
|
|
130
40
|
'no-array-constructor': 'error',
|
|
131
41
|
'no-await-in-loop': 'error',
|
|
132
42
|
'no-bitwise': 'error',
|
|
133
|
-
'no-buffer-constructor': 'error',
|
|
134
43
|
'no-caller': 'error',
|
|
135
|
-
// 'no-catch-shadow': 'error',
|
|
136
|
-
'no-confusing-arrow': 'error',
|
|
137
44
|
'no-continue': 'error',
|
|
138
45
|
'no-div-regex': 'error',
|
|
139
46
|
'no-duplicate-imports': 'error',
|
|
140
|
-
// 'no-else-return': 'off',
|
|
141
47
|
'no-empty-function': 'error',
|
|
142
48
|
'no-eq-null': 'error',
|
|
143
49
|
'no-eval': 'error',
|
|
144
50
|
'no-extend-native': 'error',
|
|
145
51
|
'no-extra-bind': 'error',
|
|
146
52
|
'no-extra-label': 'error',
|
|
147
|
-
// 'no-extra-parens': 'off',
|
|
148
|
-
'no-floating-decimal': 'error',
|
|
149
53
|
'no-implicit-coercion': [
|
|
150
54
|
'error', {
|
|
151
55
|
'boolean': false,
|
|
@@ -155,154 +59,79 @@ module.exports = {
|
|
|
155
59
|
],
|
|
156
60
|
'no-implicit-globals': 'error',
|
|
157
61
|
'no-implied-eval': 'error',
|
|
158
|
-
// 'no-inline-comments': 'off',
|
|
159
62
|
'no-inner-declarations': [
|
|
160
63
|
'error', 'functions'
|
|
161
64
|
],
|
|
162
|
-
// 'no-invalid-this': 'off',
|
|
163
65
|
'no-iterator': 'error',
|
|
164
66
|
'no-label-var': 'error',
|
|
165
67
|
'no-labels': 'error',
|
|
166
68
|
'no-lone-blocks': 'error',
|
|
167
69
|
'no-lonely-if': 'error',
|
|
168
70
|
'no-loop-func': 'error',
|
|
169
|
-
// 'no-magic-numbers': 'off',
|
|
170
|
-
// 'no-mixed-operators': 'off',
|
|
171
|
-
// 'no-mixed-requires': 'off',
|
|
172
|
-
// 'no-multi-assign': 'off',
|
|
173
|
-
// 'no-multi-spaces': 'off',
|
|
174
71
|
'no-multi-str': 'error',
|
|
175
|
-
'no-multiple-empty-lines': 'error',
|
|
176
|
-
'no-native-reassign': 'error',
|
|
177
|
-
// 'no-negated-condition': 'off',
|
|
178
|
-
'no-negated-in-lhs': 'error',
|
|
179
72
|
'no-nested-ternary': 'error',
|
|
180
|
-
// 'no-new': 'off',
|
|
181
73
|
'no-new-func': 'error',
|
|
182
|
-
'no-new-object': 'error',
|
|
183
|
-
'no-new-require': 'error',
|
|
184
74
|
'no-new-wrappers': 'error',
|
|
185
75
|
'no-octal-escape': 'error',
|
|
186
|
-
// 'no-param-reassign': 'off',
|
|
187
|
-
'no-path-concat': 'error',
|
|
188
|
-
// 'no-plusplus': 'off',
|
|
189
|
-
// 'no-process-env': 'off',
|
|
190
|
-
'no-process-exit': 'error',
|
|
191
76
|
'no-proto': 'error',
|
|
192
77
|
'no-prototype-builtins': 'error',
|
|
193
78
|
'no-restricted-globals': 'error',
|
|
194
79
|
'no-restricted-imports': 'error',
|
|
195
|
-
'no-restricted-modules': 'error',
|
|
196
80
|
'no-restricted-properties': 'error',
|
|
197
81
|
'no-restricted-syntax': 'error',
|
|
198
|
-
// 'no-return-assign': 'off',
|
|
199
|
-
'no-return-await': 'error',
|
|
200
82
|
'no-script-url': 'error',
|
|
201
83
|
'no-self-compare': 'error',
|
|
202
|
-
// 'no-sequences': 'off',
|
|
203
|
-
// 'no-shadow': 'off',
|
|
204
84
|
'no-shadow-restricted-names': 'error',
|
|
205
|
-
// 'no-spaced-func': 'off',
|
|
206
|
-
'no-sync': 'error',
|
|
207
|
-
// 'no-tabs': 'off',
|
|
208
85
|
'no-template-curly-in-string': 'error',
|
|
209
|
-
// 'no-ternary': 'off',
|
|
210
86
|
'no-throw-literal': 'error',
|
|
211
|
-
'no-trailing-spaces': 'error',
|
|
212
87
|
'no-undef-init': 'error',
|
|
213
|
-
// 'no-undefined': 'off',
|
|
214
|
-
// 'no-underscore-dangle': 'off',
|
|
215
88
|
'no-unmodified-loop-condition': 'error',
|
|
216
89
|
'no-unneeded-ternary': 'error',
|
|
217
|
-
// 'no-unused-expressions': 'off',
|
|
218
|
-
// 'no-use-before-define': 'off',
|
|
219
90
|
'no-useless-call': 'error',
|
|
220
91
|
'no-useless-computed-key': 'error',
|
|
221
92
|
'no-useless-concat': 'error',
|
|
222
93
|
'no-useless-constructor': 'error',
|
|
223
94
|
'no-useless-rename': 'error',
|
|
224
95
|
'no-useless-return': 'error',
|
|
225
|
-
// 'no-var': 'off',
|
|
226
96
|
'no-void': 'error',
|
|
227
97
|
'no-warning-comments': 'error',
|
|
228
|
-
'no-whitespace-before-property': 'error',
|
|
229
98
|
'no-with': 'error',
|
|
230
|
-
'nonblock-statement-body-position': 'error',
|
|
231
|
-
// 'object-curly-newline': 'off',
|
|
232
|
-
'object-curly-spacing': [
|
|
233
|
-
'error', 'never'
|
|
234
|
-
],
|
|
235
|
-
'object-property-newline': [
|
|
236
|
-
'error', {
|
|
237
|
-
'allowMultiplePropertiesPerLine': true
|
|
238
|
-
}
|
|
239
|
-
],
|
|
240
|
-
// 'object-shorthand': 'off',
|
|
241
99
|
'one-var': 'error',
|
|
242
|
-
'one-var-declaration-per-line': [
|
|
243
|
-
'error', 'initializations'
|
|
244
|
-
],
|
|
245
|
-
// 'operator-assignment': 'off',
|
|
246
|
-
'operator-linebreak': [
|
|
247
|
-
'error', 'after'
|
|
248
|
-
],
|
|
249
|
-
// 'padded-blocks': 'off',
|
|
250
|
-
'padding-line-between-statements': 'error',
|
|
251
|
-
// 'prefer-arrow-callback': 'off',
|
|
252
100
|
'prefer-const': 'error',
|
|
253
|
-
// 'prefer-destructuring': 'off',
|
|
254
101
|
'prefer-numeric-literals': 'error',
|
|
255
102
|
'prefer-promise-reject-errors': 'error',
|
|
256
|
-
// 'prefer-reflect': 'off',
|
|
257
|
-
// 'prefer-rest-params': 'off',
|
|
258
|
-
// 'prefer-spread': 'off',
|
|
259
|
-
// 'prefer-template': 'off',
|
|
260
|
-
// 'quote-props': 'off',
|
|
261
|
-
'quotes': [
|
|
262
|
-
'error',
|
|
263
|
-
'single', {
|
|
264
|
-
'allowTemplateLiterals': true
|
|
265
|
-
}
|
|
266
|
-
],
|
|
267
103
|
'radix': [
|
|
268
104
|
'error', 'always'
|
|
269
105
|
],
|
|
270
106
|
'require-await': 'error',
|
|
271
|
-
// 'require-jsdoc': 'off',
|
|
272
|
-
'rest-spread-spacing': 'error',
|
|
273
|
-
'semi': 'error',
|
|
274
|
-
'semi-spacing': 'error',
|
|
275
|
-
// 'semi-style': 'off',
|
|
276
|
-
// 'sort-imports': 'off',
|
|
277
|
-
// 'sort-keys': 'off',
|
|
278
|
-
// 'sort-vars': 'off',
|
|
279
|
-
// 'space-before-blocks': 'off',
|
|
280
|
-
// 'space-before-function-paren': 'off',
|
|
281
|
-
'space-in-parens': [
|
|
282
|
-
'error', 'never'
|
|
283
|
-
],
|
|
284
|
-
// 'space-infix-ops': 'off',
|
|
285
|
-
'space-unary-ops': [
|
|
286
|
-
'error', {
|
|
287
|
-
'nonwords': false,
|
|
288
|
-
'words': false
|
|
289
|
-
}
|
|
290
|
-
],
|
|
291
|
-
// 'spaced-comment': 'off',
|
|
292
107
|
'strict': 'error',
|
|
293
|
-
'switch-colon-spacing': 'error',
|
|
294
108
|
'symbol-description': 'error',
|
|
295
|
-
'template-curly-spacing': 'error',
|
|
296
|
-
'template-tag-spacing': 'error',
|
|
297
109
|
'unicode-bom': [
|
|
298
110
|
'error', 'never'
|
|
299
111
|
],
|
|
300
|
-
// 'vars-on-top': 'off',
|
|
301
|
-
'wrap-regex': 'error',
|
|
302
|
-
'yield-star-spacing': 'error',
|
|
303
112
|
'sort-class-members/sort-class-members': [2, {
|
|
304
113
|
order: CLASS_MEMBER_ORDER,
|
|
305
114
|
groups: CLASS_MEMBER_GROUPS
|
|
306
115
|
}]
|
|
116
|
+
},
|
|
117
|
+
recommended = {
|
|
118
|
+
...js.configs.recommended,
|
|
119
|
+
languageOptions: {
|
|
120
|
+
...js.configs.recommended.languageOptions,
|
|
121
|
+
sourceType: 'commonjs',
|
|
122
|
+
globals: {
|
|
123
|
+
...globals.node
|
|
124
|
+
}
|
|
125
|
+
},
|
|
126
|
+
plugins: {
|
|
127
|
+
'sort-class-members': sortClassMembers
|
|
128
|
+
},
|
|
129
|
+
rules: {
|
|
130
|
+
...js.configs.recommended.rules,
|
|
131
|
+
...rules
|
|
132
|
+
}
|
|
307
133
|
}
|
|
308
|
-
|
|
134
|
+
;
|
|
135
|
+
|
|
136
|
+
module.exports.configs = { recommended };
|
|
137
|
+
module.exports.rules = rules;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@moccu/eslint-config",
|
|
3
3
|
"description": "The eslint config we use at moccu",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.8.0",
|
|
5
5
|
"author": "Moccu GmbH & Co. KG",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"repository": "moccu/eslint-config-moccu",
|
|
@@ -30,12 +30,14 @@
|
|
|
30
30
|
"hint"
|
|
31
31
|
],
|
|
32
32
|
"devDependencies": {
|
|
33
|
-
"eslint": "^
|
|
34
|
-
|
|
35
|
-
|
|
33
|
+
"eslint": "^10.6.0"
|
|
34
|
+
},
|
|
35
|
+
"dependencies": {
|
|
36
|
+
"@eslint/js": "^10.0.1",
|
|
37
|
+
"eslint-plugin-sort-class-members": "^1.22.1",
|
|
38
|
+
"globals": "^17.7.0"
|
|
36
39
|
},
|
|
37
40
|
"peerDependencies": {
|
|
38
|
-
"eslint": ">=
|
|
39
|
-
"eslint-plugin-sort-class-members": "^1.20.0"
|
|
41
|
+
"eslint": ">=10.0.0"
|
|
40
42
|
}
|
|
41
43
|
}
|
package/test/core.js
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
assert = require('assert'),
|
|
6
6
|
{ESLint} = require('eslint'),
|
|
7
7
|
files = ['**/*.js'],
|
|
8
|
-
configs = ['index'
|
|
8
|
+
configs = ['index']
|
|
9
9
|
;
|
|
10
10
|
|
|
11
11
|
let
|
|
@@ -14,23 +14,14 @@
|
|
|
14
14
|
;
|
|
15
15
|
|
|
16
16
|
await Promise.all(configs.map(async (name) => {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
},
|
|
26
|
-
parserOptions: {
|
|
27
|
-
'ecmaVersion': 'latest'
|
|
28
|
-
},
|
|
29
|
-
...config
|
|
30
|
-
}
|
|
31
|
-
}),
|
|
32
|
-
results = await eslint.lintFiles(files)
|
|
33
|
-
;
|
|
17
|
+
const
|
|
18
|
+
plugin = require(`../${name}.js`),
|
|
19
|
+
eslint = new ESLint({
|
|
20
|
+
overrideConfigFile: true,
|
|
21
|
+
overrideConfig: plugin.configs.recommended
|
|
22
|
+
}),
|
|
23
|
+
results = await eslint.lintFiles(files)
|
|
24
|
+
;
|
|
34
25
|
|
|
35
26
|
// Show error report
|
|
36
27
|
ESLint.getErrorResults(results).forEach((error) => {
|
package/test/helper.js
CHANGED
package/test/index.js
CHANGED
package/react-proptypes.js
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
module.exports = {
|
|
5
|
-
plugins: [
|
|
6
|
-
'react'
|
|
7
|
-
],
|
|
8
|
-
rules: {
|
|
9
|
-
'react/boolean-prop-naming': [2, {'rule': '^(is|has|can)[A-Z]([A-Za-z0-9]?)+'}],
|
|
10
|
-
'react/no-unused-prop-types': [2],
|
|
11
|
-
'react/require-default-props': [2],
|
|
12
|
-
'react/sort-prop-types': [2, {
|
|
13
|
-
'callbacksLast': true,
|
|
14
|
-
'ignoreCase': true,
|
|
15
|
-
'requiredFirst': true,
|
|
16
|
-
'sortShapeProp': true,
|
|
17
|
-
'noSortAlphabetically': false
|
|
18
|
-
}]
|
|
19
|
-
}
|
|
20
|
-
};
|
package/react.js
DELETED
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const
|
|
5
|
-
{CLASS_MEMBER_GROUPS, CLASS_MEMBER_ORDER} = require('./defaults/sort-class-members')
|
|
6
|
-
;
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
module.exports = {
|
|
10
|
-
extends: [
|
|
11
|
-
'plugin:react/recommended'
|
|
12
|
-
],
|
|
13
|
-
plugins: [
|
|
14
|
-
'react',
|
|
15
|
-
'sort-class-members'
|
|
16
|
-
],
|
|
17
|
-
rules: {
|
|
18
|
-
'react/button-has-type': [2],
|
|
19
|
-
'react/display-name': 'off',
|
|
20
|
-
'react/no-access-state-in-setstate': [2],
|
|
21
|
-
'react/no-unused-state': [2],
|
|
22
|
-
'react/require-render-return': [2],
|
|
23
|
-
'react/jsx-curly-spacing': [2, {'when': 'never', 'allowMultiline': true}],
|
|
24
|
-
'react/jsx-equals-spacing': [2, 'never'],
|
|
25
|
-
'react/jsx-no-bind': [2],
|
|
26
|
-
'react/jsx-curly-brace-presence': [2],
|
|
27
|
-
'react/jsx-fragments': [2, 'element'],
|
|
28
|
-
'react/jsx-pascal-case': [2],
|
|
29
|
-
'react/jsx-props-no-multi-spaces': [2],
|
|
30
|
-
'react/jsx-sort-props': [2, {
|
|
31
|
-
'callbacksLast': true,
|
|
32
|
-
'ignoreCase': true,
|
|
33
|
-
'noSortAlphabetically': false,
|
|
34
|
-
'reservedFirst': true
|
|
35
|
-
}],
|
|
36
|
-
'react/jsx-tag-spacing': [2, {
|
|
37
|
-
'closingSlash': 'never',
|
|
38
|
-
'beforeSelfClosing': 'always',
|
|
39
|
-
'afterOpening': 'never',
|
|
40
|
-
'beforeClosing': 'never'
|
|
41
|
-
}],
|
|
42
|
-
'react/jsx-wrap-multilines': [2, {
|
|
43
|
-
'declaration': 'parens',
|
|
44
|
-
'assignment': 'parens',
|
|
45
|
-
'return': 'parens',
|
|
46
|
-
'arrow': 'parens',
|
|
47
|
-
'condition': 'parens',
|
|
48
|
-
'logical': 'parens',
|
|
49
|
-
'prop': 'parens'
|
|
50
|
-
}],
|
|
51
|
-
'sort-class-members/sort-class-members': [2, {
|
|
52
|
-
order: CLASS_MEMBER_ORDER
|
|
53
|
-
.insert('[framework-static-properties]').after('[static-properties]')
|
|
54
|
-
.insert('[framework-static-methods]').after('[static-methods]')
|
|
55
|
-
.insert('[framework-lifecycle-methods]').before('render'),
|
|
56
|
-
groups: Object.assign({}, CLASS_MEMBER_GROUPS, {
|
|
57
|
-
'framework-static-properties': [
|
|
58
|
-
{'name': 'propTypes', 'type': 'property', 'static': true},
|
|
59
|
-
{'name': 'defaultProps', 'type': 'property', 'static': true}
|
|
60
|
-
],
|
|
61
|
-
'framework-static-methods': [
|
|
62
|
-
{'name': 'getDerivedStateFromProps', 'type': 'method', 'static': true}
|
|
63
|
-
],
|
|
64
|
-
'framework-lifecycle-methods': [
|
|
65
|
-
{'name': 'componentWillMount', 'type': 'method'},
|
|
66
|
-
{'name': 'UNSAFE_componentWillMount', 'type': 'method'},
|
|
67
|
-
{'name': 'componentDidMount', 'type': 'method'},
|
|
68
|
-
{'name': 'componentWillReceiveProps', 'type': 'method'},
|
|
69
|
-
{'name': 'UNSAFE_componentWillReceiveProps', 'type': 'method'},
|
|
70
|
-
{'name': 'shouldComponentUpdate', 'type': 'method'},
|
|
71
|
-
{'name': 'componentWillUpdate', 'type': 'method'},
|
|
72
|
-
{'name': 'UNSAFE_componentWillUpdate', 'type': 'method'},
|
|
73
|
-
{'name': 'getSnapshotBeforeUpdate', 'type': 'method'},
|
|
74
|
-
{'name': 'componentDidUpdate', 'type': 'method'},
|
|
75
|
-
{'name': 'componentDidCatch', 'type': 'method'},
|
|
76
|
-
{'name': 'componentWillUnmount', 'type': 'method'}
|
|
77
|
-
]
|
|
78
|
-
})
|
|
79
|
-
}]
|
|
80
|
-
}
|
|
81
|
-
};
|