lint-staged
Advanced tools
Comparing version 12.3.2 to 12.3.3
@@ -83,3 +83,4 @@ /** @typedef {import('./index').Logger} Logger */ | ||
// Resolve relative CWD option | ||
cwd = cwd ? path.resolve(cwd) : process.cwd() | ||
const hasExplicitCwd = !!cwd | ||
cwd = hasExplicitCwd ? path.resolve(cwd) : process.cwd() | ||
debugLog('Using working directory `%s`', cwd) | ||
@@ -124,2 +125,4 @@ | ||
const hasMultipleConfigs = Object.keys(configGroups).length > 1 | ||
// lint-staged 10 will automatically add modifications to index | ||
@@ -143,4 +146,10 @@ // Warn user when their command includes `git add` | ||
for (const [configPath, { config, files }] of Object.entries(configGroups)) { | ||
const relativeConfig = normalize(path.relative(cwd, configPath)) | ||
const stagedFileChunks = chunkFiles({ baseDir: gitDir, files, maxArgLength, relative }) | ||
// Use actual cwd if it's specified, or there's only a single config file. | ||
// Otherwise use the directory of the config file for each config group, | ||
// to make sure tasks are separated from each other. | ||
const groupCwd = hasMultipleConfigs && !hasExplicitCwd ? path.dirname(configPath) : cwd | ||
const chunkCount = stagedFileChunks.length | ||
@@ -152,9 +161,7 @@ if (chunkCount > 1) { | ||
for (const [index, files] of stagedFileChunks.entries()) { | ||
const relativeConfig = normalize(path.relative(cwd, configPath)) | ||
const chunkListrTasks = await Promise.all( | ||
generateTasks({ config, cwd, files, relative }).map((task) => | ||
generateTasks({ config, cwd: groupCwd, files, relative }).map((task) => | ||
makeCmdTasks({ | ||
commands: task.commands, | ||
cwd, | ||
cwd: groupCwd, | ||
files: task.fileList, | ||
@@ -168,3 +175,10 @@ gitDir, | ||
task.fileList.forEach((file) => { | ||
matchedFiles.add(file) | ||
// Make sure relative files are normalized to the | ||
// group cwd, because other there might be identical | ||
// relative filenames in the entire set. | ||
const normalizedFile = path.isAbsolute(file) | ||
? file | ||
: normalize(path.join(groupCwd, file)) | ||
matchedFiles.add(normalizedFile) | ||
}) | ||
@@ -171,0 +185,0 @@ |
{ | ||
"name": "lint-staged", | ||
"version": "12.3.2", | ||
"version": "12.3.3", | ||
"description": "Lint files staged by git", | ||
@@ -5,0 +5,0 @@ "license": "MIT", |
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
96452
1668
15