Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

lint-staged

Package Overview
Dependencies
Maintainers
1
Versions
250
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

lint-staged - npm Package Compare versions

Comparing version 12.1.5 to 12.1.6

5

lib/makeCmdTasks.js

@@ -31,2 +31,3 @@ import cliTruncate from 'cli-truncate'

* @param {Array<string|Function>|string|Function} options.commands
* @param {string} options.cwd
* @param {Array<string>} options.files

@@ -38,3 +39,3 @@ * @param {string} options.gitDir

*/
export const makeCmdTasks = async ({ commands, files, gitDir, renderer, shell, verbose }) => {
export const makeCmdTasks = async ({ commands, cwd, files, gitDir, renderer, shell, verbose }) => {
debugLog('Creating listr tasks for commands %o', commands)

@@ -66,3 +67,3 @@ const commandArray = Array.isArray(commands) ? commands : [commands]

const title = cliTruncate(command, getTitleLength(renderer))
const task = resolveTaskFn({ command, files, gitDir, isFn, shell, verbose })
const task = resolveTaskFn({ command, cwd, files, gitDir, isFn, shell, verbose })
cmdTasks.push({ title, command, task })

@@ -69,0 +70,0 @@ }

15

lib/resolveTaskFn.js

@@ -71,6 +71,6 @@ import { redBright, dim } from 'colorette'

* @param {string} options.command — Linter task
* @param {string} [options.cwd]
* @param {String} options.gitDir - Current git repo path
* @param {Boolean} options.isFn - Whether the linter task is a function
* @param {Array<string>} options.files — Filepaths to run the linter task against
* @param {Boolean} [options.relative] — Whether the filepaths should be relative
* @param {Boolean} [options.shell] — Whether to skip parsing linter task for better shell support

@@ -82,6 +82,6 @@ * @param {Boolean} [options.verbose] — Always show task verbose

command,
cwd = process.cwd(),
files,
gitDir,
isFn,
relative,
shell = false,

@@ -94,10 +94,11 @@ verbose = false,

const execaOptions = { preferLocal: true, reject: false, shell }
if (relative) {
execaOptions.cwd = process.cwd()
} else if (/^git(\.exe)?/i.test(cmd) && gitDir !== process.cwd()) {
const execaOptions = {
// Only use gitDir as CWD if we are using the git binary
// e.g `npm` should run tasks in the actual CWD
execaOptions.cwd = gitDir
cwd: /^git(\.exe)?/i.test(cmd) ? gitDir : cwd,
preferLocal: true,
reject: false,
shell,
}
debugLog('execaOptions:', execaOptions)

@@ -104,0 +105,0 @@

@@ -138,2 +138,3 @@ /** @typedef {import('./index').Logger} Logger */

commands: task.commands,
cwd,
files: task.fileList,

@@ -140,0 +141,0 @@ gitDir,

{
"name": "lint-staged",
"version": "12.1.5",
"version": "12.1.6",
"description": "Lint files staged by git",

@@ -5,0 +5,0 @@ "license": "MIT",

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc