Socket
Socket
Sign inDemoInstall

lint-staged

Package Overview
Dependencies
61
Maintainers
1
Versions
245
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 12.3.2 to 12.3.3

26

lib/runAll.js

@@ -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",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc