@naturalcycles/dev-lib 20.1.0 → 20.1.2
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/cfg/biome.jsonc +10 -9
- package/cfg/eslint-rules.js +17 -16
- package/cfg/eslint.config.js +3 -2
- package/cfg/lint-staged.config.js +1 -1
- package/cfg/oxlint.config.json +30 -6
- package/dist/lint.util.js +2 -4
- package/package.json +2 -2
package/cfg/biome.jsonc
CHANGED
|
@@ -33,17 +33,17 @@
|
|
|
33
33
|
"recommended": true,
|
|
34
34
|
"performance": {
|
|
35
35
|
// "useTopLevelRegex": "error" // consider
|
|
36
|
-
"noDelete": "off" //
|
|
36
|
+
"noDelete": "off" // oxlint
|
|
37
37
|
},
|
|
38
38
|
"correctness": {
|
|
39
|
-
"useImportExtensions": "
|
|
39
|
+
"useImportExtensions": "off", // oxlint
|
|
40
40
|
"useParseIntRadix": "off",
|
|
41
|
-
"noUnusedFunctionParameters": "
|
|
41
|
+
"noUnusedFunctionParameters": "off", // oxlint
|
|
42
42
|
// noUnusedImports + noUnusedVariables can replace eslint-plugin-unused-vars!
|
|
43
|
-
"noUnusedImports": "
|
|
43
|
+
"noUnusedImports": "off", // oxlint
|
|
44
44
|
"noUnusedVariables": {
|
|
45
45
|
"fix": "none",
|
|
46
|
-
"level": "
|
|
46
|
+
"level": "off", // oxlint
|
|
47
47
|
"options": {}
|
|
48
48
|
}
|
|
49
49
|
},
|
|
@@ -55,9 +55,9 @@
|
|
|
55
55
|
"noDoneCallback": "error",
|
|
56
56
|
"useShorthandFunctionType": "error",
|
|
57
57
|
"useShorthandAssign": "error",
|
|
58
|
-
"useForOf": "
|
|
58
|
+
"useForOf": "off", // oxlint
|
|
59
59
|
"useConsistentArrayType": "error",
|
|
60
|
-
"noDefaultExport": "
|
|
60
|
+
"noDefaultExport": "off", // oxlint
|
|
61
61
|
"noNonNullAssertion": "off",
|
|
62
62
|
"useImportType": "error",
|
|
63
63
|
"noParameterAssign": "off",
|
|
@@ -71,8 +71,8 @@
|
|
|
71
71
|
"useSingleVarDeclarator": "error",
|
|
72
72
|
"noInferrableTypes": "error",
|
|
73
73
|
"noUselessElse": "error",
|
|
74
|
-
"useArrayLiterals": "error"
|
|
75
|
-
"noCommonJs": "error"
|
|
74
|
+
"useArrayLiterals": "error"
|
|
75
|
+
// "noCommonJs": "error" // oxlint
|
|
76
76
|
},
|
|
77
77
|
"suspicious": {
|
|
78
78
|
"useNumberToFixedDigitsArgument": "error",
|
|
@@ -85,6 +85,7 @@
|
|
|
85
85
|
"noGlobalIsNan": "off", // todo,
|
|
86
86
|
"noThenProperty": "off",
|
|
87
87
|
"noImportAssign": "off",
|
|
88
|
+
"noDoubleEquals": "off", // oxlint
|
|
88
89
|
"noEmptyInterface": "off"
|
|
89
90
|
},
|
|
90
91
|
"complexity": {
|
package/cfg/eslint-rules.js
CHANGED
|
@@ -140,9 +140,9 @@ export default {
|
|
|
140
140
|
'@typescript-eslint/no-misused-new': 2,
|
|
141
141
|
'@typescript-eslint/no-misused-spread': 2,
|
|
142
142
|
'@typescript-eslint/no-non-null-asserted-optional-chain': 2,
|
|
143
|
-
'@typescript-eslint/no-unused-expressions':
|
|
143
|
+
'@typescript-eslint/no-unused-expressions': 0, // oxlint
|
|
144
144
|
'@typescript-eslint/prefer-as-const': 2,
|
|
145
|
-
'@typescript-eslint/prefer-for-of':
|
|
145
|
+
'@typescript-eslint/prefer-for-of': 0, // oxlint
|
|
146
146
|
'@typescript-eslint/prefer-function-type': 2,
|
|
147
147
|
'@typescript-eslint/prefer-namespace-keyword': 2,
|
|
148
148
|
'@typescript-eslint/promise-function-async': [
|
|
@@ -162,7 +162,7 @@ export default {
|
|
|
162
162
|
},
|
|
163
163
|
],
|
|
164
164
|
'constructor-super': 2,
|
|
165
|
-
eqeqeq: [2, 'smart'],
|
|
165
|
+
// eqeqeq: [2, 'smart'], // oxlint
|
|
166
166
|
'for-direction': 2,
|
|
167
167
|
'getter-return': 2,
|
|
168
168
|
'id-blacklist': [
|
|
@@ -189,10 +189,10 @@ export default {
|
|
|
189
189
|
// 'import-x/order': 0, // disabled in favor of `simple-import-sort`
|
|
190
190
|
// 'import-x/namespace': 0, // issues with e.g globby
|
|
191
191
|
// 'import-x/no-unresolved': 0, // breaks for type-aliases, e.g '@/store'
|
|
192
|
-
'import-x/no-anonymous-default-export':
|
|
193
|
-
'import-x/no-duplicates': [
|
|
194
|
-
'import-x/export': 2,
|
|
195
|
-
'import-x/no-empty-named-blocks':
|
|
192
|
+
'import-x/no-anonymous-default-export': 0, // oxlint
|
|
193
|
+
'import-x/no-duplicates': [0, { 'prefer-inline': false }], // oxlint
|
|
194
|
+
'import-x/export': 2, // todo: oxlint when it matures
|
|
195
|
+
'import-x/no-empty-named-blocks': 0, // oxlint
|
|
196
196
|
// Disabling no-cycle as the slowest rule. Oxlint is to be adopted instead
|
|
197
197
|
// 'import-x/no-cycle': [
|
|
198
198
|
// 2,
|
|
@@ -203,12 +203,9 @@ export default {
|
|
|
203
203
|
// },
|
|
204
204
|
// ],
|
|
205
205
|
'import-x/no-useless-path-segments': 2,
|
|
206
|
-
'import-x/no-default-export': 0, // biome
|
|
206
|
+
'import-x/no-default-export': 0, // biome, oxlint
|
|
207
207
|
// 'import-x/no-commonjs': 2, // biome `noCommonJs`
|
|
208
208
|
// 'import-x/extensions': [2, 'always'], // biome useImportExtensions
|
|
209
|
-
'jsdoc/check-alignment': 2,
|
|
210
|
-
// "jsdoc/check-indentation": "error",
|
|
211
|
-
// 'jsdoc/newline-after-description': 2,
|
|
212
209
|
'no-array-constructor': 0,
|
|
213
210
|
'no-async-promise-executor': 2,
|
|
214
211
|
'no-bitwise': 2,
|
|
@@ -298,7 +295,7 @@ export default {
|
|
|
298
295
|
'no-useless-catch': 2,
|
|
299
296
|
'no-useless-escape': 2,
|
|
300
297
|
'no-useless-assignment': 2,
|
|
301
|
-
'no-unneeded-ternary':
|
|
298
|
+
'no-unneeded-ternary': 0, // oxlint
|
|
302
299
|
'no-duplicate-imports': 0, // too many false-positives (with e.g import type + import on next line)
|
|
303
300
|
'no-var': 2,
|
|
304
301
|
'no-with': 2,
|
|
@@ -321,7 +318,7 @@ export default {
|
|
|
321
318
|
'use-isnan': 2,
|
|
322
319
|
'valid-typeof': 2,
|
|
323
320
|
'no-await-in-loop': 0, // it's actually often ok
|
|
324
|
-
'no-extend-native':
|
|
321
|
+
'no-extend-native': 0, // oxlint
|
|
325
322
|
'guard-for-in': 2,
|
|
326
323
|
'@typescript-eslint/no-namespace': [
|
|
327
324
|
2,
|
|
@@ -348,7 +345,7 @@ export default {
|
|
|
348
345
|
'@typescript-eslint/no-empty-function': 0,
|
|
349
346
|
'@typescript-eslint/no-var-requires': 0,
|
|
350
347
|
'@typescript-eslint/no-require-imports': 0,
|
|
351
|
-
'@typescript-eslint/no-explicit-any': 0,
|
|
348
|
+
'@typescript-eslint/no-explicit-any': 0, // oxlint
|
|
352
349
|
'@typescript-eslint/no-non-null-assertion': 0,
|
|
353
350
|
'@typescript-eslint/explicit-module-boundary-types': [
|
|
354
351
|
2,
|
|
@@ -384,9 +381,13 @@ export default {
|
|
|
384
381
|
'unicorn/prefer-spread': 0, // fails on joiSchema.concat() which is not an array!
|
|
385
382
|
'unicorn/prefer-structured-clone': 0, // no real advantage, plus in most of the cases we want JSON to remove undefined, etc.
|
|
386
383
|
'unicorn/better-regex': 0, // we still believe that [0-9] is clearer than [\d]
|
|
384
|
+
'unicorn/no-for-loop': 0, // oxlint has similar
|
|
385
|
+
'unicorn/no-array-reduce': 0, // oxlint
|
|
386
|
+
'unicorn/no-accessor-recursion': 0, // oxlint
|
|
387
|
+
'unicorn/no-anonymous-default-export': 0, // oxlint
|
|
387
388
|
'unicorn/no-object-as-default-parameter': 0, // doesn't allow e.g method (opt = { skipValidation: true })
|
|
388
389
|
'unicorn/catch-error-name': [
|
|
389
|
-
|
|
390
|
+
0, // oxlint
|
|
390
391
|
{
|
|
391
392
|
name: 'err',
|
|
392
393
|
ignore: [/^err\d*$/, /^_/],
|
|
@@ -448,7 +449,7 @@ export default {
|
|
|
448
449
|
'max-params': [2, { max: 5 }],
|
|
449
450
|
'no-else-return': 2,
|
|
450
451
|
'no-sequences': 2,
|
|
451
|
-
'no-useless-concat':
|
|
452
|
+
'no-useless-concat': 0, // oxlint
|
|
452
453
|
'@typescript-eslint/ban-tslint-comment': 2,
|
|
453
454
|
'@typescript-eslint/explicit-function-return-type': [
|
|
454
455
|
2,
|
package/cfg/eslint.config.js
CHANGED
|
@@ -9,10 +9,10 @@ import eslint from '@eslint/js'
|
|
|
9
9
|
import tseslint from 'typescript-eslint'
|
|
10
10
|
import eslintPluginUnicorn from 'eslint-plugin-unicorn'
|
|
11
11
|
import eslintPluginVue from 'eslint-plugin-vue'
|
|
12
|
+
import eslintPluginOxlint from 'eslint-plugin-oxlint'
|
|
12
13
|
import eslintPluginVitest from '@vitest/eslint-plugin'
|
|
13
14
|
import eslintPluginImportX from 'eslint-plugin-import-x'
|
|
14
15
|
import eslintPluginSimpleImportSort from 'eslint-plugin-simple-import-sort'
|
|
15
|
-
import eslintPluginJsdoc from 'eslint-plugin-jsdoc'
|
|
16
16
|
import eslintPluginStylistic from '@stylistic/eslint-plugin'
|
|
17
17
|
import eslintRules from './eslint-rules.js'
|
|
18
18
|
import eslintVueRules from './eslint-vue-rules.js'
|
|
@@ -105,7 +105,7 @@ function getConfig(tsconfigPath) {
|
|
|
105
105
|
'import-x': eslintPluginImportX,
|
|
106
106
|
// 'unused-imports': require('eslint-plugin-unused-imports'), // disabled in favor of biome rules
|
|
107
107
|
'simple-import-sort': eslintPluginSimpleImportSort,
|
|
108
|
-
jsdoc: eslintPluginJsdoc,
|
|
108
|
+
// jsdoc: eslintPluginJsdoc, // oxlint
|
|
109
109
|
'@stylistic': eslintPluginStylistic,
|
|
110
110
|
},
|
|
111
111
|
languageOptions: {
|
|
@@ -131,6 +131,7 @@ function getConfig(tsconfigPath) {
|
|
|
131
131
|
...eslintVueRules.rules,
|
|
132
132
|
...eslintPrettierRules.rules, // disable eslint rules already covered by prettier
|
|
133
133
|
...eslintBiomeRules.rules, // disable eslint rules already covered by biome
|
|
134
|
+
...eslintPluginOxlint.configs['flat/all'].rules, // disable eslint rules already covered by oxlint
|
|
134
135
|
},
|
|
135
136
|
}
|
|
136
137
|
}
|
|
@@ -65,7 +65,7 @@ if (eslintConfigPath) {
|
|
|
65
65
|
let oxlintCmd = undefined
|
|
66
66
|
|
|
67
67
|
if (oxlintConfigPath) {
|
|
68
|
-
oxlintCmd = ['oxlint', '--fix', '--max-warnings=1'].filter(Boolean).join(' ')
|
|
68
|
+
oxlintCmd = ['oxlint', '--fix', '--fix-suggestions', '--max-warnings=1'].filter(Boolean).join(' ')
|
|
69
69
|
}
|
|
70
70
|
|
|
71
71
|
const stylelintExists =
|
package/cfg/oxlint.config.json
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
+
"$schema": "../node_modules/oxlint/configuration_schema.json",
|
|
2
3
|
"plugins": [
|
|
3
4
|
"oxc",
|
|
4
5
|
"eslint",
|
|
@@ -32,14 +33,33 @@
|
|
|
32
33
|
"no-unused-expressions": 2,
|
|
33
34
|
"no-var": 2,
|
|
34
35
|
"unicode-bom": 2,
|
|
36
|
+
"no-extend-native": 2,
|
|
37
|
+
"no-extra-bind": 2,
|
|
38
|
+
"no-new": 2,
|
|
39
|
+
"no-unexpected-multiline": 2,
|
|
40
|
+
"no-unneeded-ternary": 2,
|
|
41
|
+
"no-useless-concat": 2,
|
|
42
|
+
"no-useless-constructor": 2,
|
|
43
|
+
"preserve-caught-error": 2,
|
|
44
|
+
"eqeqeq": [2, "smart"],
|
|
35
45
|
"import/extensions": [2, "always"],
|
|
36
46
|
"import/no-amd": 2,
|
|
37
47
|
"import/no-commonjs": 2,
|
|
38
48
|
"import/no-cycle": 2,
|
|
39
49
|
"import/no-default-export": 2,
|
|
40
50
|
"import/no-webpack-loader-syntax": 2,
|
|
51
|
+
"import/no-duplicates": [2, { "prefer-inline": false }],
|
|
52
|
+
// "import/export": 2, // todo: adopt when it graduates
|
|
53
|
+
"import/no-empty-named-blocks": 2,
|
|
54
|
+
"import/no-absolute-path": 2,
|
|
55
|
+
"import/no-named-as-default": 2,
|
|
56
|
+
"import/no-named-as-default-member": 0,
|
|
57
|
+
"import/no-self-import": 2,
|
|
58
|
+
"import/no-unassigned-import": 0,
|
|
41
59
|
"oxc/bad-bitwise-operator": 2,
|
|
42
60
|
"oxc/no-const-enum": 2,
|
|
61
|
+
"oxc/approx-constant": 2,
|
|
62
|
+
"oxc/misrefactored-assign-op": 2,
|
|
43
63
|
"promise/spec-only": 2,
|
|
44
64
|
"typescript/explicit-function-return-type": [2, { "allowExpressions": true }],
|
|
45
65
|
// "typescript/explicit-module-boundary-types": [2, {"allowArgumentsExplicitlyTypedAsAny": true}]
|
|
@@ -60,18 +80,22 @@
|
|
|
60
80
|
"checkMethodDeclarations": true
|
|
61
81
|
}
|
|
62
82
|
],
|
|
83
|
+
"typescript/prefer-for-of": 2,
|
|
63
84
|
"unicorn/no-anonymous-default-export": 2,
|
|
64
|
-
"unicorn/no-array-reduce":
|
|
65
|
-
2,
|
|
66
|
-
{
|
|
67
|
-
"allowSimpleOperations": true
|
|
68
|
-
}
|
|
69
|
-
],
|
|
85
|
+
"unicorn/no-array-reduce": 2,
|
|
70
86
|
"unicorn/no-document-cookie": 2,
|
|
71
87
|
"unicorn/no-length-as-slice-end": 2,
|
|
72
88
|
"unicorn/no-magic-array-flat-depth": 2,
|
|
73
89
|
"unicorn/prefer-modern-math-apis": 2,
|
|
74
90
|
"unicorn/prefer-node-protocol": 2,
|
|
91
|
+
"unicorn/catch-error-name": [
|
|
92
|
+
2,
|
|
93
|
+
{
|
|
94
|
+
"name": "err",
|
|
95
|
+
"ignore": ["^err\\d*$", "^_"]
|
|
96
|
+
}
|
|
97
|
+
],
|
|
98
|
+
"unicorn/no-accessor-recursion": 2,
|
|
75
99
|
"vue/no-multiple-slot-args": 2
|
|
76
100
|
},
|
|
77
101
|
"settings": {
|
package/dist/lint.util.js
CHANGED
|
@@ -138,13 +138,12 @@ export function runOxlint(fix = true) {
|
|
|
138
138
|
}
|
|
139
139
|
const oxlintPath = findPackageBinPath('oxlint', 'oxlint');
|
|
140
140
|
exec2.spawn(oxlintPath, {
|
|
141
|
-
name: ['
|
|
141
|
+
name: ['oxlint', !fix && '--no-fix'].filter(Boolean).join(' '),
|
|
142
142
|
args: [
|
|
143
143
|
// '--report-unused-disable-directives',
|
|
144
144
|
'--max-warnings=1',
|
|
145
|
-
fix
|
|
145
|
+
fix && '--fix --fix-suggestions',
|
|
146
146
|
].filter(_isTruthy),
|
|
147
|
-
logFinish: false,
|
|
148
147
|
shell: false,
|
|
149
148
|
});
|
|
150
149
|
}
|
|
@@ -281,7 +280,6 @@ export function runBiome(fix = true) {
|
|
|
281
280
|
exec2.spawn(biomePath, {
|
|
282
281
|
name: fix ? 'biome' : 'biome --no-fix',
|
|
283
282
|
args: [`lint`, fix && '--write', fix && '--unsafe', '--no-errors-on-unmatched', ...dirs].filter(_isTruthy),
|
|
284
|
-
logFinish: false,
|
|
285
283
|
shell: false,
|
|
286
284
|
});
|
|
287
285
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@naturalcycles/dev-lib",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "20.1.
|
|
4
|
+
"version": "20.1.2",
|
|
5
5
|
"dependencies": {
|
|
6
6
|
"@biomejs/biome": "^2",
|
|
7
7
|
"@commitlint/cli": "^20",
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
"@vitest/eslint-plugin": "^1",
|
|
16
16
|
"eslint": "^9",
|
|
17
17
|
"eslint-plugin-import-x": "^4",
|
|
18
|
-
"eslint-plugin-
|
|
18
|
+
"eslint-plugin-oxlint": "^1",
|
|
19
19
|
"eslint-plugin-simple-import-sort": "^12",
|
|
20
20
|
"eslint-plugin-unicorn": "^61",
|
|
21
21
|
"eslint-plugin-vue": "^10",
|