@pob/root 27.16.0 → 27.17.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/createLintStagedConfig.js +53 -58
- package/package.json +3 -3
|
@@ -223,65 +223,60 @@ const createConfig = ({
|
|
|
223
223
|
);
|
|
224
224
|
const matchesTscTrigger = createMatcher([tscTriggerPattern]);
|
|
225
225
|
|
|
226
|
-
//
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
226
|
+
// Both build the whole project, in parallel.
|
|
227
|
+
const buildCommands = (
|
|
228
|
+
hasRollup
|
|
229
|
+
? ["rollup --config rollup.config.mjs", hasTsconfig && "tsc -b"]
|
|
230
|
+
: [hasTsconfig && "tsc"]
|
|
231
|
+
).filter(Boolean);
|
|
232
|
+
|
|
233
|
+
// A single function at the top level: lint-staged runs its commands
|
|
234
|
+
// sequentially and does not append the matched filenames. A function inside a
|
|
235
|
+
// list of tasks would have its commands run in parallel.
|
|
234
236
|
return defineConfig({
|
|
235
|
-
"*":
|
|
236
|
-
(
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
hasRollup
|
|
279
|
-
? [
|
|
280
|
-
createBuildTask("rollup --config rollup.config.mjs"),
|
|
281
|
-
hasTsconfig && createBuildTask("tsc -b"),
|
|
282
|
-
].filter(Boolean)
|
|
283
|
-
: hasTsconfig && createBuildTask("tsc"),
|
|
284
|
-
].filter(Boolean),
|
|
237
|
+
"*": (allStagedFiles) => {
|
|
238
|
+
const filenames = allStagedFiles.map(toRelativePosixPath);
|
|
239
|
+
const hasPmFiles = filenames.some(matchesPmFiles);
|
|
240
|
+
const eslintFilenames = filenames.filter(matchesEslint);
|
|
241
|
+
|
|
242
|
+
// Running on the whole project is simpler and avoids too long command
|
|
243
|
+
// lines when many files are staged.
|
|
244
|
+
const withFilenamesOrWholeProject = (command, commandFilenames) => {
|
|
245
|
+
if (commandFilenames.length === 0) return undefined;
|
|
246
|
+
if (commandFilenames.length > MAX_FILENAMES) return command;
|
|
247
|
+
return withFilenames(command, commandFilenames);
|
|
248
|
+
};
|
|
249
|
+
|
|
250
|
+
const getOxlintCommand = () => {
|
|
251
|
+
if (!hasOxlint) return undefined;
|
|
252
|
+
return withFilenamesOrWholeProject(
|
|
253
|
+
OXLINT_FIX,
|
|
254
|
+
eslintFilenames.filter(isOxlintSupportedFile),
|
|
255
|
+
);
|
|
256
|
+
};
|
|
257
|
+
|
|
258
|
+
const getEslintCommand = () => {
|
|
259
|
+
// eslint runs on the whole project when a package.json, the lockfile
|
|
260
|
+
// or the package manager config changed, like in the legacy config,
|
|
261
|
+
// as lint rules depend on the dependencies themselves.
|
|
262
|
+
if (hasPmFiles) return ESLINT_FIX;
|
|
263
|
+
return withFilenamesOrWholeProject(ESLINT_FIX, eslintFilenames);
|
|
264
|
+
};
|
|
265
|
+
|
|
266
|
+
return [
|
|
267
|
+
...(hasPmFiles ? installAndDedupe : []),
|
|
268
|
+
hasPmFiles && pkg.scripts?.checks ? `${pm.name} run checks` : undefined,
|
|
269
|
+
withFilenamesOrWholeProject(OXFMT, filenames),
|
|
270
|
+
getOxlintCommand(),
|
|
271
|
+
getEslintCommand(),
|
|
272
|
+
hasPmFiles ? getGitAddPmFilesCommand() : undefined,
|
|
273
|
+
// after the tasks above, so that the build sees the formatted and
|
|
274
|
+
// fixed files
|
|
275
|
+
buildCommands.length > 0 && filenames.some(matchesTscTrigger)
|
|
276
|
+
? buildCommands
|
|
277
|
+
: undefined,
|
|
278
|
+
].filter(Boolean);
|
|
279
|
+
},
|
|
285
280
|
});
|
|
286
281
|
};
|
|
287
282
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pob/root",
|
|
3
|
-
"version": "27.
|
|
3
|
+
"version": "27.17.0",
|
|
4
4
|
"description": "root package",
|
|
5
5
|
"keywords": [],
|
|
6
6
|
"homepage": "https://github.com/christophehurpeau/pob",
|
|
@@ -66,7 +66,7 @@
|
|
|
66
66
|
"@commitlint/format": "21.2.3",
|
|
67
67
|
"@commitlint/lint": "21.2.3",
|
|
68
68
|
"@commitlint/types": "21.2.3",
|
|
69
|
-
"@pob/version": "7.
|
|
69
|
+
"@pob/version": "7.1.0",
|
|
70
70
|
"conventional-changelog-conventionalcommits": "^10.0.0",
|
|
71
71
|
"conventional-changelog-writer": "^9.0.0",
|
|
72
72
|
"conventional-commits-parser": "^7.0.0",
|
|
@@ -76,7 +76,7 @@
|
|
|
76
76
|
"oxlint": "1.85.0",
|
|
77
77
|
"oxlint-tsgolint": "7.0.2003",
|
|
78
78
|
"picomatch": "^4.0.7",
|
|
79
|
-
"pob-dependencies": "27.
|
|
79
|
+
"pob-dependencies": "27.14.0",
|
|
80
80
|
"semver": "^7.7.3"
|
|
81
81
|
},
|
|
82
82
|
"engines": {
|