@naturalcycles/dev-lib 15.21.0 → 15.23.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/_cnst.js +1 -1
- package/cfg/eslint-rules.js +1 -0
- package/cfg/lint-staged.config.js +0 -23
- package/dist/bin/dev-lib.js +2 -3
- package/dist/lint.util.js +1 -7
- package/package.json +2 -2
package/cfg/_cnst.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
module.exports = {
|
|
2
2
|
prettierDirs: [
|
|
3
|
-
'src,scripts,e2e,
|
|
3
|
+
'src,scripts,e2e,docs,cfg,resources,.github,public,static,components,content,layouts,pages,plugins,middleware,store,blocks',
|
|
4
4
|
],
|
|
5
5
|
// ts,tsx,css,scss excluded, cause they need to run in special order (overlap between >1 tool):
|
|
6
6
|
prettierExtensionsExclusive: 'js,jsx,json,md,graphql,yml,yaml,html',
|
package/cfg/eslint-rules.js
CHANGED
|
@@ -382,6 +382,7 @@ module.exports = {
|
|
|
382
382
|
'unicorn/prefer-regexp-test': 0,
|
|
383
383
|
'unicorn/prefer-query-selector': 0,
|
|
384
384
|
'unicorn/prefer-prototype-methods': 0, // false-positive on node promisify() of callback functions
|
|
385
|
+
'unicorn/expiring-todo-comments': 1, // warning, instead of error
|
|
385
386
|
'@typescript-eslint/return-await': [2, 'always'],
|
|
386
387
|
'@typescript-eslint/require-await': 0,
|
|
387
388
|
'@typescript-eslint/no-misused-promises': 0,
|
|
@@ -179,29 +179,6 @@ if (fs.existsSync(`./e2e`)) {
|
|
|
179
179
|
})
|
|
180
180
|
}
|
|
181
181
|
|
|
182
|
-
// /playwright
|
|
183
|
-
if (fs.existsSync(`./playwright`)) {
|
|
184
|
-
const eslintConfigPathE2e = ['./playwright/eslint.config.js', './eslint.config.js'].find(p =>
|
|
185
|
-
fs.existsSync(p),
|
|
186
|
-
)
|
|
187
|
-
|
|
188
|
-
Object.assign(linters, {
|
|
189
|
-
// biome, eslint, Prettier
|
|
190
|
-
'./playwright/**/*.{ts,tsx}': match => {
|
|
191
|
-
const filesList = getFilesList(match)
|
|
192
|
-
if (!filesList) return []
|
|
193
|
-
return [
|
|
194
|
-
biomeCmd,
|
|
195
|
-
eslintConfigPathE2e &&
|
|
196
|
-
`${eslintCmd} --config ${eslintConfigPathE2e} --parser-options=project:./playwright/tsconfig.json`,
|
|
197
|
-
prettierCmd,
|
|
198
|
-
]
|
|
199
|
-
.filter(Boolean)
|
|
200
|
-
.map(s => `${s} ${filesList}`)
|
|
201
|
-
},
|
|
202
|
-
})
|
|
203
|
-
}
|
|
204
|
-
|
|
205
182
|
function getFilesList(match) {
|
|
206
183
|
return micromatch.not(match, lintExclude).join(' ')
|
|
207
184
|
}
|
package/dist/bin/dev-lib.js
CHANGED
|
@@ -15,7 +15,7 @@ const commands = [
|
|
|
15
15
|
{
|
|
16
16
|
name: 'tsc',
|
|
17
17
|
fn: tscAll,
|
|
18
|
-
desc: 'Run tsc in folders (src, scripts, e2e
|
|
18
|
+
desc: 'Run tsc in folders (src, scripts, e2e) if there is tsconfig.json present',
|
|
19
19
|
},
|
|
20
20
|
{ name: 'bt', fn: bt, desc: 'Build & Test: run "tsc" and then "test".' },
|
|
21
21
|
{ name: 'lbt', fn: lbt, desc: 'Lint/Build/Test: run "lint", then "tsc", then "test".' },
|
|
@@ -139,8 +139,7 @@ async function bt() {
|
|
|
139
139
|
(0, test_util_1.runJest)();
|
|
140
140
|
}
|
|
141
141
|
async function tscAll() {
|
|
142
|
-
|
|
143
|
-
await (0, build_util_1.runTSCInFolders)(['.', 'scripts', 'e2e', 'playwright'], ['--noEmit']);
|
|
142
|
+
await (0, build_util_1.runTSCInFolders)(['.', 'scripts', 'e2e'], ['--noEmit']);
|
|
144
143
|
}
|
|
145
144
|
function logEnvironment() {
|
|
146
145
|
const { platform, arch, versions: { node }, env: { CPU_LIMIT, NODE_OPTIONS = 'not defined' }, } = process;
|
package/dist/lint.util.js
CHANGED
|
@@ -100,10 +100,8 @@ async function eslintAll(opt) {
|
|
|
100
100
|
'./eslint.config.js',
|
|
101
101
|
'./eslint.config.cjs',
|
|
102
102
|
].find(p => node_fs_1.default.existsSync(p));
|
|
103
|
-
const eslintConfigPathPlaywright = ['./playwright/eslint.config.js', './eslint.config.js'].find(p => node_fs_1.default.existsSync(p));
|
|
104
103
|
const tsconfigPathScripts = [`./scripts/tsconfig.json`].find(p => node_fs_1.default.existsSync(p)) || `${paths_1.scriptsDir}/tsconfig.json`;
|
|
105
104
|
const tsconfigPathE2e = `./e2e/tsconfig.json`;
|
|
106
|
-
const tsconfigPathPlaywright = `./playwright/tsconfig.json`;
|
|
107
105
|
// todo: run on other dirs too, e.g pages, components, layouts
|
|
108
106
|
if (fix) {
|
|
109
107
|
await Promise.all([
|
|
@@ -113,8 +111,6 @@ async function eslintAll(opt) {
|
|
|
113
111
|
runESLint(`./scripts`, eslintConfigPathScripts, tsconfigPathScripts, extensions, fix),
|
|
114
112
|
// /e2e
|
|
115
113
|
runESLint(`./e2e`, eslintConfigPathE2e, tsconfigPathE2e, extensions, fix),
|
|
116
|
-
// /playwright // todo: remove after migration to e2e folder is completed
|
|
117
|
-
runESLint(`./playwright`, eslintConfigPathPlaywright, tsconfigPathPlaywright, extensions, fix),
|
|
118
114
|
]);
|
|
119
115
|
}
|
|
120
116
|
else {
|
|
@@ -125,8 +121,6 @@ async function eslintAll(opt) {
|
|
|
125
121
|
await runESLint(`./scripts`, eslintConfigPathScripts, tsconfigPathScripts, extensions, fix);
|
|
126
122
|
// /e2e
|
|
127
123
|
await runESLint(`./e2e`, eslintConfigPathE2e, tsconfigPathE2e, extensions, fix);
|
|
128
|
-
// /e2e
|
|
129
|
-
await runESLint(`./playwright`, eslintConfigPathPlaywright, tsconfigPathPlaywright, extensions, fix);
|
|
130
124
|
}
|
|
131
125
|
console.log(`${(0, nodejs_lib_1.boldGrey)('eslint-all')} ${(0, nodejs_lib_1.dimGrey)(`took ` + (0, js_lib_1._since)(started))}`);
|
|
132
126
|
}
|
|
@@ -253,7 +247,7 @@ function runBiome(fix = true) {
|
|
|
253
247
|
console.log(`biome is skipped, because ./biome.jsonc is not present`);
|
|
254
248
|
return;
|
|
255
249
|
}
|
|
256
|
-
const dirs = [`src`, `scripts`, `e2e
|
|
250
|
+
const dirs = [`src`, `scripts`, `e2e`].filter(d => node_fs_1.default.existsSync(d));
|
|
257
251
|
nodejs_lib_1.exec2.spawn(`biome`, {
|
|
258
252
|
args: [`lint`, fix && '--write', fix && '--unsafe', '--no-errors-on-unmatched', ...dirs].filter(js_lib_1._isTruthy),
|
|
259
253
|
logFinish: false,
|
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@naturalcycles/dev-lib",
|
|
3
|
-
"version": "15.
|
|
3
|
+
"version": "15.23.0",
|
|
4
4
|
"scripts": {
|
|
5
5
|
"prepare": "husky",
|
|
6
6
|
"tsn-debug": "tsn testScript.ts",
|
|
7
7
|
"dev-lib": "tsn ./src/bin/dev-lib.ts",
|
|
8
8
|
"bt": "tsn ./src/bin/dev-lib.ts bt && tsn eslintPrintConfig",
|
|
9
|
-
"lbt": "tsn ./src/bin/dev-lib.ts lbt",
|
|
9
|
+
"lbt": "tsn ./src/bin/dev-lib.ts lbt && tsn eslintPrintConfig",
|
|
10
10
|
"build": "tsn ./src/bin/dev-lib.ts build",
|
|
11
11
|
"build-prod-esm-cjs": "tsn ./src/bin/dev-lib.ts build-esm-cjs",
|
|
12
12
|
"test": "tsn ./src/bin/dev-lib.ts test",
|