eslint-config-scratch 11.0.53 → 12.0.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,10 +1,12 @@
1
1
  import jsdoc from 'eslint-plugin-jsdoc'
2
+ import react from 'eslint-plugin-react'
3
+ import { defineConfig } from 'eslint/config'
2
4
  import globals from 'globals'
3
5
  import path from 'node:path'
4
6
  import { fileURLToPath } from 'node:url'
5
- import babelParser from '@babel/eslint-parser'
6
7
  import { FlatCompat } from '@eslint/eslintrc'
7
8
  import js from '@eslint/js'
9
+ import stylistic from '@stylistic/eslint-plugin'
8
10
 
9
11
  const __filename = fileURLToPath(import.meta.url)
10
12
  const __dirname = path.dirname(__filename)
@@ -14,180 +16,188 @@ const compat = new FlatCompat({
14
16
  allConfig: js.configs.all,
15
17
  })
16
18
 
17
- /** @type {import('eslint').Linter.Config[]} */
18
- export default [
19
- ...compat.extends('eslint:recommended'),
20
- jsdoc.configs['flat/recommended'],
21
- {
22
- languageOptions: {
23
- globals: {
24
- ...globals.commonjs,
19
+ export default defineConfig(...compat.extends('eslint:recommended'), jsdoc.configs['flat/recommended'], {
20
+ languageOptions: {
21
+ globals: {
22
+ ...globals.commonjs,
23
+ },
24
+
25
+ parserOptions: {
26
+ requireConfigFile: false,
27
+ },
28
+ },
29
+
30
+ linterOptions: {
31
+ reportUnusedDisableDirectives: 'warn',
32
+ },
33
+
34
+ plugins: {
35
+ react,
36
+ '@stylistic': stylistic,
37
+ },
38
+
39
+ rules: {
40
+ 'array-callback-return': [2],
41
+ 'block-scoped-var': [2],
42
+ curly: [2, 'multi-line'],
43
+ 'dot-location': [2, 'property'],
44
+ 'dot-notation': [2],
45
+ eqeqeq: [2],
46
+ 'no-alert': [2],
47
+ 'no-div-regex': [2],
48
+ 'no-else-return': [2],
49
+ 'no-eq-null': [2],
50
+ 'no-eval': [2],
51
+ 'no-extend-native': [2],
52
+ 'no-extra-bind': [2],
53
+ 'no-global-assign': [2],
54
+ 'no-implied-eval': [2],
55
+ 'no-invalid-this': [2],
56
+ 'no-iterator': [2],
57
+ 'no-lone-blocks': [2],
58
+ 'no-loop-func': [2],
59
+ 'no-multi-spaces': [2],
60
+ 'no-multi-str': [2],
61
+ 'no-new': [2],
62
+ 'no-proto': [2],
63
+ 'no-return-assign': [2],
64
+ 'no-script-url': [2],
65
+ 'no-self-compare': [2],
66
+ 'no-sequences': [2],
67
+ 'no-throw-literal': [2],
68
+ 'no-unmodified-loop-condition': [2],
69
+ 'no-unused-expressions': [2],
70
+ 'no-useless-call': [2],
71
+ 'no-useless-concat': [2],
72
+ 'no-useless-escape': [2],
73
+ 'no-warning-comments': [0],
74
+ 'no-with': [2],
75
+ radix: [2],
76
+ 'wrap-iife': [2],
77
+ yoda: [2],
78
+
79
+ 'no-unused-vars': [
80
+ 2,
81
+ {
82
+ args: 'after-used',
83
+ varsIgnorePattern: '^_',
84
+ },
85
+ ],
86
+
87
+ 'no-catch-shadow': [2],
88
+ 'no-shadow': [2],
89
+ 'no-undefined': [2],
90
+ 'no-use-before-define': [2],
91
+ strict: [2, 'never'],
92
+ 'array-bracket-spacing': [2, 'never'],
93
+ 'block-spacing': [2, 'always'],
94
+ 'brace-style': [2],
95
+
96
+ camelcase: [
97
+ 2,
98
+ {
99
+ properties: 'never',
100
+ },
101
+ ],
102
+
103
+ 'comma-dangle': [2, 'never'],
104
+ 'comma-spacing': [2],
105
+ 'comma-style': [2],
106
+ 'eol-last': [2, 'always'],
107
+ 'func-call-spacing': [2, 'never'],
108
+ 'func-style': [2, 'expression'],
109
+ '@stylistic/indent': [2, 4, { SwitchCase: 0 }],
110
+ 'jsx-quotes': [2, 'prefer-double'],
111
+
112
+ 'key-spacing': [
113
+ 2,
114
+ {
115
+ beforeColon: false,
116
+ afterColon: true,
117
+ mode: 'strict',
118
+ },
119
+ ],
120
+
121
+ 'keyword-spacing': [
122
+ 2,
123
+ {
124
+ before: true,
125
+ after: true,
25
126
  },
127
+ ],
26
128
 
27
- parser: babelParser,
28
- ecmaVersion: 6,
29
- sourceType: 'script',
129
+ 'linebreak-style': [2, 'unix'],
30
130
 
31
- parserOptions: {
32
- requireConfigFile: false,
131
+ 'max-len': [
132
+ 2,
133
+ {
134
+ code: 120,
135
+ tabWidth: 4,
136
+ ignoreUrls: true,
33
137
  },
34
- },
138
+ ],
139
+
140
+ 'new-parens': [2],
141
+ 'newline-per-chained-call': [2],
142
+ 'no-lonely-if': [2],
143
+ 'no-mixed-operators': [2],
144
+
145
+ 'no-multiple-empty-lines': [
146
+ 2,
147
+ {
148
+ max: 2,
149
+ maxBOF: 0,
150
+ maxEOF: 0,
151
+ },
152
+ ],
35
153
 
36
- rules: {
37
- 'array-callback-return': [2],
38
- 'block-scoped-var': [2],
39
- curly: [2, 'multi-line'],
40
- 'dot-location': [2, 'property'],
41
- 'dot-notation': [2],
42
- eqeqeq: [2],
43
- 'no-alert': [2],
44
- 'no-div-regex': [2],
45
- 'no-else-return': [2],
46
- 'no-eq-null': [2],
47
- 'no-eval': [2],
48
- 'no-extend-native': [2],
49
- 'no-extra-bind': [2],
50
- 'no-global-assign': [2],
51
- 'no-implied-eval': [2],
52
- 'no-invalid-this': [2],
53
- 'no-iterator': [2],
54
- 'no-lone-blocks': [2],
55
- 'no-loop-func': [2],
56
- 'no-multi-spaces': [2],
57
- 'no-multi-str': [2],
58
- 'no-new': [2],
59
- 'no-proto': [2],
60
- 'no-return-assign': [2],
61
- 'no-script-url': [2],
62
- 'no-self-compare': [2],
63
- 'no-sequences': [2],
64
- 'no-throw-literal': [2],
65
- 'no-unmodified-loop-condition': [2],
66
- 'no-unused-expressions': [2],
67
- 'no-useless-call': [2],
68
- 'no-useless-concat': [2],
69
- 'no-useless-escape': [2],
70
- 'no-warning-comments': [0],
71
- 'no-with': [2],
72
- radix: [2],
73
- 'wrap-iife': [2],
74
- yoda: [2],
75
-
76
- 'no-unused-vars': [
77
- 2,
78
- {
79
- args: 'after-used',
80
- varsIgnorePattern: '^_',
81
- },
82
- ],
83
-
84
- 'no-catch-shadow': [2],
85
- 'no-shadow': [2],
86
- 'no-undefined': [2],
87
- 'no-use-before-define': [2],
88
- strict: [2, 'never'],
89
- 'array-bracket-spacing': [2, 'never'],
90
- 'block-spacing': [2, 'always'],
91
- 'brace-style': [2],
92
-
93
- camelcase: [
94
- 2,
95
- {
96
- properties: 'never',
97
- },
98
- ],
99
-
100
- 'comma-dangle': [2, 'never'],
101
- 'comma-spacing': [2],
102
- 'comma-style': [2],
103
- 'eol-last': [2, 'always'],
104
- 'func-call-spacing': [2, 'never'],
105
- 'func-style': [2, 'expression'],
106
- indent: [2, 4],
107
- 'jsx-quotes': [2, 'prefer-double'],
108
-
109
- 'key-spacing': [
110
- 2,
111
- {
112
- beforeColon: false,
113
- afterColon: true,
114
- mode: 'strict',
115
- },
116
- ],
117
-
118
- 'keyword-spacing': [
119
- 2,
120
- {
121
- before: true,
122
- after: true,
123
- },
124
- ],
125
-
126
- 'linebreak-style': [2, 'unix'],
127
-
128
- 'max-len': [
129
- 2,
130
- {
131
- code: 120,
132
- tabWidth: 4,
133
- ignoreUrls: true,
134
- },
135
- ],
136
-
137
- 'new-parens': [2],
138
- 'newline-per-chained-call': [2],
139
- 'no-lonely-if': [2],
140
- 'no-mixed-operators': [2],
141
-
142
- 'no-multiple-empty-lines': [
143
- 2,
144
- {
145
- max: 2,
146
- maxBOF: 0,
147
- maxEOF: 0,
148
- },
149
- ],
150
-
151
- 'no-negated-condition': [2],
152
- 'no-tabs': [2],
153
-
154
- 'no-trailing-spaces': [
155
- 2,
156
- {
157
- skipBlankLines: true,
158
- },
159
- ],
160
-
161
- 'no-unneeded-ternary': [2],
162
- 'object-curly-spacing': [2],
163
-
164
- 'object-property-newline': [
165
- 2,
166
- {
167
- allowMultiplePropertiesPerLine: true,
168
- },
169
- ],
170
-
171
- 'one-var': [2, 'never'],
172
- 'operator-linebreak': [2, 'after'],
173
- 'quote-props': [2, 'consistent-as-needed'],
174
-
175
- quotes: [
176
- 2,
177
- 'single',
178
- {
179
- allowTemplateLiterals: true,
180
- avoidEscape: true,
181
- },
182
- ],
183
-
184
- semi: [2, 'always'],
185
- 'semi-spacing': [2],
186
- 'space-before-function-paren': [2, 'always'],
187
- 'space-in-parens': [2],
188
- 'space-infix-ops': [2],
189
- 'space-unary-ops': [2],
190
- 'spaced-comment': [2],
191
- },
154
+ 'no-negated-condition': [2],
155
+ 'no-tabs': [2],
156
+
157
+ 'no-trailing-spaces': [
158
+ 2,
159
+ {
160
+ skipBlankLines: true,
161
+ },
162
+ ],
163
+
164
+ 'no-unneeded-ternary': [2],
165
+ 'object-curly-spacing': [2],
166
+
167
+ 'object-property-newline': [
168
+ 2,
169
+ {
170
+ allowMultiplePropertiesPerLine: true,
171
+ },
172
+ ],
173
+
174
+ 'one-var': [2, 'never'],
175
+ 'operator-linebreak': [2, 'after'],
176
+ 'quote-props': [2, 'consistent-as-needed'],
177
+
178
+ quotes: [
179
+ 2,
180
+ 'single',
181
+ {
182
+ allowTemplateLiterals: true,
183
+ avoidEscape: true,
184
+ },
185
+ ],
186
+
187
+ semi: [2, 'always'],
188
+ 'semi-spacing': [2],
189
+ 'space-before-function-paren': [2, 'always'],
190
+ 'space-in-parens': [2],
191
+ 'space-infix-ops': [2],
192
+ 'space-unary-ops': [2],
193
+ 'spaced-comment': [2],
194
+
195
+ 'react/jsx-filename-extension': [
196
+ 'error',
197
+ {
198
+ allow: 'always', // TODO: use 'as-needed' for non-legacy code
199
+ extensions: ['.jsx', '.tsx'],
200
+ },
201
+ ],
192
202
  },
193
- ]
203
+ })
@@ -1,20 +1,16 @@
1
+ import { defineConfig } from 'eslint/config'
1
2
  import globals from 'globals'
2
3
 
3
- /** @type {import('eslint').Linter.Config[]} */
4
- export default [
5
- {
6
- languageOptions: {
7
- globals: {
8
- ...globals.node,
9
- },
10
- },
4
+ export default defineConfig({
5
+ languageOptions: {
6
+ globals: globals.node,
7
+ },
11
8
 
12
- rules: {
13
- 'global-require': [2],
14
- 'handle-callback-err': [2],
15
- 'no-mixed-requires': [2],
16
- 'no-new-require': [2],
17
- 'no-path-concat': [2],
18
- },
9
+ rules: {
10
+ 'global-require': [2],
11
+ 'handle-callback-err': [2],
12
+ 'no-mixed-requires': [2],
13
+ 'no-new-require': [2],
14
+ 'no-path-concat': [2],
19
15
  },
20
- ]
16
+ })
@@ -1,4 +1,5 @@
1
1
  import react from 'eslint-plugin-react'
2
+ import { defineConfig } from 'eslint/config'
2
3
  import path from 'node:path'
3
4
  import { fileURLToPath } from 'node:url'
4
5
  import { FlatCompat } from '@eslint/eslintrc'
@@ -12,90 +13,86 @@ const compat = new FlatCompat({
12
13
  allConfig: js.configs.all,
13
14
  })
14
15
 
15
- /** @type {import('eslint').Linter.Config[]} */
16
- export default [
17
- ...compat.extends('plugin:react/recommended'),
18
- {
19
- plugins: {
20
- react,
21
- },
16
+ export default defineConfig(...compat.extends('plugin:react/recommended'), {
17
+ plugins: {
18
+ react,
19
+ },
22
20
 
23
- rules: {
24
- 'react/display-name': [2],
25
- 'react/forbid-prop-types': [2],
26
- 'react/no-children-prop': [2],
27
- 'react/no-danger': [2],
28
- 'react/no-danger-with-children': [2],
29
- 'react/no-deprecated': [2],
30
- 'react/no-did-mount-set-state': [2],
31
- 'react/no-did-update-set-state': [2],
32
- 'react/no-direct-mutation-state': [2],
33
- 'react/no-find-dom-node': [2],
34
- 'react/no-is-mounted': [2],
21
+ rules: {
22
+ 'react/display-name': [2],
23
+ 'react/forbid-prop-types': [2],
24
+ 'react/no-children-prop': [2],
25
+ 'react/no-danger': [2],
26
+ 'react/no-danger-with-children': [2],
27
+ 'react/no-deprecated': [2],
28
+ 'react/no-did-mount-set-state': [2],
29
+ 'react/no-did-update-set-state': [2],
30
+ 'react/no-direct-mutation-state': [2],
31
+ 'react/no-find-dom-node': [2],
32
+ 'react/no-is-mounted': [2],
35
33
 
36
- 'react/no-multi-comp': [
37
- 2,
38
- {
39
- ignoreStateless: true,
40
- },
41
- ],
34
+ 'react/no-multi-comp': [
35
+ 2,
36
+ {
37
+ ignoreStateless: true,
38
+ },
39
+ ],
42
40
 
43
- 'react/no-render-return-value': [2],
44
- 'react/no-set-state': [0],
45
- 'react/no-string-refs': [2],
46
- 'react/no-unescaped-entities': [2],
47
- 'react/no-unknown-property': [2],
48
- 'react/no-unused-prop-types': [2],
49
- 'react/prefer-es6-class': [2],
50
- 'react/prefer-stateless-function': [2],
51
- 'react/prop-types': [2],
52
- 'react/react-in-jsx-scope': [2],
53
- 'react/require-optimization': [0],
54
- 'react/require-render-return': [2],
55
- 'react/self-closing-comp': [2],
56
- 'react/sort-comp': [2],
57
- 'react/style-prop-object': [2],
58
- 'react/jsx-boolean-value': [2, 'never'],
59
- 'react/jsx-closing-bracket-location': [2, 'line-aligned'],
60
- 'react/jsx-curly-spacing': [2],
61
- 'react/jsx-equals-spacing': [2],
62
- 'react/jsx-filename-extension': [2],
63
- 'react/jsx-first-prop-new-line': [2, 'multiline'],
64
- 'react/jsx-handler-names': [2],
65
- 'react/jsx-indent': [2],
66
- 'react/jsx-indent-props': [2],
67
- 'react/jsx-key': [2],
41
+ 'react/no-render-return-value': [2],
42
+ 'react/no-set-state': [0],
43
+ 'react/no-string-refs': [2],
44
+ 'react/no-unescaped-entities': [2],
45
+ 'react/no-unknown-property': [2],
46
+ 'react/no-unused-prop-types': [2],
47
+ 'react/prefer-es6-class': [2],
48
+ 'react/prefer-stateless-function': [2],
49
+ 'react/prop-types': [2],
50
+ 'react/react-in-jsx-scope': [2],
51
+ 'react/require-optimization': [0],
52
+ 'react/require-render-return': [2],
53
+ 'react/self-closing-comp': [2],
54
+ 'react/sort-comp': [2],
55
+ 'react/style-prop-object': [2],
56
+ 'react/jsx-boolean-value': [2, 'never'],
57
+ 'react/jsx-closing-bracket-location': [2, 'line-aligned'],
58
+ 'react/jsx-curly-spacing': [2],
59
+ 'react/jsx-equals-spacing': [2],
60
+ 'react/jsx-filename-extension': [2],
61
+ 'react/jsx-first-prop-new-line': [2, 'multiline'],
62
+ 'react/jsx-handler-names': [2],
63
+ 'react/jsx-indent': [2],
64
+ 'react/jsx-indent-props': [2],
65
+ 'react/jsx-key': [2],
68
66
 
69
- 'react/jsx-max-props-per-line': [
70
- 2,
71
- {
72
- maximum: 1,
73
- },
74
- ],
67
+ 'react/jsx-max-props-per-line': [
68
+ 2,
69
+ {
70
+ maximum: 1,
71
+ },
72
+ ],
75
73
 
76
- 'react/jsx-no-bind': [
77
- 2,
78
- {
79
- ignoreRefs: true,
80
- },
81
- ],
74
+ 'react/jsx-no-bind': [
75
+ 2,
76
+ {
77
+ ignoreRefs: true,
78
+ },
79
+ ],
82
80
 
83
- 'react/jsx-no-comment-textnodes': [2],
84
- 'react/jsx-no-duplicate-props': [2],
85
- 'react/jsx-no-target-blank': [2],
86
- 'react/jsx-no-undef': [2],
81
+ 'react/jsx-no-comment-textnodes': [2],
82
+ 'react/jsx-no-duplicate-props': [2],
83
+ 'react/jsx-no-target-blank': [2],
84
+ 'react/jsx-no-undef': [2],
87
85
 
88
- 'react/jsx-pascal-case': [
89
- 2,
90
- {
91
- allowAllCaps: true,
92
- },
93
- ],
86
+ 'react/jsx-pascal-case': [
87
+ 2,
88
+ {
89
+ allowAllCaps: true,
90
+ },
91
+ ],
94
92
 
95
- 'react/jsx-tag-spacing': [2],
96
- 'react/jsx-uses-react': [2],
97
- 'react/jsx-uses-vars': [2],
98
- 'react/jsx-wrap-multilines': [2],
99
- },
93
+ 'react/jsx-tag-spacing': [2],
94
+ 'react/jsx-uses-react': [2],
95
+ 'react/jsx-uses-vars': [2],
96
+ 'react/jsx-wrap-multilines': [2],
100
97
  },
101
- ]
98
+ })
@@ -0,0 +1,59 @@
1
+ import { defineConfig } from 'eslint/config'
2
+ import tseslint from 'typescript-eslint'
3
+
4
+ export default defineConfig(tseslint.configs.base, {
5
+ languageOptions: {
6
+ parserOptions: {
7
+ projectService: true,
8
+ },
9
+ },
10
+ rules: {
11
+ '@typescript-eslint/no-inferrable-types': ['error'],
12
+
13
+ // Replace core rules with TS equivalents
14
+ 'dot-notation': ['off'],
15
+ '@typescript-eslint/dot-notation': ['error'],
16
+
17
+ 'no-implied-eval': ['off'],
18
+ '@typescript-eslint/no-implied-eval': ['error'],
19
+
20
+ 'no-invalid-this': ['off'],
21
+ '@typescript-eslint/no-invalid-this': ['error'],
22
+
23
+ 'no-loop-func': ['off'],
24
+ '@typescript-eslint/no-loop-func': ['error'],
25
+
26
+ 'no-redeclare': ['off'],
27
+ '@typescript-eslint/no-redeclare': ['error'],
28
+
29
+ 'no-return-await': ['off'],
30
+ '@typescript-eslint/return-await': ['error'],
31
+
32
+ 'no-shadow': ['off'],
33
+ '@typescript-eslint/no-shadow': ['error'],
34
+
35
+ 'no-unused-expressions': ['off'],
36
+ '@typescript-eslint/no-unused-expressions': ['error'],
37
+
38
+ 'no-unused-vars': ['off'],
39
+ '@typescript-eslint/no-unused-vars': [
40
+ 2,
41
+ {
42
+ args: 'after-used',
43
+ varsIgnorePattern: '^_',
44
+ },
45
+ ],
46
+
47
+ 'no-use-before-define': ['off'],
48
+ '@typescript-eslint/no-use-before-define': ['error'],
49
+
50
+ 'no-useless-constructor': ['off'],
51
+ '@typescript-eslint/no-useless-constructor': ['error'],
52
+
53
+ 'prefer-promise-reject-errors': ['off'],
54
+ '@typescript-eslint/prefer-promise-reject-errors': ['error'],
55
+
56
+ 'require-await': ['off'],
57
+ '@typescript-eslint/require-await': ['error'],
58
+ },
59
+ })
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eslint-config-scratch",
3
- "version": "11.0.53",
3
+ "version": "12.0.0",
4
4
  "description": "Shareable ESLint config for Scratch",
5
5
  "main": "./lib/index.mjs",
6
6
  "scripts": {
@@ -35,6 +35,7 @@
35
35
  "@eslint/eslintrc": "3.3.1",
36
36
  "@eslint/js": "9.36.0",
37
37
  "@eslint/markdown": "6.6.0",
38
+ "@stylistic/eslint-plugin": "^5.3.1",
38
39
  "@trivago/prettier-plugin-sort-imports": "5.2.2",
39
40
  "eslint-config-prettier": "10.1.8",
40
41
  "eslint-plugin-formatjs": "5.4.0",
@@ -55,7 +56,7 @@
55
56
  "eslint": "9.36.0",
56
57
  "husky": "8.0.3",
57
58
  "scratch-semantic-release-config": "3.0.0",
58
- "semantic-release": "24.2.8",
59
+ "semantic-release": "24.2.9",
59
60
  "vitest": "3.2.4"
60
61
  },
61
62
  "config": {