@naturalcycles/dev-lib 15.8.2 → 15.9.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/cfg/biome.jsonc +0 -1
- package/cfg/eslint-biome-rules.js +171 -0
- package/cfg/eslint.config.js +1 -0
- package/cfg/lint-staged.config.js +2 -2
- package/dist/bin/dev-lib.js +2 -2
- package/dist/lint.util.d.ts +1 -1
- package/dist/lint.util.js +8 -10
- package/package.json +2 -2
package/cfg/biome.jsonc
CHANGED
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
// Copy-pasted from https://github.com/SrBrahma/eslint-config-biome/blob/main/index.js
|
|
2
|
+
module.exports = {
|
|
3
|
+
rules: {
|
|
4
|
+
'constructor-super': 0,
|
|
5
|
+
'default-case-last': 0,
|
|
6
|
+
'default-param-last': 0,
|
|
7
|
+
'dot-notation': 0,
|
|
8
|
+
eqeqeq: 0,
|
|
9
|
+
'for-direction': 0,
|
|
10
|
+
'getter-return': 0,
|
|
11
|
+
'no-async-promise-executor': 0,
|
|
12
|
+
'no-case-declarations': 0,
|
|
13
|
+
'no-class-assign': 0,
|
|
14
|
+
'no-compare-neg-zero': 0,
|
|
15
|
+
'no-cond-assign': 0,
|
|
16
|
+
'no-const-assign': 0,
|
|
17
|
+
'no-constant-condition': 0,
|
|
18
|
+
'no-constructor-return': 0,
|
|
19
|
+
'no-control-regex': 0,
|
|
20
|
+
'no-debugger': 0,
|
|
21
|
+
'no-delete-var': 0,
|
|
22
|
+
'no-dupe-args': 0,
|
|
23
|
+
'no-dupe-class-members': 0,
|
|
24
|
+
'no-dupe-keys': 0,
|
|
25
|
+
'no-duplicate-case': 0,
|
|
26
|
+
'no-else-return': 0,
|
|
27
|
+
'no-empty': 0,
|
|
28
|
+
'no-empty-character-class': 0,
|
|
29
|
+
'no-empty-pattern': 0,
|
|
30
|
+
'no-eval': 0,
|
|
31
|
+
'no-ex-assign': 0,
|
|
32
|
+
'no-extra-boolean-cast': 0,
|
|
33
|
+
'no-extra-label': 0,
|
|
34
|
+
'no-fallthrough': 0,
|
|
35
|
+
'no-func-assign': 0,
|
|
36
|
+
'no-global-assign': 0,
|
|
37
|
+
'no-import-assign': 0,
|
|
38
|
+
'no-inner-declarations': 0,
|
|
39
|
+
'no-label-var': 0,
|
|
40
|
+
'no-labels': 0,
|
|
41
|
+
'no-lone-blocks': 0,
|
|
42
|
+
'no-loss-of-precision': 0,
|
|
43
|
+
'no-misleading-character-class': 0,
|
|
44
|
+
'no-new-native-nonconstructor': 0,
|
|
45
|
+
'no-new-symbol': 0,
|
|
46
|
+
'no-nonoctal-decimal-escape': 0,
|
|
47
|
+
'no-obj-calls': 0,
|
|
48
|
+
'no-param-reassign': 0,
|
|
49
|
+
'no-prototype-builtins': 0,
|
|
50
|
+
'no-redeclare': 0,
|
|
51
|
+
'no-regex-spaces': 0,
|
|
52
|
+
'no-return-assign': 0,
|
|
53
|
+
'no-self-assign': 0,
|
|
54
|
+
'no-self-compare': 0,
|
|
55
|
+
'no-sequences': 0,
|
|
56
|
+
'no-setter-return': 0,
|
|
57
|
+
'no-shadow-restricted-names': 0,
|
|
58
|
+
'no-sparse-array': 0,
|
|
59
|
+
'no-this-before-super': 0,
|
|
60
|
+
'no-unneeded-ternary': 0,
|
|
61
|
+
'no-unreachable': 0,
|
|
62
|
+
'no-unsafe-finally': 0,
|
|
63
|
+
'no-unsafe-negation': 0,
|
|
64
|
+
'no-unsafe-optional-chaining': 0,
|
|
65
|
+
'no-unused-labels': 0,
|
|
66
|
+
'no-use-before-define': 0,
|
|
67
|
+
'no-useless-catch': 0,
|
|
68
|
+
'no-useless-computed-key': 0,
|
|
69
|
+
'no-useless-constructor': 0,
|
|
70
|
+
'no-useless-rename': 0,
|
|
71
|
+
'no-var': 0,
|
|
72
|
+
'no-with': 0,
|
|
73
|
+
'one-var': 0,
|
|
74
|
+
'prefer-arrow-callback': 0,
|
|
75
|
+
'prefer-const': 0,
|
|
76
|
+
'prefer-exponentiation-operator': 0,
|
|
77
|
+
'prefer-numeric-literals': 0,
|
|
78
|
+
'prefer-regex-literals': 0,
|
|
79
|
+
'prefer-rest-params': 0,
|
|
80
|
+
'prefer-template': 0,
|
|
81
|
+
'require-yield': 0,
|
|
82
|
+
'use-isnan': 0,
|
|
83
|
+
'valid-typeof': 0,
|
|
84
|
+
// "@mysticatea/eslint-plugin/no-this-in-static": 0,
|
|
85
|
+
'@typescript-eslint/ban-types': 0,
|
|
86
|
+
'@typescript-eslint/consistent-type-exports': 0,
|
|
87
|
+
'@typescript-eslint/consistent-type-imports': 0,
|
|
88
|
+
'@typescript-eslint/default-param-last': 0,
|
|
89
|
+
'@typescript-eslint/dot-notation': 0,
|
|
90
|
+
'@typescript-eslint/no-dupe-class-members': 0,
|
|
91
|
+
'@typescript-eslint/no-empty-interface': 0,
|
|
92
|
+
'@typescript-eslint/no-explicit-any': 0,
|
|
93
|
+
'@typescript-eslint/no-extra-non-null-assertion': 0,
|
|
94
|
+
'@typescript-eslint/no-extraneous-class': 0,
|
|
95
|
+
'@typescript-eslint/no-import-type-side-effects': 0,
|
|
96
|
+
'@typescript-eslint/no-inferrable-types': 0,
|
|
97
|
+
'@typescript-eslint/no-invalid-void-type': 0,
|
|
98
|
+
'@typescript-eslint/no-loss-of-precision': 0,
|
|
99
|
+
'@typescript-eslint/no-misused-new': 0,
|
|
100
|
+
'@typescript-eslint/no-non-null-assertion': 0,
|
|
101
|
+
'@typescript-eslint/no-redeclare': 0,
|
|
102
|
+
'@typescript-eslint/no-this-alias': 0,
|
|
103
|
+
'@typescript-eslint/no-unnecessary-type-arguments': 0,
|
|
104
|
+
'@typescript-eslint/no-unnecessary-type-constraint': 0,
|
|
105
|
+
'@typescript-eslint/no-unsafe-declaration-merging': 0,
|
|
106
|
+
'@typescript-eslint/no-use-before-define': 0,
|
|
107
|
+
'@typescript-eslint/no-useless-constructor': 0,
|
|
108
|
+
'@typescript-eslint/no-useless-empty-export': 0,
|
|
109
|
+
'@typescript-eslint/no-useless-template-literals': 0,
|
|
110
|
+
'@typescript-eslint/prefer-as-const': 0,
|
|
111
|
+
'@typescript-eslint/prefer-enum-initializers': 0,
|
|
112
|
+
'@typescript-eslint/prefer-function-type': 0,
|
|
113
|
+
'@typescript-eslint/prefer-literal-enum-member': 0,
|
|
114
|
+
'@typescript-eslint/prefer-namespace-keyword': 0,
|
|
115
|
+
'@typescript-eslint/prefer-optional-chain': 0,
|
|
116
|
+
'jest/max-nested-describe': 0,
|
|
117
|
+
'jest/no-duplicate-hooks': 0,
|
|
118
|
+
'jest/no-export': 0,
|
|
119
|
+
'jest/no-focused-tests': 0,
|
|
120
|
+
'jsx-a11y/alt-text': 0,
|
|
121
|
+
'jsx-a11y/anchor-has-content': 0,
|
|
122
|
+
'jsx-a11y/anchor-is-valid': 0,
|
|
123
|
+
'jsx-a11y/aria-activedescendant-has-tabindex': 0,
|
|
124
|
+
'jsx-a11y/aria-props': 0,
|
|
125
|
+
'jsx-a11y/aria-proptypes': 0,
|
|
126
|
+
'jsx-a11y/aria-role': 0,
|
|
127
|
+
'jsx-a11y/aria-unsupported-elements': 0,
|
|
128
|
+
'jsx-a11y/click-events-have-key-events': 0,
|
|
129
|
+
'jsx-a11y/heading-has-content': 0,
|
|
130
|
+
'jsx-a11y/html-has-lang': 0,
|
|
131
|
+
'jsx-a11y/iframe-has-title': 0,
|
|
132
|
+
'jsx-a11y/img-redundant-alt': 0,
|
|
133
|
+
'jsx-a11y/lang': 0,
|
|
134
|
+
'jsx-a11y/media-has-caption': 0,
|
|
135
|
+
'jsx-a11y/mouse-events-have-key-events': 0,
|
|
136
|
+
'jsx-a11y/no-access-key': 0,
|
|
137
|
+
'jsx-a11y/no-aria-hidden-on-focusable': 0,
|
|
138
|
+
'jsx-a11y/no-autofocus': 0,
|
|
139
|
+
'jsx-a11y/no-distracting-elements': 0,
|
|
140
|
+
'jsx-a11y/no-interactive-element-to-noninteractive-role': 0,
|
|
141
|
+
'jsx-a11y/no-noninteractive-element-to-interactive-role': 0,
|
|
142
|
+
'jsx-a11y/no-noninteractive-tabindex': 0,
|
|
143
|
+
'jsx-a11y/no-redundant-roles': 0,
|
|
144
|
+
'jsx-a11y/role-has-required-aria-props': 0,
|
|
145
|
+
'jsx-a11y/scope': 0,
|
|
146
|
+
'jsx-a11y/tabindex-no-positive': 0,
|
|
147
|
+
'react/button-has-type': 0,
|
|
148
|
+
'react/jsx-key': 0,
|
|
149
|
+
'react/jsx-no-comment-textnodes': 0,
|
|
150
|
+
'react/jsx-no-duplicate-props': 0,
|
|
151
|
+
'react/jsx-no-target-blank': 0,
|
|
152
|
+
'react/jsx-no-useless-fragment': 0,
|
|
153
|
+
'react/no-array-index-key': 0,
|
|
154
|
+
'react/no-children-prop': 0,
|
|
155
|
+
'react/no-danger': 0,
|
|
156
|
+
'react/no-danger-with-children': 0,
|
|
157
|
+
'react/void-dom-elements-no-children': 0,
|
|
158
|
+
'react-hooks/exhaustive-deps': 0,
|
|
159
|
+
// "simple-import-sort/imports": 0, // we need it
|
|
160
|
+
'stylistic/jsx-self-closing-comp': 0,
|
|
161
|
+
'unicorn/no-array-for-each': 0,
|
|
162
|
+
'unicorn/no-instanceof-array': 0,
|
|
163
|
+
'unicorn/no-static-only-class': 0,
|
|
164
|
+
'unicorn/no-thenable': 0,
|
|
165
|
+
'unicorn/no-typeof-undefined': 0,
|
|
166
|
+
'unicorn/no-useless-switch-case': 0,
|
|
167
|
+
'unicorn/prefer-array-flat-map': 0,
|
|
168
|
+
'unicorn/prefer-node-protocol': 0,
|
|
169
|
+
'unicorn/prefer-number-properties': 0,
|
|
170
|
+
},
|
|
171
|
+
}
|
package/cfg/eslint.config.js
CHANGED
|
@@ -84,6 +84,7 @@ function getConfig() {
|
|
|
84
84
|
...require('./eslint-vue-rules').rules,
|
|
85
85
|
...(hasJest ? require('./eslint-jest-rules').rules : {}),
|
|
86
86
|
...require('eslint-config-prettier').rules,
|
|
87
|
+
...require('./eslint-biome-rules').rules, // disable eslint rules already covered by biome
|
|
87
88
|
// Override prettier-config:
|
|
88
89
|
curly: [2, 'multi-line'],
|
|
89
90
|
},
|
|
@@ -34,8 +34,8 @@ const stylelintExists =
|
|
|
34
34
|
fs.existsSync('node_modules/stylelint-config-standard-scss')
|
|
35
35
|
const stylelintCmd = stylelintExists ? `stylelint --fix --config ${stylelintConfigPath}` : undefined
|
|
36
36
|
|
|
37
|
-
const biomeInstalled = fs.existsSync('node_modules/@biomejs/biome')
|
|
38
|
-
const biomeConfigPath =
|
|
37
|
+
// const biomeInstalled = fs.existsSync('node_modules/@biomejs/biome')
|
|
38
|
+
const biomeConfigPath = ['biome.jsonc'].find(p => fs.existsSync(p))
|
|
39
39
|
const biomeCmd = biomeConfigPath && `biome lint --write --unsafe --`
|
|
40
40
|
|
|
41
41
|
if (!eslintConfigPathRoot) {
|
package/dist/bin/dev-lib.js
CHANGED
|
@@ -69,12 +69,12 @@ const commands = [
|
|
|
69
69
|
},
|
|
70
70
|
{
|
|
71
71
|
name: 'biome',
|
|
72
|
-
fn: () => (0, lint_util_1.runBiome)(
|
|
72
|
+
fn: () => (0, lint_util_1.runBiome)(),
|
|
73
73
|
desc: 'Run biome linter on all files.',
|
|
74
74
|
},
|
|
75
75
|
{
|
|
76
76
|
name: 'biome --no-fix',
|
|
77
|
-
fn: () => (0, lint_util_1.runBiome)(
|
|
77
|
+
fn: () => (0, lint_util_1.runBiome)(false),
|
|
78
78
|
desc: 'Run biome linter on all files with "auto-fix" disabled. Useful for debugging.',
|
|
79
79
|
interactiveOnly: true,
|
|
80
80
|
},
|
package/dist/lint.util.d.ts
CHANGED
|
@@ -14,5 +14,5 @@ export declare function runPrettier(): void;
|
|
|
14
14
|
export declare function stylelintAll(): void;
|
|
15
15
|
export declare function lintStagedCommand(): Promise<void>;
|
|
16
16
|
export declare function runCommitlintCommand(): void;
|
|
17
|
-
export declare function runBiome(
|
|
17
|
+
export declare function runBiome(fix?: boolean): void;
|
|
18
18
|
export {};
|
package/dist/lint.util.js
CHANGED
|
@@ -185,7 +185,6 @@ async function lintStagedCommand() {
|
|
|
185
185
|
// const lintStaged = require('lint-staged')
|
|
186
186
|
// lint-staged is ESM since 12.0
|
|
187
187
|
// const lintStaged = await import('lint-staged')
|
|
188
|
-
/* eslint-disable no-eval */
|
|
189
188
|
// biome-ignore lint/security/noGlobalEval: ok
|
|
190
189
|
const { default: lintStaged } = await eval(`import('lint-staged')`);
|
|
191
190
|
const success = await lintStaged({
|
|
@@ -229,17 +228,16 @@ function runActionLint() {
|
|
|
229
228
|
console.log(`actionlint is not installed and won't be run.\nThis is how to install it: https://github.com/rhysd/actionlint/blob/main/docs/install.md`);
|
|
230
229
|
}
|
|
231
230
|
}
|
|
232
|
-
function runBiome(
|
|
233
|
-
if (!
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
}
|
|
231
|
+
function runBiome(fix = true) {
|
|
232
|
+
// if (!fs.existsSync(`node_modules/@biomejs/biome`)) {
|
|
233
|
+
// if (verbose) {
|
|
234
|
+
// console.log(`biome is not installed (checked in node_modules/@biomejs/biome), skipping`)
|
|
235
|
+
// }
|
|
236
|
+
// return
|
|
237
|
+
// }
|
|
239
238
|
const configPath = `biome.jsonc`;
|
|
240
239
|
if (!node_fs_1.default.existsSync(configPath)) {
|
|
241
|
-
|
|
242
|
-
console.log(`biome is installed, but biome.jsonc config file is missing`);
|
|
240
|
+
console.log(`biome is skipped, because ./biome.jsonc is not present`);
|
|
243
241
|
return;
|
|
244
242
|
}
|
|
245
243
|
const dirs = [`src`, `scripts`, `e2e`, `playwright`].filter(d => node_fs_1.default.existsSync(d));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@naturalcycles/dev-lib",
|
|
3
|
-
"version": "15.
|
|
3
|
+
"version": "15.9.0",
|
|
4
4
|
"scripts": {
|
|
5
5
|
"prepare": "husky",
|
|
6
6
|
"tsn-debug": "tsn testScript.ts",
|
|
@@ -17,6 +17,7 @@
|
|
|
17
17
|
"upnc": "tsn ./src/bin/upnc.ts"
|
|
18
18
|
},
|
|
19
19
|
"dependencies": {
|
|
20
|
+
"@biomejs/biome": "^1.8.3",
|
|
20
21
|
"@commitlint/cli": "^19.0.0",
|
|
21
22
|
"@commitlint/config-conventional": "^19.0.0",
|
|
22
23
|
"@eslint/js": "^9.7.0",
|
|
@@ -50,7 +51,6 @@
|
|
|
50
51
|
"yargs": "^17.0.0"
|
|
51
52
|
},
|
|
52
53
|
"devDependencies": {
|
|
53
|
-
"@biomejs/biome": "^1.8.3",
|
|
54
54
|
"jest": "^29.0.0",
|
|
55
55
|
"stylelint": "^16.0.2",
|
|
56
56
|
"stylelint-config-standard-scss": "^13.0.0"
|