@naturalcycles/dev-lib 13.50.0 → 13.51.1
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/eslint-rules.js
CHANGED
|
@@ -149,7 +149,7 @@ module.exports = {
|
|
|
149
149
|
complexity: [
|
|
150
150
|
2,
|
|
151
151
|
{
|
|
152
|
-
max:
|
|
152
|
+
max: 40,
|
|
153
153
|
},
|
|
154
154
|
],
|
|
155
155
|
'constructor-super': 2,
|
|
@@ -283,6 +283,7 @@ module.exports = {
|
|
|
283
283
|
'no-unused-labels': 2,
|
|
284
284
|
'no-useless-catch': 2,
|
|
285
285
|
'no-useless-escape': 2,
|
|
286
|
+
'no-useless-assignment': 2,
|
|
286
287
|
'no-unneeded-ternary': 2,
|
|
287
288
|
'no-duplicate-imports': 0, // too many false-positives (with e.g import type + import on next line)
|
|
288
289
|
'no-var': 2,
|
|
@@ -4,6 +4,9 @@
|
|
|
4
4
|
Supports default configs for `prettier`, `stylelint`, `eslint`, if they are not found in target project.
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
+
// this probably doesn't work, but we're still trying
|
|
8
|
+
process.env['ESLINT_USE_FLAT_CONFIG'] = 'false'
|
|
9
|
+
|
|
7
10
|
const micromatch = require('micromatch')
|
|
8
11
|
const fs = require('node:fs')
|
|
9
12
|
const { execSync } = require('node:child_process')
|
|
@@ -10,6 +10,8 @@ const paths_cnst_1 = require("../cnst/paths.cnst");
|
|
|
10
10
|
const localConfig = `./lint-staged.config.js`;
|
|
11
11
|
const sharedConfig = `${paths_cnst_1.cfgDir}/lint-staged.config.js`;
|
|
12
12
|
const config = node_fs_1.default.existsSync(localConfig) ? localConfig : sharedConfig;
|
|
13
|
+
// this probably doesn't work, but we're still trying
|
|
14
|
+
process.env['ESLINT_USE_FLAT_CONFIG'] = 'false';
|
|
13
15
|
// await execWithArgs(`lint-staged`, [`--config`, config])
|
|
14
16
|
// const lintStaged = require('lint-staged')
|
|
15
17
|
// lint-staged is ESM since 12.0
|
package/dist/cnst/paths.cnst.js
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.scriptsDir = exports.cfgOverwriteDir = exports.cfgDir = exports.srcDir = exports.projectDir = void 0;
|
|
3
|
+
exports.scriptsDir = exports.cfgOverwriteDir = exports.cfgDir = exports.testDir = exports.srcDir = exports.projectDir = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const node_path_1 = tslib_1.__importDefault(require("node:path"));
|
|
6
6
|
exports.projectDir = node_path_1.default.join(__dirname, '../..');
|
|
7
7
|
exports.srcDir = `${exports.projectDir}/src`;
|
|
8
|
+
exports.testDir = `${exports.srcDir}/test`;
|
|
8
9
|
exports.cfgDir = `${exports.projectDir}/cfg`;
|
|
9
10
|
exports.cfgOverwriteDir = `${exports.projectDir}/cfg/overwrite`;
|
|
10
11
|
exports.scriptsDir = `${exports.projectDir}/scripts`;
|
package/dist/util/lint.util.js
CHANGED
|
@@ -5,6 +5,7 @@ const tslib_1 = require("tslib");
|
|
|
5
5
|
const node_fs_1 = tslib_1.__importDefault(require("node:fs"));
|
|
6
6
|
const nodejs_lib_1 = require("@naturalcycles/nodejs-lib");
|
|
7
7
|
const paths_cnst_1 = require("../cnst/paths.cnst");
|
|
8
|
+
const ESLINT_USE_FLAT_CONFIG = 'false';
|
|
8
9
|
function getTSConfigPath() {
|
|
9
10
|
// this is to support "Solution style tsconfig.json" (as used in Angular10, for example)
|
|
10
11
|
// return [`./tsconfig.base.json`].find(p => fs.existsSync(p)) || `./tsconfig.json`
|
|
@@ -18,13 +19,21 @@ exports.getTSConfigPathScripts = getTSConfigPathScripts;
|
|
|
18
19
|
function runESLint(dir, eslintConfigPath, tsconfigPath, extensions = ['ts', 'tsx', 'vue'], fix = true) {
|
|
19
20
|
if (!node_fs_1.default.existsSync(dir))
|
|
20
21
|
return; // faster to bail-out like this
|
|
21
|
-
(0, nodejs_lib_1.execVoidCommandSync)('eslint', getEslintArgs(dir, eslintConfigPath, tsconfigPath, extensions, fix)
|
|
22
|
+
(0, nodejs_lib_1.execVoidCommandSync)('eslint', getEslintArgs(dir, eslintConfigPath, tsconfigPath, extensions, fix), {
|
|
23
|
+
env: {
|
|
24
|
+
ESLINT_USE_FLAT_CONFIG,
|
|
25
|
+
},
|
|
26
|
+
});
|
|
22
27
|
}
|
|
23
28
|
exports.runESLint = runESLint;
|
|
24
29
|
async function runESLintAsync(dir, eslintConfigPath, tsconfigPath, extensions = ['ts', 'tsx', 'vue'], fix = true) {
|
|
25
30
|
if (!node_fs_1.default.existsSync(dir))
|
|
26
31
|
return; // faster to bail-out like this
|
|
27
|
-
await (0, nodejs_lib_1.execVoidCommand)('eslint', getEslintArgs(dir, eslintConfigPath, tsconfigPath, extensions, fix)
|
|
32
|
+
await (0, nodejs_lib_1.execVoidCommand)('eslint', getEslintArgs(dir, eslintConfigPath, tsconfigPath, extensions, fix), {
|
|
33
|
+
env: {
|
|
34
|
+
ESLINT_USE_FLAT_CONFIG,
|
|
35
|
+
},
|
|
36
|
+
});
|
|
28
37
|
}
|
|
29
38
|
exports.runESLintAsync = runESLintAsync;
|
|
30
39
|
function getEslintArgs(dir, eslintConfigPath, tsconfigPath, extensions = ['ts', 'tsx', 'vue'], fix = true) {
|
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@naturalcycles/dev-lib",
|
|
3
|
-
"version": "13.
|
|
3
|
+
"version": "13.51.1",
|
|
4
4
|
"scripts": {
|
|
5
5
|
"prepare": "husky",
|
|
6
6
|
"tsn-debug": "tsn testScript.ts",
|
|
7
|
-
"bt": "tsn ./src/bin/bt.ts",
|
|
7
|
+
"bt": "tsn ./src/bin/bt.ts && tsn eslintPrintConfig",
|
|
8
8
|
"btl": "tsn ./src/bin/btl.ts",
|
|
9
9
|
"build": "tsn ./src/bin/build.ts",
|
|
10
10
|
"tsc-prod": "tsn ./src/bin/tsc-prod.ts",
|
|
@@ -26,7 +26,6 @@
|
|
|
26
26
|
"eslint-all": "tsn ./src/bin/eslint-all.ts",
|
|
27
27
|
"up": "tsn ./src/bin/up.ts",
|
|
28
28
|
"upnc": "tsn ./src/bin/upnc.ts",
|
|
29
|
-
"eslint-print-config": "eslint --print-config src/index.ts > tmp/eslint.config.json",
|
|
30
29
|
"update-from-dev-lib": "tsn ./src/bin/update-from-dev-lib.ts"
|
|
31
30
|
},
|
|
32
31
|
"dependencies": {
|
|
@@ -40,10 +39,10 @@
|
|
|
40
39
|
"@types/yargs": "^16.0.0",
|
|
41
40
|
"@typescript-eslint/eslint-plugin": "^7.0.1",
|
|
42
41
|
"@typescript-eslint/parser": "^7.0.1",
|
|
43
|
-
"eslint": "^
|
|
42
|
+
"eslint": "^9.0.0",
|
|
44
43
|
"eslint-config-prettier": "^9.0.0",
|
|
45
44
|
"eslint-plugin-import": "^2.22.1",
|
|
46
|
-
"eslint-plugin-jest": "^
|
|
45
|
+
"eslint-plugin-jest": "^28.0.0",
|
|
47
46
|
"eslint-plugin-jsdoc": "^48.0.1",
|
|
48
47
|
"eslint-plugin-unicorn": "^52.0.0",
|
|
49
48
|
"eslint-plugin-unused-imports": "^3.0.0",
|