@naturalcycles/dev-lib 19.24.0 → 19.25.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/lint-staged.config.js +5 -5
- package/dist/lint.util.js +10 -2
- package/package.json +1 -1
|
@@ -73,7 +73,7 @@ const linters = {
|
|
|
73
73
|
return [
|
|
74
74
|
biomeCmd,
|
|
75
75
|
eslintConfigPathRoot &&
|
|
76
|
-
`${eslintCmd} --config ${eslintConfigPathRoot} --cache-location
|
|
76
|
+
`${eslintCmd} --config ${eslintConfigPathRoot} --cache-location node_modules/.cache/eslint_src`,
|
|
77
77
|
prettierCmd,
|
|
78
78
|
]
|
|
79
79
|
.filter(Boolean)
|
|
@@ -146,7 +146,7 @@ const linters = {
|
|
|
146
146
|
|
|
147
147
|
// /scripts are separate, cause they require separate tsconfig.json
|
|
148
148
|
if (fs.existsSync(`./scripts`)) {
|
|
149
|
-
const eslintConfigPathScripts = ['
|
|
149
|
+
const eslintConfigPathScripts = ['scripts/eslint.config.js'].find(p => fs.existsSync(p))
|
|
150
150
|
Object.assign(linters, {
|
|
151
151
|
// biome, eslint, Prettier
|
|
152
152
|
'./scripts/**/*.{ts,tsx,cts,mts,vue,html}': match => {
|
|
@@ -155,7 +155,7 @@ if (fs.existsSync(`./scripts`)) {
|
|
|
155
155
|
return [
|
|
156
156
|
biomeCmd,
|
|
157
157
|
eslintConfigPathScripts &&
|
|
158
|
-
`${eslintCmd} --config ${eslintConfigPathScripts} --parser-options=project
|
|
158
|
+
`${eslintCmd} --config ${eslintConfigPathScripts} --parser-options=project:scripts/tsconfig.json --cache-location node_modules/.cache/eslint_scripts`,
|
|
159
159
|
prettierCmd,
|
|
160
160
|
]
|
|
161
161
|
.filter(Boolean)
|
|
@@ -166,7 +166,7 @@ if (fs.existsSync(`./scripts`)) {
|
|
|
166
166
|
|
|
167
167
|
// /e2e
|
|
168
168
|
if (fs.existsSync(`./e2e`)) {
|
|
169
|
-
const eslintConfigPathE2e = ['
|
|
169
|
+
const eslintConfigPathE2e = ['e2e/eslint.config.js'].find(p => fs.existsSync(p))
|
|
170
170
|
|
|
171
171
|
Object.assign(linters, {
|
|
172
172
|
// biome, eslint, Prettier
|
|
@@ -176,7 +176,7 @@ if (fs.existsSync(`./e2e`)) {
|
|
|
176
176
|
return [
|
|
177
177
|
biomeCmd,
|
|
178
178
|
eslintConfigPathE2e &&
|
|
179
|
-
`${eslintCmd} --config ${eslintConfigPathE2e} --parser-options=project
|
|
179
|
+
`${eslintCmd} --config ${eslintConfigPathE2e} --parser-options=project:e2e/tsconfig.json --cache-location ./node_modules/.cache/eslint_e2e`,
|
|
180
180
|
prettierCmd,
|
|
181
181
|
]
|
|
182
182
|
.filter(Boolean)
|
package/dist/lint.util.js
CHANGED
|
@@ -121,6 +121,10 @@ async function runESLint(dir, extensions = eslintExtensions.split(','), fix = tr
|
|
|
121
121
|
return;
|
|
122
122
|
}
|
|
123
123
|
const eslintPath = findPackageBinPath('eslint', 'eslint');
|
|
124
|
+
const cacheLocation = `node_modules/.cache/eslint_${dir}`;
|
|
125
|
+
if (existsSync(cacheLocation)) {
|
|
126
|
+
console.log(boldGrey(`eslint ${dir} cache found`));
|
|
127
|
+
}
|
|
124
128
|
await exec2.spawnAsync(eslintPath, {
|
|
125
129
|
args: [
|
|
126
130
|
`--config`,
|
|
@@ -129,7 +133,7 @@ async function runESLint(dir, extensions = eslintExtensions.split(','), fix = tr
|
|
|
129
133
|
`--parser-options=project:${tsconfigPath}`,
|
|
130
134
|
'--cache',
|
|
131
135
|
'--cache-location',
|
|
132
|
-
|
|
136
|
+
cacheLocation,
|
|
133
137
|
`--no-error-on-unmatched-pattern`,
|
|
134
138
|
`--report-unused-disable-directives`, // todo: unnecessary with flat, as it's defined in the config
|
|
135
139
|
fix ? `--fix` : '',
|
|
@@ -154,13 +158,17 @@ export function runPrettier(experimentalCli = true) {
|
|
|
154
158
|
if (!prettierConfigPath)
|
|
155
159
|
return;
|
|
156
160
|
const prettierPath = findPackageBinPath('prettier', 'prettier');
|
|
161
|
+
const cacheLocation = 'node_modules/.cache/prettier';
|
|
162
|
+
if (existsSync(cacheLocation)) {
|
|
163
|
+
console.log(boldGrey('prettier cache found'));
|
|
164
|
+
}
|
|
157
165
|
// prettier --write 'src/**/*.{js,ts,css,scss,graphql}'
|
|
158
166
|
exec2.spawn(prettierPath, {
|
|
159
167
|
args: [
|
|
160
168
|
`--write`,
|
|
161
169
|
`--log-level=warn`,
|
|
162
170
|
'--cache-location',
|
|
163
|
-
|
|
171
|
+
cacheLocation,
|
|
164
172
|
experimentalCli && `--experimental-cli`,
|
|
165
173
|
experimentalCli ? '--config-path' : `--config`,
|
|
166
174
|
prettierConfigPath,
|