Build(deps): Bump cosmiconfig from 6.0.0 to 7.0.0 (#8890)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: fisker <lionkay@gmail.com>
This commit is contained in:
1 parent
a340799a3d
commit
07fbf265fa
18 files changed
+90
-10
No files matched your search
@@ -0,0 +1,3 @@
|
||||
#### Support `.prettierrc.cjs` and `prettier.config.cjs` config file ([#8890](https://github.com/prettier/prettier/pull/8890) by [@fisker](https://github.com/fisker))
|
||||
|
||||
New config files `.prettierrc.cjs` and `prettier.config.cjs` are supported.
|
||||
@@ -8,7 +8,7 @@ Prettier uses [cosmiconfig](https://github.com/davidtheclark/cosmiconfig) for co
|
||||
- A `"prettier"` key in your `package.json` file.
|
||||
- A `.prettierrc` file written in JSON or YAML.
|
||||
- A `.prettierrc.json`, `.prettierrc.yml`, or `.prettierrc.yaml` file.
|
||||
- A `.prettierrc.js` or `prettier.config.js` file that exports an object using `module.exports`.
|
||||
- A `.prettierrc.js`, `.prettierrc.cjs`, `prettier.config.js`, or `prettier.config.cjs` file that exports an object using `module.exports`.
|
||||
- A `.prettierrc.toml` file.
|
||||
|
||||
The configuration file will be resolved starting from the location of the file being formatted, and searching up the file tree until a config file is (or isn’t) found.
|
||||
|
||||
+1
-1
@@ -32,7 +32,7 @@
|
||||
"chalk": "4.1.0",
|
||||
"ci-info": "watson/ci-info#f43f6a1cefff47fb361c88cf4b943fdbcaafe540",
|
||||
"cjk-regex": "2.0.0",
|
||||
"cosmiconfig": "6.0.0",
|
||||
"cosmiconfig": "7.0.0",
|
||||
"dashify": "2.0.0",
|
||||
"diff": "4.0.2",
|
||||
"editorconfig": "0.15.3",
|
||||
|
||||
@@ -40,7 +40,9 @@ const getExplorerMemoized = mem(
|
||||
".prettierrc.yaml",
|
||||
".prettierrc.yml",
|
||||
".prettierrc.js",
|
||||
".prettierrc.cjs",
|
||||
"prettier.config.js",
|
||||
"prettier.config.cjs",
|
||||
".prettierrc.toml",
|
||||
],
|
||||
loaders: {
|
||||
|
||||
@@ -285,3 +285,26 @@ test("API resolveConfig de-references to an external module", () => {
|
||||
semi: false,
|
||||
});
|
||||
});
|
||||
|
||||
test(".cjs config file", async () => {
|
||||
const parentDirectory = path.join(__dirname, "../cli/config/rc-cjs");
|
||||
|
||||
const config = {
|
||||
trailingComma: "all",
|
||||
singleQuote: true,
|
||||
};
|
||||
|
||||
for (const directoryName of [
|
||||
"prettierrc-cjs-in-type-module",
|
||||
"prettierrc-cjs-in-type-commonjs",
|
||||
"prettierrc-cjs-in-type-none",
|
||||
"prettier-config-cjs-in-type-commonjs",
|
||||
"prettier-config-cjs-in-type-none",
|
||||
"prettier-config-cjs-in-type-module",
|
||||
]) {
|
||||
const file = path.join(parentDirectory, directoryName, "foo.js");
|
||||
|
||||
expect(prettier.resolveConfig.sync(file)).toEqual(config);
|
||||
await expect(prettier.resolveConfig(file)).resolves.toMatchObject(config);
|
||||
}
|
||||
});
|
||||
@@ -0,0 +1,5 @@
|
||||
{
|
||||
"name": "prettier-cjs-config-test",
|
||||
"private": true,
|
||||
"type": "commonjs"
|
||||
}
|
||||
+4
@@ -0,0 +1,4 @@
|
||||
module.exports = {
|
||||
"trailingComma": "all",
|
||||
"singleQuote": true
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
{
|
||||
"name": "prettier-cjs-config-test",
|
||||
"private": true,
|
||||
"type": "module"
|
||||
}
|
||||
+4
@@ -0,0 +1,4 @@
|
||||
module.exports = {
|
||||
"trailingComma": "all",
|
||||
"singleQuote": true
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"name": "prettier-cjs-config-test",
|
||||
"private": true
|
||||
}
|
||||
+4
@@ -0,0 +1,4 @@
|
||||
module.exports = {
|
||||
"trailingComma": "all",
|
||||
"singleQuote": true
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
module.exports = {
|
||||
"trailingComma": "all",
|
||||
"singleQuote": true
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
{
|
||||
"name": "prettier-cjs-config-test",
|
||||
"private": true,
|
||||
"type": "commonjs"
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
module.exports = {
|
||||
"trailingComma": "all",
|
||||
"singleQuote": true
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
{
|
||||
"name": "prettier-cjs-config-test",
|
||||
"private": true,
|
||||
"type": "module"
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
module.exports = {
|
||||
"trailingComma": "all",
|
||||
"singleQuote": true
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"name": "prettier-cjs-config-test",
|
||||
"private": true
|
||||
}
|
||||
@@ -2575,16 +2575,16 @@ core-util-is@1.0.2, core-util-is@^1.0.2, core-util-is@~1.0.0:
|
||||
resolved "https://registry.yarnpkg.com/core-util-is/-/core-util-is-1.0.2.tgz#b5fd54220aa2bc5ab57aab7140c940754503c1a7"
|
||||
integrity sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=
|
||||
|
||||
cosmiconfig@6.0.0:
|
||||
version "6.0.0"
|
||||
resolved "https://registry.yarnpkg.com/cosmiconfig/-/cosmiconfig-6.0.0.tgz#da4fee853c52f6b1e6935f41c1a2fc50bd4a9982"
|
||||
integrity sha512-xb3ZL6+L8b9JLLCx3ZdoZy4+2ECphCMo2PwqgP1tlfVq6M6YReyzBJtvWWtbDSpNr9hn96pkCiZqUcFEc+54Qg==
|
||||
cosmiconfig@7.0.0:
|
||||
version "7.0.0"
|
||||
resolved "https://registry.yarnpkg.com/cosmiconfig/-/cosmiconfig-7.0.0.tgz#ef9b44d773959cae63ddecd122de23853b60f8d3"
|
||||
integrity sha512-pondGvTuVYDk++upghXJabWzL6Kxu6f26ljFw64Swq9v6sQPUL3EUlVDV56diOjpCayKihL6hVe8exIACU4XcA==
|
||||
dependencies:
|
||||
"@types/parse-json" "^4.0.0"
|
||||
import-fresh "^3.1.0"
|
||||
import-fresh "^3.2.1"
|
||||
parse-json "^5.0.0"
|
||||
path-type "^4.0.0"
|
||||
yaml "^1.7.2"
|
||||
yaml "^1.10.0"
|
||||
|
||||
create-ecdh@^4.0.0:
|
||||
version "4.0.3"
|
||||
@@ -4245,7 +4245,7 @@ ignore@^5.1.4:
|
||||
resolved "https://registry.yarnpkg.com/ignore/-/ignore-5.1.8.tgz#f150a8b50a34289b33e22f5889abd4d8016f0e57"
|
||||
integrity sha512-BMpfD7PpiETpBl/A6S498BaIJ6Y/ABT93ETbby2fP00v4EbvPBXWEoaR1UBPKs3iR53pJY7EtZk5KACI57i1Uw==
|
||||
|
||||
import-fresh@^3.0.0, import-fresh@^3.1.0:
|
||||
import-fresh@^3.0.0, import-fresh@^3.2.1:
|
||||
version "3.2.1"
|
||||
resolved "https://registry.yarnpkg.com/import-fresh/-/import-fresh-3.2.1.tgz#633ff618506e793af5ac91bf48b72677e15cbe66"
|
||||
integrity sha512-6e1q1cnWP2RXD9/keSkxHScg508CdXqXWgWBaETNhyuBFz+kUZlKboh+ISK+bU++DmbHimVBrOz/zzPe0sZ3sQ==
|
||||
@@ -8431,7 +8431,7 @@ yaml-unist-parser@1.3.0:
|
||||
tslib "^1.10.0"
|
||||
yaml "^1.10.0"
|
||||
|
||||
yaml@^1.10.0, yaml@^1.7.2:
|
||||
yaml@^1.10.0:
|
||||
version "1.10.0"
|
||||
resolved "https://registry.yarnpkg.com/yaml/-/yaml-1.10.0.tgz#3b593add944876077d4d683fee01081bd9fff31e"
|
||||
integrity sha512-yr2icI4glYaNG+KWONODapy2/jDdMSDnrONSjblABjD9B4Z5LgiircSt8m8sRZFNi08kG9Sm0uSHtEmP3zaEGg==
|
||||
|
||||
Reference in new issue
Block a user