@naturalcycles/dev-lib 15.17.0 → 15.18.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 -0
- package/cfg/biome.jsonc +1 -1
- package/cfg/eslint.config.js +1 -1
- package/cfg/lint-staged.config.js +3 -3
- package/dist/lint.util.js +9 -9
- package/package.json +1 -1
package/cfg/_cnst.js
CHANGED
|
@@ -6,6 +6,7 @@ module.exports = {
|
|
|
6
6
|
prettierExtensionsExclusive: 'js,jsx,json,md,graphql,yml,yaml,html',
|
|
7
7
|
// everything that prettier supports:
|
|
8
8
|
prettierExtensionsAll: 'ts,tsx,cts,mts,css,scss,js,jsx,cjs,mjs,json,md,graphql,yml,yaml,html,vue',
|
|
9
|
+
eslintExtensions: 'ts,tsx,cts,mts,vue,html',
|
|
9
10
|
stylelintExtensions: 'css,scss',
|
|
10
11
|
lintExclude: ['./**/__exclude/**', './**/dist/**', './**/cache/**', './CHANGELOG.md'],
|
|
11
12
|
}
|
package/cfg/biome.jsonc
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://biomejs.dev/schemas/1.9.2/schema.json",
|
|
3
3
|
"files": {
|
|
4
|
-
"ignore": ["**/tsconfig.json", "**/tsconfig.*.json", "**/__exclude", "**/try.ts", "*.compact.json"]
|
|
4
|
+
"ignore": ["**/*.html", "**/tsconfig.json", "**/tsconfig.*.json", "**/__exclude", "**/try.ts", "*.compact.json"]
|
|
5
5
|
},
|
|
6
6
|
"formatter": {
|
|
7
7
|
"enabled": true,
|
package/cfg/eslint.config.js
CHANGED
|
@@ -12,7 +12,7 @@ const tseslint = require('typescript-eslint')
|
|
|
12
12
|
const hasJest = require('node:fs').existsSync('./node_modules/jest')
|
|
13
13
|
// console.log({ hasJest })
|
|
14
14
|
|
|
15
|
-
const defaultFiles = ['**/*.ts', '**/*.tsx']
|
|
15
|
+
const defaultFiles = ['**/*.ts', '**/*.tsx', '**/*.cts', '**/*.mts']
|
|
16
16
|
|
|
17
17
|
module.exports = [
|
|
18
18
|
{
|
|
@@ -59,8 +59,8 @@ if (!stylelintCmd) {
|
|
|
59
59
|
}
|
|
60
60
|
|
|
61
61
|
const linters = {
|
|
62
|
-
//
|
|
63
|
-
'./src/**/*.{ts,tsx,cts,mts,vue}': match => {
|
|
62
|
+
// biome, eslint, prettier
|
|
63
|
+
'./src/**/*.{ts,tsx,cts,mts,vue,html}': match => {
|
|
64
64
|
const filesList = getFilesList(match)
|
|
65
65
|
if (!filesList) return []
|
|
66
66
|
return [
|
|
@@ -141,7 +141,7 @@ if (fs.existsSync(`./scripts`)) {
|
|
|
141
141
|
)
|
|
142
142
|
Object.assign(linters, {
|
|
143
143
|
// biome, eslint, Prettier
|
|
144
|
-
'./scripts/**/*.{ts,tsx,cts,mts}': match => {
|
|
144
|
+
'./scripts/**/*.{ts,tsx,cts,mts,vue,html}': match => {
|
|
145
145
|
const filesList = getFilesList(match)
|
|
146
146
|
if (!filesList) return []
|
|
147
147
|
return [
|
package/dist/lint.util.js
CHANGED
|
@@ -14,7 +14,7 @@ const js_lib_1 = require("@naturalcycles/js-lib");
|
|
|
14
14
|
const nodejs_lib_1 = require("@naturalcycles/nodejs-lib");
|
|
15
15
|
const yargs_1 = tslib_1.__importDefault(require("yargs"));
|
|
16
16
|
const paths_1 = require("./paths");
|
|
17
|
-
const { prettierDirs, prettierExtensionsAll, stylelintExtensions, lintExclude, } = require('../cfg/_cnst');
|
|
17
|
+
const { prettierDirs, prettierExtensionsAll, stylelintExtensions, eslintExtensions, lintExclude, } = require('../cfg/_cnst');
|
|
18
18
|
/**
|
|
19
19
|
* Run all linters.
|
|
20
20
|
*/
|
|
@@ -75,7 +75,7 @@ async function eslintAll(opt) {
|
|
|
75
75
|
const { argv } = yargs_1.default.options({
|
|
76
76
|
ext: {
|
|
77
77
|
type: 'string',
|
|
78
|
-
default:
|
|
78
|
+
default: eslintExtensions,
|
|
79
79
|
},
|
|
80
80
|
fix: {
|
|
81
81
|
type: 'boolean',
|
|
@@ -110,11 +110,11 @@ async function eslintAll(opt) {
|
|
|
110
110
|
// /src
|
|
111
111
|
runESLint(`./src`, eslintConfigPathRoot, undefined, extensions, fix),
|
|
112
112
|
// /scripts
|
|
113
|
-
runESLint(`./scripts`, eslintConfigPathScripts, tsconfigPathScripts,
|
|
113
|
+
runESLint(`./scripts`, eslintConfigPathScripts, tsconfigPathScripts, extensions, fix),
|
|
114
114
|
// /e2e
|
|
115
|
-
runESLint(`./e2e`, eslintConfigPathE2e, tsconfigPathE2e,
|
|
115
|
+
runESLint(`./e2e`, eslintConfigPathE2e, tsconfigPathE2e, extensions, fix),
|
|
116
116
|
// /playwright // todo: remove after migration to e2e folder is completed
|
|
117
|
-
runESLint(`./playwright`, eslintConfigPathPlaywright, tsconfigPathPlaywright,
|
|
117
|
+
runESLint(`./playwright`, eslintConfigPathPlaywright, tsconfigPathPlaywright, extensions, fix),
|
|
118
118
|
]);
|
|
119
119
|
}
|
|
120
120
|
else {
|
|
@@ -122,15 +122,15 @@ async function eslintAll(opt) {
|
|
|
122
122
|
// /src
|
|
123
123
|
await runESLint(`./src`, eslintConfigPathRoot, undefined, extensions, fix);
|
|
124
124
|
// /scripts
|
|
125
|
-
await runESLint(`./scripts`, eslintConfigPathScripts, tsconfigPathScripts,
|
|
125
|
+
await runESLint(`./scripts`, eslintConfigPathScripts, tsconfigPathScripts, extensions, fix);
|
|
126
126
|
// /e2e
|
|
127
|
-
await runESLint(`./e2e`, eslintConfigPathE2e, tsconfigPathE2e,
|
|
127
|
+
await runESLint(`./e2e`, eslintConfigPathE2e, tsconfigPathE2e, extensions, fix);
|
|
128
128
|
// /e2e
|
|
129
|
-
await runESLint(`./playwright`, eslintConfigPathPlaywright, tsconfigPathPlaywright,
|
|
129
|
+
await runESLint(`./playwright`, eslintConfigPathPlaywright, tsconfigPathPlaywright, extensions, fix);
|
|
130
130
|
}
|
|
131
131
|
console.log(`${(0, nodejs_lib_1.boldGrey)('eslint-all')} ${(0, nodejs_lib_1.dimGrey)(`took ` + (0, js_lib_1._since)(started))}`);
|
|
132
132
|
}
|
|
133
|
-
async function runESLint(dir, eslintConfigPath, tsconfigPath, extensions =
|
|
133
|
+
async function runESLint(dir, eslintConfigPath, tsconfigPath, extensions = eslintExtensions, fix = true) {
|
|
134
134
|
if (!eslintConfigPath || !node_fs_1.default.existsSync(dir))
|
|
135
135
|
return; // faster to bail-out like this
|
|
136
136
|
await nodejs_lib_1.exec2.spawnAsync('eslint', {
|