Skip to content

Commit 641d1c2

Browse files
committed
fix: include all files when using --config <path>
1 parent 753ef72 commit 641d1c2

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

lib/groupFilesByConfig.js

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,9 @@ import path from 'path'
22

33
import debug from 'debug'
44

5-
import { ConfigObjectSymbol } from './searchConfigs.js'
6-
75
const debugLog = debug('lint-staged:groupFilesByConfig')
86

9-
export const groupFilesByConfig = async ({ configs, files }) => {
7+
export const groupFilesByConfig = async ({ configs, files, singleConfigMode }) => {
108
debugLog('Grouping %d files by %d configurations', files.length, Object.keys(configs).length)
119

1210
const filesSet = new Set(files)
@@ -16,8 +14,8 @@ export const groupFilesByConfig = async ({ configs, files }) => {
1614
for (const filepath of Reflect.ownKeys(configs)) {
1715
const config = configs[filepath]
1816

19-
/** When passed an explicit config object via the Node.js API, skip logic */
20-
if (filepath === ConfigObjectSymbol) {
17+
/** When passed an explicit config object via the Node.js API‚ or an explicit path, skip logic */
18+
if (singleConfigMode) {
2119
filesByConfig[filepath] = { config, files }
2220
break
2321
}

lib/runAll.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,11 @@ export const runAll = async (
133133
throw createError(ctx, ConfigNotFoundError)
134134
}
135135

136-
const filesByConfig = await groupFilesByConfig({ configs: foundConfigs, files })
136+
const filesByConfig = await groupFilesByConfig({
137+
configs: foundConfigs,
138+
files,
139+
singleConfigMode: configObject || configPath !== undefined,
140+
})
137141

138142
const hasMultipleConfigs = numberOfConfigs > 1
139143

0 commit comments

Comments
 (0)