lint-staged
Advanced tools
Comparing version 12.1.5 to 12.1.6
@@ -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 @@ } |
@@ -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", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1533
88702