Socket
Socket
Sign inDemoInstall

lint-staged

Package Overview
Dependencies
48
Maintainers
1
Versions
243
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 15.2.1 to 15.2.2

23

lib/searchConfigs.js

@@ -16,6 +16,5 @@ /** @typedef {import('./index').Logger} Logger */

const EXEC_GIT = ['ls-files', '-z', '--full-name']
const EXEC_GIT = ['ls-files', '-z', '--full-name', '-t']
const filterPossibleConfigFiles = (files) =>
files.filter((file) => CONFIG_FILE_NAMES.includes(path.basename(file)))
const filterPossibleConfigFiles = (file) => CONFIG_FILE_NAMES.includes(path.basename(file))

@@ -62,13 +61,19 @@ const numberOfLevels = (file) => file.split('/').length

const [cachedFiles, otherFiles] = await Promise.all([
const [cachedFilesWithStatus, otherFilesWithStatus] = await Promise.all([
/** Get all possible config files known to git */
execGit(EXEC_GIT, { cwd: gitDir }).then(parseGitZOutput).then(filterPossibleConfigFiles),
execGit(EXEC_GIT, { cwd: gitDir }).then(parseGitZOutput),
/** Get all possible config files from uncommitted files */
execGit([...EXEC_GIT, '--others', '--exclude-standard'], { cwd: gitDir })
.then(parseGitZOutput)
.then(filterPossibleConfigFiles),
execGit([...EXEC_GIT, '--others', '--exclude-standard'], { cwd: gitDir }).then(parseGitZOutput),
])
/** Sort possible config files so that deepest is first */
const possibleConfigFiles = [...cachedFiles, ...otherFiles]
const possibleConfigFiles = [...cachedFilesWithStatus, ...otherFilesWithStatus]
.flatMap(
/**
* Leave out lines starting with "S " to ignore not-checked-out files in a sparse repo.
* The "S" status means a tracked file that is "skip-worktree"
* @see https://git-scm.com/docs/git-ls-files#Documentation/git-ls-files.txt--t
*/ (line) => (line.startsWith('S ') ? [] : [line.replace(/^[HSMRCK?U] /, '')])
)
.filter(filterPossibleConfigFiles)
.map((file) => normalizePath(path.join(gitDir, file)))

@@ -75,0 +80,0 @@ .filter(isInsideDirectory(cwd))

{
"name": "lint-staged",
"version": "15.2.1",
"version": "15.2.2",
"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