lint-staged 15.2.0 → 15.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/execGit.js CHANGED
@@ -19,6 +19,7 @@ export const execGit = async (cmd, options = {}) => {
19
19
  ...options,
20
20
  all: true,
21
21
  cwd: options.cwd || process.cwd(),
22
+ stdin: 'ignore',
22
23
  })
23
24
  return stdout
24
25
  } catch ({ all }) {
@@ -152,6 +152,7 @@ export const resolveTaskFn = ({
152
152
  preferLocal: true,
153
153
  reject: false,
154
154
  shell,
155
+ stdin: 'ignore',
155
156
  }
156
157
 
157
158
  debugLog('execaOptions:', execaOptions)
@@ -13,10 +13,9 @@ import { CONFIG_FILE_NAMES } from './configFiles.js'
13
13
 
14
14
  const debugLog = debug('lint-staged:searchConfigs')
15
15
 
16
- const EXEC_GIT = ['ls-files', '-z', '--full-name']
16
+ const EXEC_GIT = ['ls-files', '-z', '--full-name', '-t']
17
17
 
18
- const filterPossibleConfigFiles = (files) =>
19
- files.filter((file) => CONFIG_FILE_NAMES.includes(path.basename(file)))
18
+ const filterPossibleConfigFiles = (file) => CONFIG_FILE_NAMES.includes(path.basename(file))
20
19
 
21
20
  const numberOfLevels = (file) => file.split('/').length
22
21
 
@@ -58,17 +57,23 @@ export const searchConfigs = async (
58
57
  return { [configPath]: validateConfig(config, filepath, logger) }
59
58
  }
60
59
 
61
- const [cachedFiles, otherFiles] = await Promise.all([
60
+ const [cachedFilesWithStatus, otherFilesWithStatus] = await Promise.all([
62
61
  /** Get all possible config files known to git */
63
- execGit(EXEC_GIT, { cwd: gitDir }).then(parseGitZOutput).then(filterPossibleConfigFiles),
62
+ execGit(EXEC_GIT, { cwd: gitDir }).then(parseGitZOutput),
64
63
  /** Get all possible config files from uncommitted files */
65
- execGit([...EXEC_GIT, '--others', '--exclude-standard'], { cwd: gitDir })
66
- .then(parseGitZOutput)
67
- .then(filterPossibleConfigFiles),
64
+ execGit([...EXEC_GIT, '--others', '--exclude-standard'], { cwd: gitDir }).then(parseGitZOutput),
68
65
  ])
69
66
 
70
67
  /** Sort possible config files so that deepest is first */
71
- const possibleConfigFiles = [...cachedFiles, ...otherFiles]
68
+ const possibleConfigFiles = [...cachedFilesWithStatus, ...otherFilesWithStatus]
69
+ .flatMap(
70
+ /**
71
+ * Leave out lines starting with "S " to ignore not-checked-out files in a sparse repo.
72
+ * The "S" status means a tracked file that is "skip-worktree"
73
+ * @see https://git-scm.com/docs/git-ls-files#Documentation/git-ls-files.txt--t
74
+ */ (line) => (line.startsWith('S ') ? [] : [line.replace(/^[HSMRCK?U] /, '')])
75
+ )
76
+ .filter(filterPossibleConfigFiles)
72
77
  .map((file) => normalizePath(path.join(gitDir, file)))
73
78
  .filter(isInsideDirectory(cwd))
74
79
  .sort(sortDeepestParth)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lint-staged",
3
- "version": "15.2.0",
3
+ "version": "15.2.2",
4
4
  "description": "Lint files staged by git",
5
5
  "license": "MIT",
6
6
  "repository": "https://github.com/okonet/lint-staged",
@@ -41,7 +41,7 @@
41
41
  "debug": "4.3.4",
42
42
  "execa": "8.0.1",
43
43
  "lilconfig": "3.0.0",
44
- "listr2": "8.0.0",
44
+ "listr2": "8.0.1",
45
45
  "micromatch": "4.0.5",
46
46
  "pidtree": "0.6.0",
47
47
  "string-argv": "0.3.2",
@@ -50,20 +50,20 @@
50
50
  "devDependencies": {
51
51
  "@changesets/changelog-github": "0.5.0",
52
52
  "@changesets/cli": "2.27.1",
53
- "@commitlint/cli": "18.4.3",
54
- "@commitlint/config-conventional": "18.4.3",
53
+ "@commitlint/cli": "18.4.4",
54
+ "@commitlint/config-conventional": "18.4.4",
55
55
  "consolemock": "1.1.0",
56
56
  "cross-env": "7.0.3",
57
- "eslint": "8.55.0",
58
- "eslint-config-prettier": "9.0.0",
59
- "eslint-plugin-import": "2.29.0",
57
+ "eslint": "8.56.0",
58
+ "eslint-config-prettier": "9.1.0",
59
+ "eslint-plugin-import": "2.29.1",
60
60
  "eslint-plugin-node": "11.1.0",
61
- "eslint-plugin-prettier": "5.0.1",
61
+ "eslint-plugin-prettier": "5.1.3",
62
62
  "husky": "8.0.3",
63
63
  "jest": "29.7.0",
64
64
  "jest-snapshot-serializer-ansi": "2.1.0",
65
65
  "mock-stdin": "1.0.0",
66
- "prettier": "3.1.0"
66
+ "prettier": "3.2.4"
67
67
  },
68
68
  "keywords": [
69
69
  "lint",