@virmator/lint 14.11.0 → 14.12.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/dist/lint.js +41 -20
- package/package.json +2 -2
- package/src/lint.ts +47 -21
package/dist/lint.js
CHANGED
|
@@ -225,26 +225,47 @@ export const virmatorLintPlugin = defineVirmatorPlugin(import.meta.dirname, {
|
|
|
225
225
|
},
|
|
226
226
|
},
|
|
227
227
|
},
|
|
228
|
-
}, async ({ package: { monoRepoRootPath }, runShellCommand, cliInputs: { usedCommands, filteredArgs }, configs, }) => {
|
|
228
|
+
}, async ({ package: { monoRepoRootPath, packageType }, runShellCommand, runPerPackage, cliInputs: { usedCommands, filteredArgs }, configs, }) => {
|
|
229
229
|
const args = mri(filteredArgs);
|
|
230
|
-
const dirPath = args._.length ? '' : '.';
|
|
231
|
-
const cacheLocation = join(monoRepoRootPath, 'node_modules', '.cache', '.eslintcache');
|
|
232
230
|
const userSpecifiedConfig = filteredArgs.some((arg) => arg === '-c' || arg === '--config');
|
|
233
|
-
const
|
|
234
|
-
'
|
|
235
|
-
'eslint'
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
231
|
+
const configArg = userSpecifiedConfig
|
|
232
|
+
? ''
|
|
233
|
+
: `--config '${interpolationSafeWindowsPath(configs.lint.configs.eslint.fullCopyToPath)}'`;
|
|
234
|
+
const fixArg = usedCommands.lint?.subCommands.fix && !args.fix ? '--fix' : '';
|
|
235
|
+
if (packageType === PackageType.MonoRoot && !args._.length) {
|
|
236
|
+
await runPerPackage(({ packageName }) => {
|
|
237
|
+
const cacheLocation = join(monoRepoRootPath, 'node_modules', '.cache', `.eslintcache-${packageName}`);
|
|
238
|
+
return [
|
|
239
|
+
'npx',
|
|
240
|
+
'eslint',
|
|
241
|
+
'--cache',
|
|
242
|
+
`--cache-location='${interpolationSafeWindowsPath(cacheLocation)}'`,
|
|
243
|
+
configArg,
|
|
244
|
+
fixArg,
|
|
245
|
+
'.',
|
|
246
|
+
...filteredArgs,
|
|
247
|
+
]
|
|
248
|
+
.filter(check.isTruthy)
|
|
249
|
+
.join(' ');
|
|
250
|
+
});
|
|
251
|
+
}
|
|
252
|
+
else {
|
|
253
|
+
const dirPath = args._.length ? '' : '.';
|
|
254
|
+
const cacheLocation = join(monoRepoRootPath, 'node_modules', '.cache', '.eslintcache');
|
|
255
|
+
const eslintCommand = [
|
|
256
|
+
'npx',
|
|
257
|
+
'eslint',
|
|
258
|
+
'--cache',
|
|
259
|
+
`--cache-location='${interpolationSafeWindowsPath(cacheLocation)}'`,
|
|
260
|
+
configArg,
|
|
261
|
+
fixArg,
|
|
262
|
+
dirPath,
|
|
263
|
+
...filteredArgs,
|
|
264
|
+
]
|
|
265
|
+
.filter(check.isTruthy)
|
|
266
|
+
.join(' ');
|
|
267
|
+
await runShellCommand(eslintCommand, {
|
|
268
|
+
cwd: monoRepoRootPath,
|
|
269
|
+
});
|
|
270
|
+
}
|
|
250
271
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@virmator/lint",
|
|
3
|
-
"version": "14.
|
|
3
|
+
"version": "14.12.0",
|
|
4
4
|
"description": "Default ESLint linting plugin for virmator.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"virmator",
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
"@augment-vir/assert": "^31.68.3",
|
|
36
36
|
"@augment-vir/common": "^31.68.3",
|
|
37
37
|
"@augment-vir/node": "^31.68.3",
|
|
38
|
-
"@virmator/core": "^14.
|
|
38
|
+
"@virmator/core": "^14.12.0",
|
|
39
39
|
"jiti": "^2.6.1",
|
|
40
40
|
"mri": "^1.2.0"
|
|
41
41
|
},
|
package/src/lint.ts
CHANGED
|
@@ -230,36 +230,62 @@ export const virmatorLintPlugin = defineVirmatorPlugin(
|
|
|
230
230
|
},
|
|
231
231
|
},
|
|
232
232
|
async ({
|
|
233
|
-
package: {monoRepoRootPath},
|
|
233
|
+
package: {monoRepoRootPath, packageType},
|
|
234
234
|
runShellCommand,
|
|
235
|
+
runPerPackage,
|
|
235
236
|
cliInputs: {usedCommands, filteredArgs},
|
|
236
237
|
configs,
|
|
237
238
|
}) => {
|
|
238
239
|
const args = mri(filteredArgs);
|
|
239
240
|
|
|
240
|
-
const
|
|
241
|
+
const userSpecifiedConfig = filteredArgs.some((arg) => arg === '-c' || arg === '--config');
|
|
242
|
+
const configArg = userSpecifiedConfig
|
|
243
|
+
? ''
|
|
244
|
+
: `--config '${interpolationSafeWindowsPath(configs.lint.configs.eslint.fullCopyToPath)}'`;
|
|
245
|
+
const fixArg = usedCommands.lint?.subCommands.fix && !args.fix ? '--fix' : '';
|
|
241
246
|
|
|
242
|
-
|
|
247
|
+
if (packageType === PackageType.MonoRoot && !args._.length) {
|
|
248
|
+
await runPerPackage(({packageName}) => {
|
|
249
|
+
const cacheLocation = join(
|
|
250
|
+
monoRepoRootPath,
|
|
251
|
+
'node_modules',
|
|
252
|
+
'.cache',
|
|
253
|
+
`.eslintcache-${packageName}`,
|
|
254
|
+
);
|
|
243
255
|
|
|
244
|
-
|
|
256
|
+
return [
|
|
257
|
+
'npx',
|
|
258
|
+
'eslint',
|
|
259
|
+
'--cache',
|
|
260
|
+
`--cache-location='${interpolationSafeWindowsPath(cacheLocation)}'`,
|
|
261
|
+
configArg,
|
|
262
|
+
fixArg,
|
|
263
|
+
'.',
|
|
264
|
+
...filteredArgs,
|
|
265
|
+
]
|
|
266
|
+
.filter(check.isTruthy)
|
|
267
|
+
.join(' ');
|
|
268
|
+
});
|
|
269
|
+
} else {
|
|
270
|
+
const dirPath = args._.length ? '' : '.';
|
|
271
|
+
const cacheLocation = join(monoRepoRootPath, 'node_modules', '.cache', '.eslintcache');
|
|
245
272
|
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
.filter(check.isTruthy)
|
|
259
|
-
.join(' ');
|
|
273
|
+
const eslintCommand = [
|
|
274
|
+
'npx',
|
|
275
|
+
'eslint',
|
|
276
|
+
'--cache',
|
|
277
|
+
`--cache-location='${interpolationSafeWindowsPath(cacheLocation)}'`,
|
|
278
|
+
configArg,
|
|
279
|
+
fixArg,
|
|
280
|
+
dirPath,
|
|
281
|
+
...filteredArgs,
|
|
282
|
+
]
|
|
283
|
+
.filter(check.isTruthy)
|
|
284
|
+
.join(' ');
|
|
260
285
|
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
286
|
+
await runShellCommand(eslintCommand, {
|
|
287
|
+
cwd: monoRepoRootPath,
|
|
288
|
+
});
|
|
289
|
+
}
|
|
264
290
|
},
|
|
265
291
|
);
|