Skip to content

Commit e035b80

Browse files
authored
fix: revert back to cosmiconfig from lilconfig (#1035)
* Revert "fix: correctly import `js-yaml` to fix yaml config loading (#1033)" This reverts commit 612d806. * Revert "perf: replace `cosmiconfig` with `lilconfig` (#981)" This reverts commit 04529e2.
1 parent 612d806 commit e035b80

File tree

8 files changed

+170
-229
lines changed

8 files changed

+170
-229
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ Starting with v3.1 you can now use different ways of configuring lint-staged:
105105
- `lint-staged.config.js`, `.lintstagedrc.js`, or `.lintstagedrc.cjs` file in JS format
106106
- Pass a configuration file using the `--config` or `-c` flag
107107
108-
See [lilconfig](https://github.com/antonk52/lilconfig) for more details on what formats are supported.
108+
See [cosmiconfig](https://github.com/davidtheclark/cosmiconfig) for more details on what formats are supported.
109109
110110
Configuration should be an object where each value is a command to run and its key is a glob pattern to use for this command. This package uses [micromatch](https://github.com/micromatch/micromatch) for glob patterns.
111111

lib/index.js

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
'use strict'
22

3-
const { lilconfig } = require('lilconfig')
4-
const yaml = require('js-yaml')
3+
const { cosmiconfig } = require('cosmiconfig')
54
const debugLog = require('debug')('lint-staged')
65
const stringifyObject = require('stringify-object')
76

@@ -25,10 +24,8 @@ const resolveConfig = (configPath) => {
2524
}
2625
}
2726

28-
const jsYamlLoad = (filepath, content) => yaml.load(content)
29-
3027
const loadConfig = (configPath) => {
31-
const explorer = lilconfig('lint-staged', {
28+
const explorer = cosmiconfig('lint-staged', {
3229
searchPlaces: [
3330
'package.json',
3431
'.lintstagedrc',
@@ -40,11 +37,6 @@ const loadConfig = (configPath) => {
4037
'lint-staged.config.js',
4138
'lint-staged.config.cjs',
4239
],
43-
loaders: {
44-
'.yml': jsYamlLoad,
45-
'.yaml': jsYamlLoad,
46-
noExt: jsYamlLoad,
47-
},
4840
})
4941

5042
return configPath ? explorer.load(resolveConfig(configPath)) : explorer.search()
@@ -92,7 +84,7 @@ const lintStaged = async (
9284
) => {
9385
await validateOptions({ shell }, logger)
9486

95-
debugLog('Loading config using `lilconfig`')
87+
debugLog('Loading config using `cosmiconfig`')
9688

9789
const resolved = configObject
9890
? { config: configObject, filepath: '(input)' }

0 commit comments

Comments
 (0)