@moccu/eslint-config 0.3.0 โ†’ 0.6.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.
@@ -1,13 +1,18 @@
1
1
  version: 2
2
2
  updates:
3
+ - package-ecosystem: 'npm'
4
+ directory: '/'
5
+ schedule:
6
+ interval: 'monthly'
7
+ time: '05:00'
8
+ groups:
9
+ dependencies:
10
+ update-types:
11
+ - 'minor'
12
+ - 'patch'
3
13
 
4
- - package-ecosystem: 'npm'
5
- directory: '/'
6
- schedule:
7
- interval: 'monthly'
8
-
9
- - package-ecosystem: 'github-actions'
10
- directory: '/'
11
- schedule:
12
- interval: 'monthly'
13
-
14
+ - package-ecosystem: 'github-actions'
15
+ directory: '/'
16
+ schedule:
17
+ interval: 'monthly'
18
+ time: '05:00'
@@ -5,12 +5,33 @@ jobs:
5
5
  build:
6
6
  runs-on: ubuntu-latest
7
7
  steps:
8
- - name: Checkout
9
- uses: actions/checkout@v2
8
+ - name: Checkout ๐Ÿ›Ž๏ธ
9
+ uses: actions/checkout@v4
10
10
  with:
11
11
  persist-credentials: false
12
12
 
13
- - name: Build
13
+ - name: Setup ๐Ÿ”Œ
14
+ uses: actions/setup-node@v4
15
+ with:
16
+ node-version-file: '.nvmrc'
17
+ registry-url: https://registry.npmjs.org/
18
+
19
+ - name: Install dependencies ๐Ÿ‘จ๐Ÿปโ€๐Ÿ’ป
20
+ run: npm ci
21
+
22
+ - name: Run tests ๐Ÿงช
23
+ run: npm t
24
+
25
+ - name: Publish ๐Ÿš€
26
+ if: startsWith(github.ref, 'refs/tags/')
27
+ run: npm publish --access public
28
+ env:
29
+ NODE_AUTH_TOKEN: ${{secrets.NODE_AUTH_TOKEN}}
30
+
31
+ - name: Publish to GitHub ๐Ÿš€
32
+ if: startsWith(github.ref, 'refs/tags/')
14
33
  run: |
15
- npm ci
16
- npm test
34
+ npm set //npm.pkg.github.com/:_authToken $GITHUB_TOKEN
35
+ npm publish --access public --@moccu:registry=https://npm.pkg.github.com
36
+ env:
37
+ GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
package/.nvmrc CHANGED
@@ -1 +1 @@
1
- 14.16.1
1
+ 20.15.0
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # eslint-config-moccu
2
2
 
