@timobechtel/style 1.14.0 → 2.1.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/README.md +209 -95
- package/eslint/core.js +86 -0
- package/eslint/react.js +32 -0
- package/eslint/rules/base.js +52 -0
- package/eslint/rules/{css-in-js.cjs → css-in-js.js} +2 -4
- package/eslint/rules/import.js +28 -0
- package/eslint/rules/react.js +40 -0
- package/eslint/rules/typescript.js +63 -0
- package/eslint/rules/unicorn.js +71 -0
- package/oxfmt/index.json +19 -0
- package/oxlint/core.jsonc +212 -0
- package/oxlint/react.jsonc +46 -0
- package/package.json +31 -20
- package/eslint/core.cjs +0 -63
- package/eslint/react.cjs +0 -21
- package/eslint/rules/base.cjs +0 -84
- package/eslint/rules/import.cjs +0 -39
- package/eslint/rules/react.cjs +0 -90
- package/eslint/rules/typescript.cjs +0 -108
- package/eslint/rules/unicorn.cjs +0 -129
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { defineConfig } from 'eslint/config';
|
|
2
|
+
import baseRules from './base.js';
|
|
3
|
+
|
|
4
|
+
const noUnusedVarsConfig = baseRules[0]?.rules?.['no-unused-vars'];
|
|
5
|
+
|
|
6
|
+
export default defineConfig({
|
|
7
|
+
rules: {
|
|
8
|
+
'@typescript-eslint/consistent-type-exports': [
|
|
9
|
+
'error',
|
|
10
|
+
{ fixMixedExportsWithInlineTypeSpecifier: true },
|
|
11
|
+
],
|
|
12
|
+
'@typescript-eslint/consistent-type-imports': [
|
|
13
|
+
'error',
|
|
14
|
+
{
|
|
15
|
+
prefer: 'type-imports',
|
|
16
|
+
fixStyle: 'inline-type-imports',
|
|
17
|
+
},
|
|
18
|
+
],
|
|
19
|
+
'@typescript-eslint/naming-convention': [
|
|
20
|
+
'error',
|
|
21
|
+
{
|
|
22
|
+
format: ['PascalCase'],
|
|
23
|
+
selector: ['typeLike', 'enumMember'],
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
custom: {
|
|
27
|
+
match: false,
|
|
28
|
+
regex: '^I[A-Z]|^(Interface|Props|State)$',
|
|
29
|
+
},
|
|
30
|
+
format: ['PascalCase'],
|
|
31
|
+
selector: 'interface',
|
|
32
|
+
},
|
|
33
|
+
],
|
|
34
|
+
'@typescript-eslint/no-redundant-type-constituents': 'error',
|
|
35
|
+
'@typescript-eslint/prefer-regexp-exec': 'warn',
|
|
36
|
+
'@typescript-eslint/require-array-sort-compare': [
|
|
37
|
+
'error',
|
|
38
|
+
{ ignoreStringArrays: true },
|
|
39
|
+
],
|
|
40
|
+
'@typescript-eslint/switch-exhaustiveness-check': 'error',
|
|
41
|
+
'default-param-last': 'off',
|
|
42
|
+
'@typescript-eslint/default-param-last': 'error',
|
|
43
|
+
'no-loop-func': 'off',
|
|
44
|
+
'@typescript-eslint/no-loop-func': 'error',
|
|
45
|
+
'no-unused-vars': 'off',
|
|
46
|
+
'@typescript-eslint/no-unused-vars': noUnusedVarsConfig,
|
|
47
|
+
'import-x/default': 'off',
|
|
48
|
+
'import-x/export': 'off',
|
|
49
|
+
'import-x/namespace': 'off',
|
|
50
|
+
'import-x/no-unresolved': 'off',
|
|
51
|
+
'@typescript-eslint/prefer-nullish-coalescing': 'off',
|
|
52
|
+
'@typescript-eslint/no-misused-promises': [
|
|
53
|
+
'error',
|
|
54
|
+
{
|
|
55
|
+
checksVoidReturn: false,
|
|
56
|
+
},
|
|
57
|
+
],
|
|
58
|
+
'@typescript-eslint/consistent-type-definitions': 'off',
|
|
59
|
+
'@typescript-eslint/method-signature-style': 'off',
|
|
60
|
+
'@typescript-eslint/consistent-indexed-object-style': 'off',
|
|
61
|
+
'@typescript-eslint/no-import-type-side-effects': 'error',
|
|
62
|
+
},
|
|
63
|
+
});
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { defineConfig } from 'eslint/config';
|
|
2
|
+
|
|
3
|
+
export default defineConfig({
|
|
4
|
+
rules: {
|
|
5
|
+
'unicorn/consistent-destructuring': 'warn',
|
|
6
|
+
'unicorn/consistent-function-scoping': [
|
|
7
|
+
'warn',
|
|
8
|
+
{
|
|
9
|
+
checkArrowFunctions: false,
|
|
10
|
+
},
|
|
11
|
+
],
|
|
12
|
+
'unicorn/error-message': 'error',
|
|
13
|
+
'unicorn/escape-case': 'warn',
|
|
14
|
+
'unicorn/no-empty-file': 'error',
|
|
15
|
+
'unicorn/no-for-loop': 'warn',
|
|
16
|
+
'unicorn/no-instanceof-array': 'error',
|
|
17
|
+
'unicorn/no-invalid-remove-event-listener': 'error',
|
|
18
|
+
'unicorn/no-object-as-default-parameter': 'error',
|
|
19
|
+
'unicorn/no-thenable': 'error',
|
|
20
|
+
'unicorn/no-unnecessary-await': 'error',
|
|
21
|
+
'unicorn/no-unreadable-iife': 'warn',
|
|
22
|
+
'unicorn/no-useless-fallback-in-spread': 'warn',
|
|
23
|
+
'unicorn/no-useless-length-check': 'warn',
|
|
24
|
+
'unicorn/no-useless-promise-resolve-reject': 'error',
|
|
25
|
+
'unicorn/no-useless-spread': 'error',
|
|
26
|
+
'unicorn/no-zero-fractions': 'warn',
|
|
27
|
+
'unicorn/numeric-separators-style': 'error',
|
|
28
|
+
'unicorn/prefer-add-event-listener': 'error',
|
|
29
|
+
'unicorn/prefer-array-find': 'error',
|
|
30
|
+
'unicorn/prefer-array-flat': 'error',
|
|
31
|
+
'unicorn/prefer-array-flat-map': 'error',
|
|
32
|
+
'unicorn/prefer-array-index-of': 'error',
|
|
33
|
+
'unicorn/prefer-array-some': 'error',
|
|
34
|
+
'unicorn/prefer-at': 'error',
|
|
35
|
+
'unicorn/prefer-blob-reading-methods': 'error',
|
|
36
|
+
'unicorn/prefer-date-now': 'error',
|
|
37
|
+
'unicorn/prefer-default-parameters': 'warn',
|
|
38
|
+
'unicorn/prefer-dom-node-append': 'error',
|
|
39
|
+
'unicorn/prefer-dom-node-dataset': 'error',
|
|
40
|
+
'unicorn/prefer-dom-node-remove': 'error',
|
|
41
|
+
'unicorn/prefer-event-target': 'warn',
|
|
42
|
+
'unicorn/prefer-export-from': [
|
|
43
|
+
'warn',
|
|
44
|
+
{
|
|
45
|
+
ignoreUsedVariables: true,
|
|
46
|
+
},
|
|
47
|
+
],
|
|
48
|
+
'unicorn/prefer-includes': 'error',
|
|
49
|
+
'unicorn/prefer-keyboard-event-key': 'error',
|
|
50
|
+
'unicorn/prefer-logical-operator-over-ternary': 'error',
|
|
51
|
+
'unicorn/prefer-math-trunc': 'error',
|
|
52
|
+
'unicorn/prefer-modern-dom-apis': 'error',
|
|
53
|
+
'unicorn/prefer-modern-math-apis': 'error',
|
|
54
|
+
'unicorn/prefer-negative-index': 'error',
|
|
55
|
+
'unicorn/prefer-node-protocol': 'error',
|
|
56
|
+
'unicorn/prefer-number-properties': ['error', { checkInfinity: false }],
|
|
57
|
+
'unicorn/prefer-object-from-entries': 'error',
|
|
58
|
+
'unicorn/prefer-reflect-apply': 'error',
|
|
59
|
+
'unicorn/prefer-regexp-test': 'error',
|
|
60
|
+
'unicorn/prefer-set-has': 'error',
|
|
61
|
+
'unicorn/prefer-set-size': 'error',
|
|
62
|
+
'unicorn/prefer-spread': 'error',
|
|
63
|
+
'unicorn/prefer-string-replace-all': 'error',
|
|
64
|
+
'unicorn/prefer-string-slice': 'error',
|
|
65
|
+
'unicorn/prefer-string-starts-ends-with': 'error',
|
|
66
|
+
'unicorn/prefer-ternary': ['warn', 'only-single-line'],
|
|
67
|
+
'unicorn/prefer-top-level-await': 'error',
|
|
68
|
+
'unicorn/require-array-join-separator': 'error',
|
|
69
|
+
'unicorn/switch-case-braces': 'error',
|
|
70
|
+
},
|
|
71
|
+
});
|
package/oxfmt/index.json
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
{
|
|
2
|
+
"endOfLine": "lf",
|
|
3
|
+
"tabWidth": 2,
|
|
4
|
+
"printWidth": 80,
|
|
5
|
+
"useTabs": false,
|
|
6
|
+
"singleQuote": true,
|
|
7
|
+
"sortImports": {
|
|
8
|
+
"groups": [
|
|
9
|
+
"builtin",
|
|
10
|
+
"external",
|
|
11
|
+
"internal",
|
|
12
|
+
"parent",
|
|
13
|
+
"sibling",
|
|
14
|
+
"index",
|
|
15
|
+
"unknown"
|
|
16
|
+
],
|
|
17
|
+
"newlinesBetween": true
|
|
18
|
+
}
|
|
19
|
+
}
|
|
@@ -0,0 +1,212 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "./node_modules/oxlint/configuration_schema.json",
|
|
3
|
+
"plugins": [
|
|
4
|
+
"unicorn",
|
|
5
|
+
"typescript",
|
|
6
|
+
"oxc",
|
|
7
|
+
"import"
|
|
8
|
+
],
|
|
9
|
+
"categories": {
|
|
10
|
+
"correctness": "error",
|
|
11
|
+
"suspicious": "error",
|
|
12
|
+
"pedantic": "error",
|
|
13
|
+
"nursery": "error"
|
|
14
|
+
},
|
|
15
|
+
"rules": {
|
|
16
|
+
// ---- style rules ----
|
|
17
|
+
"curly": [
|
|
18
|
+
"warn",
|
|
19
|
+
"multi-line"
|
|
20
|
+
],
|
|
21
|
+
"default-case-last": "error",
|
|
22
|
+
"default-param-last": "error",
|
|
23
|
+
"import/first": "error",
|
|
24
|
+
"import/no-duplicates": "warn",
|
|
25
|
+
"new-cap": [
|
|
26
|
+
"error",
|
|
27
|
+
{
|
|
28
|
+
"capIsNew": false
|
|
29
|
+
}
|
|
30
|
+
],
|
|
31
|
+
"no-label-var": "error",
|
|
32
|
+
"prefer-const": "warn",
|
|
33
|
+
"prefer-object-spread": "warn",
|
|
34
|
+
"prefer-rest-params": "error",
|
|
35
|
+
"prefer-spread": "error",
|
|
36
|
+
"prefer-template": "warn",
|
|
37
|
+
"typescript/adjacent-overload-signatures": "error",
|
|
38
|
+
"typescript/array-type": "error",
|
|
39
|
+
"typescript/ban-tslint-comment": "error",
|
|
40
|
+
"typescript/class-literal-property-style": "error",
|
|
41
|
+
"typescript/consistent-generic-constructors": "error",
|
|
42
|
+
"typescript/consistent-type-assertions": "error",
|
|
43
|
+
"typescript/consistent-type-imports": [
|
|
44
|
+
"error",
|
|
45
|
+
{
|
|
46
|
+
"prefer": "type-imports",
|
|
47
|
+
"fixStyle": "inline-type-imports"
|
|
48
|
+
}
|
|
49
|
+
],
|
|
50
|
+
"typescript/no-inferrable-types": "error",
|
|
51
|
+
"typescript/prefer-for-of": "error",
|
|
52
|
+
"typescript/prefer-function-type": "error",
|
|
53
|
+
"typescript/prefer-reduce-type-parameter": "error",
|
|
54
|
+
"typescript/prefer-return-this-type": "error",
|
|
55
|
+
"typescript/unified-signatures": "error",
|
|
56
|
+
"unicorn/error-message": "error",
|
|
57
|
+
"unicorn/no-zero-fractions": "warn",
|
|
58
|
+
"unicorn/numeric-separators-style": "error",
|
|
59
|
+
"unicorn/prefer-array-index-of": "error",
|
|
60
|
+
"unicorn/prefer-default-parameters": "warn",
|
|
61
|
+
"unicorn/prefer-includes": "error",
|
|
62
|
+
"unicorn/prefer-keyboard-event-key": "error",
|
|
63
|
+
"unicorn/prefer-logical-operator-over-ternary": "error",
|
|
64
|
+
"unicorn/prefer-modern-dom-apis": "error",
|
|
65
|
+
"unicorn/prefer-negative-index": "error",
|
|
66
|
+
"unicorn/prefer-object-from-entries": "error",
|
|
67
|
+
"unicorn/prefer-reflect-apply": "error",
|
|
68
|
+
"unicorn/prefer-spread": "error",
|
|
69
|
+
"unicorn/prefer-ternary": [
|
|
70
|
+
"warn",
|
|
71
|
+
"only-single-line"
|
|
72
|
+
],
|
|
73
|
+
"unicorn/require-array-join-separator": "error",
|
|
74
|
+
"unicorn/switch-case-braces": "error",
|
|
75
|
+
|
|
76
|
+
// ---- correctness rules ----
|
|
77
|
+
"import/default": "off",
|
|
78
|
+
"import/namespace": "off",
|
|
79
|
+
"no-unused-vars": [
|
|
80
|
+
"error",
|
|
81
|
+
{
|
|
82
|
+
"args": "after-used",
|
|
83
|
+
"argsIgnorePattern": "^_",
|
|
84
|
+
"ignoreRestSiblings": false,
|
|
85
|
+
"vars": "all",
|
|
86
|
+
"varsIgnorePattern": "^_"
|
|
87
|
+
}
|
|
88
|
+
],
|
|
89
|
+
"no-useless-rename": "warn",
|
|
90
|
+
"typescript/require-array-sort-compare": [
|
|
91
|
+
"error",
|
|
92
|
+
{
|
|
93
|
+
"ignoreStringArrays": true
|
|
94
|
+
}
|
|
95
|
+
],
|
|
96
|
+
"unicorn/no-useless-fallback-in-spread": "warn",
|
|
97
|
+
"unicorn/no-useless-length-check": "warn",
|
|
98
|
+
|
|
99
|
+
// ---- suspicious rules ----
|
|
100
|
+
"import/no-named-as-default": "warn",
|
|
101
|
+
"import/no-named-as-default-member": "warn",
|
|
102
|
+
"unicorn/consistent-function-scoping": [
|
|
103
|
+
"warn",
|
|
104
|
+
{
|
|
105
|
+
"checkArrowFunctions": false
|
|
106
|
+
}
|
|
107
|
+
],
|
|
108
|
+
|
|
109
|
+
// ---- pedantic rules ----
|
|
110
|
+
"max-depth": [
|
|
111
|
+
"warn",
|
|
112
|
+
4
|
|
113
|
+
],
|
|
114
|
+
"no-lonely-if": "warn",
|
|
115
|
+
"typescript/no-misused-promises": [
|
|
116
|
+
"error",
|
|
117
|
+
{
|
|
118
|
+
"checksVoidReturn": false
|
|
119
|
+
}
|
|
120
|
+
],
|
|
121
|
+
"unicorn/escape-case": "warn",
|
|
122
|
+
"unicorn/no-unreadable-iife": "warn",
|
|
123
|
+
"unicorn/prefer-event-target": "warn",
|
|
124
|
+
|
|
125
|
+
// ---- restriction rules ----
|
|
126
|
+
"no-alert": "error",
|
|
127
|
+
"no-console": [
|
|
128
|
+
"error",
|
|
129
|
+
{
|
|
130
|
+
"allow": [
|
|
131
|
+
"warn",
|
|
132
|
+
"error",
|
|
133
|
+
"clear",
|
|
134
|
+
"info"
|
|
135
|
+
]
|
|
136
|
+
}
|
|
137
|
+
],
|
|
138
|
+
"no-restricted-globals": [
|
|
139
|
+
"error",
|
|
140
|
+
"event",
|
|
141
|
+
"name"
|
|
142
|
+
],
|
|
143
|
+
"no-var": "error",
|
|
144
|
+
"typescript/no-dynamic-delete": "error",
|
|
145
|
+
"typescript/no-empty-object-type": "error",
|
|
146
|
+
"typescript/no-explicit-any": "error",
|
|
147
|
+
"typescript/no-import-type-side-effects": "error",
|
|
148
|
+
"typescript/no-invalid-void-type": "error",
|
|
149
|
+
"typescript/no-namespace": "error",
|
|
150
|
+
"typescript/no-non-null-asserted-nullish-coalescing": "error",
|
|
151
|
+
"typescript/no-non-null-assertion": "error",
|
|
152
|
+
"typescript/no-require-imports": "error",
|
|
153
|
+
"typescript/non-nullable-type-assertion-style": "error",
|
|
154
|
+
"typescript/prefer-literal-enum-member": "error",
|
|
155
|
+
"typescript/use-unknown-in-catch-callback-variable": "error",
|
|
156
|
+
"unicorn/prefer-modern-math-apis": "error",
|
|
157
|
+
"unicorn/prefer-node-protocol": "error",
|
|
158
|
+
"unicorn/prefer-number-properties": [
|
|
159
|
+
"error",
|
|
160
|
+
{
|
|
161
|
+
"checkInfinity": false
|
|
162
|
+
}
|
|
163
|
+
],
|
|
164
|
+
|
|
165
|
+
// ---- perf rules ----
|
|
166
|
+
"unicorn/prefer-array-find": "error",
|
|
167
|
+
"unicorn/prefer-array-flat-map": "error",
|
|
168
|
+
"unicorn/prefer-set-has": "error",
|
|
169
|
+
|
|
170
|
+
// ---- nursery rules ----
|
|
171
|
+
"typescript/consistent-type-exports": [
|
|
172
|
+
"error",
|
|
173
|
+
{
|
|
174
|
+
"fixMixedExportsWithInlineTypeSpecifier": true
|
|
175
|
+
}
|
|
176
|
+
],
|
|
177
|
+
"typescript/prefer-regexp-exec": "warn",
|
|
178
|
+
|
|
179
|
+
// these are mostly handled by typescript compiler
|
|
180
|
+
"getter-return": "off",
|
|
181
|
+
"no-undef": "off",
|
|
182
|
+
"no-unreachable": "off",
|
|
183
|
+
"import/named": "off",
|
|
184
|
+
"import/export": "off",
|
|
185
|
+
|
|
186
|
+
// new oxlint rules in nursery below that were not configured in eslint configs before
|
|
187
|
+
|
|
188
|
+
// report duplicate code in branches
|
|
189
|
+
"oxc/branches-sharing-code": "warn",
|
|
190
|
+
// prevent mixing value and non-value returns in functions
|
|
191
|
+
"typescript/consistent-return": "warn",
|
|
192
|
+
"typescript/no-unnecessary-qualifier": "warn",
|
|
193
|
+
"typescript/prefer-readonly": "warn",
|
|
194
|
+
// this is nice, but adds a lot of noise to existing codebases
|
|
195
|
+
"typescript/prefer-readonly-parameter-types": "off",
|
|
196
|
+
"typescript/strict-void-return": "off"
|
|
197
|
+
|
|
198
|
+
},
|
|
199
|
+
"overrides": [
|
|
200
|
+
{
|
|
201
|
+
"files": [
|
|
202
|
+
"**/*.test.ts",
|
|
203
|
+
"**/*.test.tsx",
|
|
204
|
+
"**/*.spec.ts",
|
|
205
|
+
"**/*.spec.tsx"
|
|
206
|
+
],
|
|
207
|
+
"rules": {
|
|
208
|
+
"typescript/ban-ts-comment": "off"
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
]
|
|
212
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "./node_modules/oxlint/configuration_schema.json",
|
|
3
|
+
"extends": [
|
|
4
|
+
"./core.jsonc"
|
|
5
|
+
],
|
|
6
|
+
"plugins": [
|
|
7
|
+
"unicorn",
|
|
8
|
+
"typescript",
|
|
9
|
+
"oxc",
|
|
10
|
+
"import",
|
|
11
|
+
"react"
|
|
12
|
+
],
|
|
13
|
+
"rules": {
|
|
14
|
+
// ---- style rules ----
|
|
15
|
+
"react/jsx-boolean-value": "warn",
|
|
16
|
+
"react/jsx-curly-brace-presence": [
|
|
17
|
+
"warn",
|
|
18
|
+
{
|
|
19
|
+
"props": "never",
|
|
20
|
+
"children": "ignore",
|
|
21
|
+
"propElementValues": "always"
|
|
22
|
+
}
|
|
23
|
+
],
|
|
24
|
+
"react/jsx-fragments": "warn",
|
|
25
|
+
"react/jsx-pascal-case": "warn",
|
|
26
|
+
"react/self-closing-comp": "warn",
|
|
27
|
+
|
|
28
|
+
// ---- pedantic rules ----
|
|
29
|
+
"react/jsx-no-target-blank": [
|
|
30
|
+
"error",
|
|
31
|
+
{
|
|
32
|
+
"allowReferrer": true
|
|
33
|
+
}
|
|
34
|
+
],
|
|
35
|
+
"react/jsx-no-useless-fragment": [
|
|
36
|
+
"warn",
|
|
37
|
+
{
|
|
38
|
+
"allowExpressions": true
|
|
39
|
+
}
|
|
40
|
+
],
|
|
41
|
+
|
|
42
|
+
// ---- restriction rules ----
|
|
43
|
+
"react/no-unknown-property": "error",
|
|
44
|
+
"react/button-has-type": "error"
|
|
45
|
+
}
|
|
46
|
+
}
|
package/package.json
CHANGED
|
@@ -1,39 +1,50 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@timobechtel/style",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "2.1.0",
|
|
4
4
|
"type": "module",
|
|
5
|
+
"repository": {
|
|
6
|
+
"type": "git",
|
|
7
|
+
"url": "https://github.com/TimoBechtel/style"
|
|
8
|
+
},
|
|
5
9
|
"files": [
|
|
6
10
|
"bin",
|
|
7
11
|
"eslint",
|
|
8
12
|
"prettier",
|
|
9
13
|
"semantic-release",
|
|
10
|
-
"tsconfig"
|
|
14
|
+
"tsconfig",
|
|
15
|
+
"oxlint",
|
|
16
|
+
"oxfmt"
|
|
11
17
|
],
|
|
12
18
|
"devDependencies": {
|
|
13
|
-
"
|
|
14
|
-
"
|
|
15
|
-
"
|
|
16
|
-
"
|
|
19
|
+
"@semantic-release/npm": "^13.1.4",
|
|
20
|
+
"eslint": "^9.39.3",
|
|
21
|
+
"prettier": "^3.8.1",
|
|
22
|
+
"semantic-release": "^25.0.3",
|
|
23
|
+
"typescript": "^5.9.3",
|
|
24
|
+
"oxlint": "^1.55.0",
|
|
25
|
+
"oxfmt": "^0.40.0"
|
|
17
26
|
},
|
|
18
27
|
"peerDependencies": {
|
|
19
|
-
"eslint": "^
|
|
20
|
-
"prettier": "^3.
|
|
21
|
-
"semantic-release": "^
|
|
22
|
-
"typescript": "^5.
|
|
28
|
+
"eslint": "^9.39.3",
|
|
29
|
+
"prettier": "^3.8.1",
|
|
30
|
+
"semantic-release": "^25.0.3",
|
|
31
|
+
"typescript": "^5.9.3",
|
|
32
|
+
"oxlint": "^1.55.0",
|
|
33
|
+
"oxfmt": "^0.40.0"
|
|
23
34
|
},
|
|
24
35
|
"dependencies": {
|
|
36
|
+
"@eslint/js": "^9.39.3",
|
|
25
37
|
"@semantic-release/changelog": "^6.0.3",
|
|
26
38
|
"@semantic-release/git": "^10.0.1",
|
|
27
39
|
"@timobechtel/eslint-plugin-rules": "^1.0.0",
|
|
28
|
-
"
|
|
29
|
-
"
|
|
30
|
-
"eslint-
|
|
31
|
-
"eslint-
|
|
32
|
-
"eslint-
|
|
33
|
-
"eslint-plugin-
|
|
34
|
-
"
|
|
35
|
-
"
|
|
36
|
-
"eslint
|
|
37
|
-
"eslint-plugin-unicorn": "^56.0.1"
|
|
40
|
+
"eslint-config-prettier": "^10.1.8",
|
|
41
|
+
"eslint-import-resolver-typescript": "^4.4.4",
|
|
42
|
+
"eslint-plugin-import-x": "^4.16.1",
|
|
43
|
+
"eslint-plugin-react": "^7.37.5",
|
|
44
|
+
"eslint-plugin-react-hooks": "^7.0.1",
|
|
45
|
+
"eslint-plugin-unicorn": "^63.0.0",
|
|
46
|
+
"globals": "^17.3.0",
|
|
47
|
+
"oxlint-tsgolint": "^0.16.0",
|
|
48
|
+
"typescript-eslint": "^8.56.0"
|
|
38
49
|
}
|
|
39
50
|
}
|
package/eslint/core.cjs
DELETED
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
// @ts-check
|
|
2
|
-
const { defineConfig } = require('eslint-define-config');
|
|
3
|
-
|
|
4
|
-
module.exports = defineConfig({
|
|
5
|
-
extends: [
|
|
6
|
-
'eslint:recommended',
|
|
7
|
-
'plugin:import/recommended',
|
|
8
|
-
'prettier',
|
|
9
|
-
'plugin:no-template-curly-in-string-fix/recommended',
|
|
10
|
-
'plugin:@timobechtel/rules/all',
|
|
11
|
-
require.resolve('./rules/base.cjs'),
|
|
12
|
-
require.resolve('./rules/import.cjs'),
|
|
13
|
-
require.resolve('./rules/unicorn.cjs'),
|
|
14
|
-
],
|
|
15
|
-
parser: '@typescript-eslint/parser',
|
|
16
|
-
plugins: [],
|
|
17
|
-
env: {
|
|
18
|
-
es2021: true,
|
|
19
|
-
node: true,
|
|
20
|
-
browser: true,
|
|
21
|
-
},
|
|
22
|
-
// Report unused `eslint-disable` comments.
|
|
23
|
-
reportUnusedDisableDirectives: true,
|
|
24
|
-
// Tell ESLint not to ignore dot-files, which are ignored by default.
|
|
25
|
-
ignorePatterns: ['!.*.js'],
|
|
26
|
-
// Global settings used by all overrides.
|
|
27
|
-
settings: {
|
|
28
|
-
// Use the Node resolver by default.
|
|
29
|
-
'import/resolver': { node: {} },
|
|
30
|
-
},
|
|
31
|
-
// Global parser options.
|
|
32
|
-
parserOptions: {
|
|
33
|
-
ecmaVersion: 2021,
|
|
34
|
-
sourceType: 'module',
|
|
35
|
-
projectService: true,
|
|
36
|
-
},
|
|
37
|
-
overrides: [
|
|
38
|
-
{
|
|
39
|
-
files: ['*.ts?(x)'],
|
|
40
|
-
extends: [
|
|
41
|
-
'plugin:@typescript-eslint/recommended',
|
|
42
|
-
'plugin:@typescript-eslint/recommended-type-checked',
|
|
43
|
-
'plugin:@typescript-eslint/strict',
|
|
44
|
-
'plugin:@typescript-eslint/strict-type-checked',
|
|
45
|
-
'plugin:@typescript-eslint/stylistic',
|
|
46
|
-
'plugin:@typescript-eslint/stylistic-type-checked',
|
|
47
|
-
'plugin:import/typescript',
|
|
48
|
-
'prettier',
|
|
49
|
-
require.resolve('./rules/typescript.cjs'),
|
|
50
|
-
],
|
|
51
|
-
},
|
|
52
|
-
{
|
|
53
|
-
files: ['*.test.ts?(x)', '*.spec.ts?(x)'],
|
|
54
|
-
rules: {
|
|
55
|
-
// ts-expect-error makes sense for tests
|
|
56
|
-
'@typescript-eslint/ban-ts-comment': [
|
|
57
|
-
'off',
|
|
58
|
-
{ 'ts-expect-error': 'off' },
|
|
59
|
-
],
|
|
60
|
-
},
|
|
61
|
-
},
|
|
62
|
-
],
|
|
63
|
-
});
|
package/eslint/react.cjs
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
// @ts-check
|
|
2
|
-
const { defineConfig } = require('eslint-define-config');
|
|
3
|
-
|
|
4
|
-
module.exports = defineConfig({
|
|
5
|
-
extends: [
|
|
6
|
-
'plugin:react/recommended',
|
|
7
|
-
'plugin:react-hooks/recommended',
|
|
8
|
-
'plugin:import/react',
|
|
9
|
-
'prettier',
|
|
10
|
-
require.resolve('./rules/react.cjs'),
|
|
11
|
-
],
|
|
12
|
-
settings: {
|
|
13
|
-
react: {
|
|
14
|
-
version: 'detect',
|
|
15
|
-
},
|
|
16
|
-
linkComponents: [
|
|
17
|
-
// Components used as alternatives to <a> for linking, eg. <Link to={ url } />
|
|
18
|
-
'Link',
|
|
19
|
-
],
|
|
20
|
-
},
|
|
21
|
-
});
|
package/eslint/rules/base.cjs
DELETED
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
// @ts-check
|
|
2
|
-
const { defineConfig } = require('eslint-define-config');
|
|
3
|
-
|
|
4
|
-
module.exports = defineConfig({
|
|
5
|
-
rules: {
|
|
6
|
-
// prefer arrow functions for callbacks
|
|
7
|
-
'prefer-arrow-callback': [
|
|
8
|
-
'warn',
|
|
9
|
-
{
|
|
10
|
-
allowNamedFunctions: true,
|
|
11
|
-
allowUnboundThis: true,
|
|
12
|
-
},
|
|
13
|
-
],
|
|
14
|
-
// console logs other than error and warn are only needed for debugging, so they should be removed before merging
|
|
15
|
-
'no-console': [
|
|
16
|
-
'error',
|
|
17
|
-
{
|
|
18
|
-
allow: [
|
|
19
|
-
'warn',
|
|
20
|
-
'error',
|
|
21
|
-
'clear',
|
|
22
|
-
// sometimes we really need to log something, even in production, so info is allowed in edge cases
|
|
23
|
-
'info',
|
|
24
|
-
],
|
|
25
|
-
},
|
|
26
|
-
],
|
|
27
|
-
'max-depth': ['warn', 4],
|
|
28
|
-
// some globals, like "name" might be similar to the name of a variable, so we prevent them from being used
|
|
29
|
-
'no-restricted-globals': ['error', 'event', 'name'],
|
|
30
|
-
// Require curly braces for multiline blocks.
|
|
31
|
-
curly: ['warn', 'multi-line'],
|
|
32
|
-
// Require default clauses in switch statements to be last (if used).
|
|
33
|
-
'default-case-last': 'error',
|
|
34
|
-
// Require triple equals (`===` and `!==`).
|
|
35
|
-
eqeqeq: 'error',
|
|
36
|
-
// disallow the use of `alert()`
|
|
37
|
-
'no-alert': 'error',
|
|
38
|
-
// Disallow renaming import, export, and destructured assignments to the same name.
|
|
39
|
-
'no-useless-rename': 'warn',
|
|
40
|
-
// Require `let` or `const` instead of `var`.
|
|
41
|
-
'no-var': 'error',
|
|
42
|
-
// Require object literal shorthand syntax.
|
|
43
|
-
'object-shorthand': 'warn',
|
|
44
|
-
// Require default to `const` instead of `let`.
|
|
45
|
-
'prefer-const': 'warn',
|
|
46
|
-
// Require rest parameters instead of `arguments`.
|
|
47
|
-
'prefer-rest-params': 'error',
|
|
48
|
-
// Require spread syntax instead of `.apply()`.
|
|
49
|
-
'prefer-spread': 'error',
|
|
50
|
-
// Require template literals instead of string concatenation.
|
|
51
|
-
'prefer-template': 'warn',
|
|
52
|
-
// Disallow returning values from Promise executor functions.
|
|
53
|
-
'no-promise-executor-return': 'error',
|
|
54
|
-
// Disallow loops with a body that allows only one iteration.
|
|
55
|
-
'no-unreachable-loop': 'error',
|
|
56
|
-
// Require a capital letter for constructors.
|
|
57
|
-
'new-cap': ['error', { capIsNew: false }],
|
|
58
|
-
// Disallow the omission of parentheses when invoking a constructor with no arguments.
|
|
59
|
-
'new-parens': 'warn',
|
|
60
|
-
// Disallow if as the only statement in an else block.
|
|
61
|
-
'no-lonely-if': 'warn',
|
|
62
|
-
// Disallow ternary operators when simpler alternatives exist.
|
|
63
|
-
'no-unneeded-ternary': 'error',
|
|
64
|
-
// Require use of an object spread over Object.assign.
|
|
65
|
-
'prefer-object-spread': 'warn',
|
|
66
|
-
// Disallow labels that share a name with a variable.
|
|
67
|
-
'no-label-var': 'error',
|
|
68
|
-
// Disallow initializing variables to `undefined`.
|
|
69
|
-
'no-undef-init': 'warn',
|
|
70
|
-
// Disallow unused variables.
|
|
71
|
-
'no-unused-vars': [
|
|
72
|
-
'error',
|
|
73
|
-
{
|
|
74
|
-
args: 'after-used',
|
|
75
|
-
argsIgnorePattern: '^_',
|
|
76
|
-
ignoreRestSiblings: false,
|
|
77
|
-
vars: 'all',
|
|
78
|
-
varsIgnorePattern: '^_',
|
|
79
|
-
},
|
|
80
|
-
],
|
|
81
|
-
// Disallow expressions where the operation doesn't affect the value
|
|
82
|
-
'no-constant-binary-expression': 'error',
|
|
83
|
-
},
|
|
84
|
-
});
|