3
- ![Build](https://github.com/moccu/eslint-config-moccu/workflows/Build/badge.svg)
3
+ [![Build](https://github.com/moccu/eslint-config-moccu/actions/workflows/build.yml/badge.svg)](https://github.com/moccu/eslint-config-moccu/actions)
4
4
 
5
5
 
6
6
  The eslint config we use at moccu
@@ -1,11 +1,7 @@
1
- 'use strict';
2
-
3
-
4
1
  const
5
2
  {List} = require('../helper')
6
3
  ;
7
4
 
8
-
9
5
  module.exports.CLASS_MEMBER_ORDER = new List(
10
6
  '[static-properties]',
11
7
  '[static-methods]',
package/helper/index.js CHANGED
@@ -1,6 +1,3 @@
1
- 'use strict';
2
-
3
-
4
1
  module.exports.List = class extends Array {
5
2
 
6
3
  insert(value) {
package/index.js CHANGED
@@ -1,308 +1,139 @@
1
- 'use strict';
2
-
3
-
4
1
  const
5
- {CLASS_MEMBER_GROUPS, CLASS_MEMBER_ORDER} = require('./defaults/sort-class-members')
2
+ {CLASS_MEMBER_GROUPS, CLASS_MEMBER_ORDER} = require('./defaults/sort-class-members'),
3
+ _package = require('./package.json'),
4
+ js = require('@eslint/js'),
5
+ sortClassMembers = require('eslint-plugin-sort-class-members'),
6
+ plugin = {
7
+ meta: {
8
+ name: _package.name,
9
+ version: _package.version
10
+ },
11
+ configs: {},
12
+ rules: {
13
+ 'accessor-pairs': 'error',
14
+ 'array-callback-return': 'error',
15
+ 'block-scoped-var': 'error',
16
+ 'complexity': 'error',
17
+ 'consistent-this': [
18
+ 2, 'self'
19
+ ],
20
+ 'curly': 'error',
21
+ 'dot-notation': 'error',
22
+ 'eqeqeq': 'error',
23
+ 'func-name-matching': 'error',
24
+ 'func-names': [
25
+ 'error', 'never'
26
+ ],
27
+ 'func-style': [
28
+ 'error',
29
+ 'declaration', {
30
+ 'allowArrowFunctions': true
31
+ }
32
+ ],
33
+ 'guard-for-in': 'error',
34
+ 'id-match': 'error',
35
+ 'max-depth': 'error',
36
+ 'max-lines': [
37
+ 'error', {
38
+ 'max': 350,
39
+ 'skipBlankLines': true
40
+ }
41
+ ],
42
+ 'max-nested-callbacks': 'error',
43
+ 'no-alert': 'error',
44
+ 'no-array-constructor': 'error',
45
+ 'no-await-in-loop': 'error',
46
+ 'no-bitwise': 'error',
47
+ 'no-caller': 'error',
48
+ 'no-continue': 'error',
49
+ 'no-div-regex': 'error',
50
+ 'no-duplicate-imports': 'error',
51
+ 'no-empty-function': 'error',
52
+ 'no-eq-null': 'error',
53
+ 'no-eval': 'error',
54
+ 'no-extend-native': 'error',
55
+ 'no-extra-bind': 'error',
56
+ 'no-extra-label': 'error',
57
+ 'no-implicit-coercion': [
58
+ 'error', {
59
+ 'boolean': false,
60
+ 'number': false,
61
+ 'string': false
62
+ }
63
+ ],
64
+ 'no-implicit-globals': 'error',
65
+ 'no-implied-eval': 'error',
66
+ 'no-inner-declarations': [
67
+ 'error', 'functions'
68
+ ],
69
+ 'no-iterator': 'error',
70
+ 'no-label-var': 'error',
71
+ 'no-labels': 'error',
72
+ 'no-lone-blocks': 'error',
73
+ 'no-lonely-if': 'error',
74
+ 'no-loop-func': 'error',
75
+ 'no-multi-str': 'error',
76
+ 'no-nested-ternary': 'error',
77
+ 'no-new-func': 'error',
78
+ 'no-new-wrappers': 'error',
79
+ 'no-octal-escape': 'error',
80
+ 'no-proto': 'error',
81
+ 'no-prototype-builtins': 'error',
82
+ 'no-restricted-globals': 'error',
83
+ 'no-restricted-imports': 'error',
84
+ 'no-restricted-properties': 'error',
85
+ 'no-restricted-syntax': 'error',
86
+ 'no-script-url': 'error',
87
+ 'no-self-compare': 'error',
88
+ 'no-shadow-restricted-names': 'error',
89
+ 'no-template-curly-in-string': 'error',
90
+ 'no-throw-literal': 'error',
91
+ 'no-undef-init': 'error',
92
+ 'no-unmodified-loop-condition': 'error',
93
+ 'no-unneeded-ternary': 'error',
94
+ 'no-useless-call': 'error',
95
+ 'no-useless-computed-key': 'error',
96
+ 'no-useless-concat': 'error',
97
+ 'no-useless-constructor': 'error',
98
+ 'no-useless-rename': 'error',
99
+ 'no-useless-return': 'error',
100
+ 'no-void': 'error',
101
+ 'no-warning-comments': 'error',
102
+ 'no-with': 'error',
103
+ 'one-var': 'error',
104
+ 'prefer-const': 'error',
105
+ 'prefer-numeric-literals': 'error',
106
+ 'prefer-promise-reject-errors': 'error',
107
+ 'radix': [
108
+ 'error', 'always'
109
+ ],
110
+ 'require-await': 'error',
111
+ 'strict': 'error',
112
+ 'symbol-description': 'error',
113
+ 'unicode-bom': [
114
+ 'error', 'never'
115
+ ],
116
+ 'sort-class-members/sort-class-members': [2, {
117
+ order: CLASS_MEMBER_ORDER,
118
+ groups: CLASS_MEMBER_GROUPS
119
+ }]
120
+ }
121
+ }
6
122
  ;
7
123
 
8
-
9
- module.exports = {
10
- extends: [
11
- 'eslint:recommended'
12
- ],
13
- plugins: [
14
- 'sort-class-members'
15
- ],
16
- rules: {
17
- 'accessor-pairs': 'error',
18
- // 'array-bracket-newline': 'off',
19
- 'array-bracket-spacing': 'error',
20
- '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
- '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
- 'complexity': 'error',
55
- 'computed-property-spacing': [
56
- 'error', 'never'
57
- ],
58
- // 'consistent-return': 'off',
59
- 'consistent-this': [
60
- 2, 'self'
61
- ],
62
- 'curly': 'error',
63
- // 'default-case': 'off',
64
- 'dot-location': [
65
- 'error', 'property'
66
- ],
67
- 'dot-notation': 'error',
68
- 'eol-last': 'error',
69
- 'eqeqeq': 'error',
70
- // 'for-direction': 'error',
71
- // 'func-call-spacing': 'off',
72
- 'func-name-matching': 'error',
73
- 'func-names': [
74
- 'error', 'never'
75
- ],
76
- 'func-style': [
77
- 'error',
78
- 'declaration', {
79
- 'allowArrowFunctions': true
80
- }
81
- ],
82
- // 'function-paren-newline': 'off',
83
- 'generator-star-spacing': 'error',
84
- // 'getter-return': 'error',
85
- // 'global-require': 'off',
86
- 'guard-for-in': 'error',
87
- 'handle-callback-err': 'error',
88
- 'id-blacklist': 'error',
89
- // 'id-length': 'off',
90
- '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
- 'max-depth': 'error',
110
- // 'max-len': 'off',
111
- 'max-lines': [
112
- 'error', {
113
- 'max': 350,
114
- 'skipBlankLines': true
115
- }
116
- ],
117
- '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
- 'no-alert': 'error',
130
- 'no-array-constructor': 'error',
131
- 'no-await-in-loop': 'error',
132
- 'no-bitwise': 'error',
133
- 'no-buffer-constructor': 'error',
134
- 'no-caller': 'error',
135
- // 'no-catch-shadow': 'error',
136
- 'no-confusing-arrow': 'error',
137
- 'no-continue': 'error',
138
- 'no-div-regex': 'error',
139
- 'no-duplicate-imports': 'error',
140
- // 'no-else-return': 'off',
141
- 'no-empty-function': 'error',
142
- 'no-eq-null': 'error',
143
- 'no-eval': 'error',
144
- 'no-extend-native': 'error',
145
- 'no-extra-bind': 'error',
146
- 'no-extra-label': 'error',
147
- // 'no-extra-parens': 'off',
148
- 'no-floating-decimal': 'error',
149
- 'no-implicit-coercion': [
150
- 'error', {
151
- 'boolean': false,
152
- 'number': false,
153
- 'string': false
154
- }
155
- ],
156
- 'no-implicit-globals': 'error',
157
- 'no-implied-eval': 'error',
158
- // 'no-inline-comments': 'off',
159
- 'no-inner-declarations': [
160
- 'error', 'functions'
161
- ],
162
- // 'no-invalid-this': 'off',
163
- 'no-iterator': 'error',
164
- 'no-label-var': 'error',
165
- 'no-labels': 'error',
166
- 'no-lone-blocks': 'error',
167
- 'no-lonely-if': 'error',
168
- '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
- '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
- 'no-nested-ternary': 'error',
180
- // 'no-new': 'off',
181
- 'no-new-func': 'error',
182
- 'no-new-object': 'error',
183
- 'no-new-require': 'error',
184
- 'no-new-wrappers': 'error',
185
- '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
- 'no-proto': 'error',
192
- 'no-prototype-builtins': 'error',
193
- 'no-restricted-globals': 'error',
194
- 'no-restricted-imports': 'error',
195
- 'no-restricted-modules': 'error',
196
- 'no-restricted-properties': 'error',
197
- 'no-restricted-syntax': 'error',
198
- // 'no-return-assign': 'off',
199
- 'no-return-await': 'error',
200
- 'no-script-url': 'error',
201
- 'no-self-compare': 'error',
202
- // 'no-sequences': 'off',
203
- // 'no-shadow': 'off',
204
- 'no-shadow-restricted-names': 'error',
205
- // 'no-spaced-func': 'off',
206
- 'no-sync': 'error',
207
- // 'no-tabs': 'off',
208
- 'no-template-curly-in-string': 'error',
209
- // 'no-ternary': 'off',
210
- 'no-throw-literal': 'error',
211
- 'no-trailing-spaces': 'error',
212
- 'no-undef-init': 'error',
213
- // 'no-undefined': 'off',
214
- // 'no-underscore-dangle': 'off',
215
- 'no-unmodified-loop-condition': 'error',
216
- 'no-unneeded-ternary': 'error',
217
- // 'no-unused-expressions': 'off',
218
- // 'no-use-before-define': 'off',
219
- 'no-useless-call': 'error',
220
- 'no-useless-computed-key': 'error',
221
- 'no-useless-concat': 'error',
222
- 'no-useless-constructor': 'error',
223
- 'no-useless-rename': 'error',
224
- 'no-useless-return': 'error',
225
- // 'no-var': 'off',
226
- 'no-void': 'error',
227
- 'no-warning-comments': 'error',
228
- 'no-whitespace-before-property': 'error',
229
- '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
- '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
- 'prefer-const': 'error',
253
- // 'prefer-destructuring': 'off',
254
- 'prefer-numeric-literals': 'error',
255
- '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
- 'radix': [
268
- 'error', 'always'
269
- ],
270
- '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
- 'strict': 'error',
293
- 'switch-colon-spacing': 'error',
294
- 'symbol-description': 'error',
295
- 'template-curly-spacing': 'error',
296
- 'template-tag-spacing': 'error',
297
- 'unicode-bom': [
298
- 'error', 'never'
299
- ],
300
- // 'vars-on-top': 'off',
301
- 'wrap-regex': 'error',
302
- 'yield-star-spacing': 'error',
303
- 'sort-class-members/sort-class-members': [2, {
304
- order: CLASS_MEMBER_ORDER,
305
- groups: CLASS_MEMBER_GROUPS
306
- }]
124
+ plugin.configs = {
125
+ recommended: {
126
+ extends: ['eslint:recommended'],
127
+ plugins: ['sort-class-members'],
128
+ rules: plugin.rules
129
+ },
130
+ 'flat/recommended': {
131
+ ...js.configs.recommended,
132
+ plugins: {
133
+ 'sort-class-members': sortClassMembers
134
+ },
135
+ rules: plugin.rules
307
136
  }
308
137
  };
138
+
139
+ module.exports = plugin;
package/package.json CHANGED
@@ -1,13 +1,10 @@
1
1
  {
2
2
  "name": "@moccu/eslint-config",
3
3
  "description": "The eslint config we use at moccu",
4
- "version": "0.3.0",
4
+ "version": "0.6.0",
5
5
  "author": "Moccu GmbH & Co. KG",
6
6
  "license": "MIT",
7
7
  "repository": "moccu/eslint-config-moccu",
8
- "engines": {
9
- "node": ">=6"
10
- },
11
8
  "scripts": {
12
9
  "test": "node test/index.js"
13
10
  },
@@ -33,15 +30,12 @@
33
30
  "hint"
34
31
  ],
35
32
  "devDependencies": {
36
- "chalk": "^4.1.1",
37
- "deepmerge": "^4.2.2",
38
- "eslint": "^7.26.0",
39
- "eslint-plugin-react": "^7.12.4",
40
- "eslint-plugin-sort-class-members": "^1.4.0"
33
+ "eslint": "^9.8.0",
34
+ "eslint-plugin-react": "^7.32.2",
35
+ "eslint-plugin-sort-class-members": "^1.20.0"
41
36
  },
42
37
  "peerDependencies": {
43
- "eslint": ">=7.0.0",
44
- "eslint-plugin-react": ">=7.12.4",
45
- "eslint-plugin-sort-class-members": "^1.4.0"
38
+ "eslint": ">=8.0.0",
39
+ "eslint-plugin-sort-class-members": "^1.20.0"
46
40
  }
47
41
  }
@@ -1,5 +1,4 @@
1
- 'use strict';
2
-
1
+ // @TODO: Add flat config
3
2
 
4
3
  module.exports = {
5
4
  plugins: [
package/react.js CHANGED
@@ -1,11 +1,9 @@
1
- 'use strict';
2
-
1
+ // @TODO: Add flat config
3
2
 
4
3
  const
5
4
  {CLASS_MEMBER_GROUPS, CLASS_MEMBER_ORDER} = require('./defaults/sort-class-members')
6
5
  ;
7
6
 
8
-
9
7
  module.exports = {
10
8
  extends: [
11
9
  'plugin:react/recommended'
package/test/core.js CHANGED
@@ -1,28 +1,10 @@
1
- 'use strict';
2
-
3
1
  (async function() {
4
2
  const
5
3
  assert = require('assert'),
6
- chalk = require('chalk'),
7
- deepmerge = require('deepmerge'),
8
4
  {ESLint} = require('eslint'),
9
5
  files = ['**/*.js'],
10
- eslint = new ESLint({
11
- useEslintrc: false,
12
- overrideConfig: {
13
- env: {
14
- 'es6': true,
15
- 'node': true
16
- },
17
- parserOptions: {
18
- 'ecmaVersion': 9
19
- },
20
- ...['index', 'react', 'react-proptypes'].reduce(
21
- (cfg, name) => deepmerge(cfg, require('../' + name))
22
- )
23
- }
24
- }),
25
- results = await eslint.lintFiles(files)
6
+ // configs = ['index', 'react', 'react-proptypes']
7
+ configs = ['index']
26
8
  ;
27
9
 
28
10
  let
@@ -30,18 +12,25 @@
30
12
  warningCount = 0
31
13
  ;
32
14
 
33
- // Show error report
34
- ESLint.getErrorResults(results).forEach((error) => {
35
- errorCount += error.errorCount;
36
- warningCount += error.warningCount;
37
- error.messages.forEach((message) =>
38
- console.error(
39
- chalk.red(message.message),
40
- chalk.white(`(${message.ruleId})`),
41
- chalk.white(`\n\t${error.filePath}:${message.line}:${message.column}`)
42
- )
43
- )
44
- });
15
+ await Promise.all(configs.map(async (name) => {
16
+ const
17
+ plugin = require(`../${name}.js`),
18
+ eslint = new ESLint({
19
+ overrideConfigFile: true,
20
+ overrideConfig: plugin.configs['flat/recommended']
21
+ }),
22
+ results = await eslint.lintFiles(files)
23
+ ;
24
+
25
+ // Show error report
26
+ ESLint.getErrorResults(results).forEach((error) => {
27
+ errorCount += error.errorCount;
28
+ warningCount += error.warningCount;
29
+ error.messages.length && console.log('\n', error.filePath);
30
+ error.messages.forEach((message) => console.log(`${message.line}:${message.column}`, message.message, message.ruleId));
31
+ error.messages.length && console.log(`\n${error.errorCount} errors, ${error.warningCount} warnings\n`);
32
+ });
33
+ }));
45
34
 
46
35
  // Self test
47
36
  assert.equal(errorCount, 0);
package/test/helper.js CHANGED
@@ -1,6 +1,3 @@
1
- 'use strict';
2
-
3
-
4
1
  const
5
2
  assert = require('assert'),
6
3
 
package/test/index.js CHANGED
@@ -1,5 +1,2 @@
1
- 'use strict';
2
-
3
-
4
1
  require('./core');
5
2
  require('./helper');