From 09d65c35af4810e975c34d85377793eec260059f Mon Sep 17 00:00:00 2001 From: Sosuke Suzuki Date: Sat, 5 Jun 2021 18:32:49 +0900 Subject: [PATCH] Revert features for minor (#11016) This reverts commit f8cb7857587527267c4cff06631415ced3f06a89. --- changelog_unreleased/cli/10924.md | 3 --- src/language-yaml/embed.js | 4 ++-- src/language-yaml/index.js | 1 - .../__tests__/__snapshots__/support-info.js.snap | 3 +-- tests/integration/__tests__/with-parser-inference.js | 12 ------------ 5 files changed, 3 insertions(+), 20 deletions(-) delete mode 100644 changelog_unreleased/cli/10924.md diff --git a/changelog_unreleased/cli/10924.md b/changelog_unreleased/cli/10924.md deleted file mode 100644 index 22486a31d107..000000000000 --- a/changelog_unreleased/cli/10924.md +++ /dev/null @@ -1,3 +0,0 @@ -#### Infer parser for `.stylelintrc` (#10924 by @SevenOutman) - -A `.stylelintrc` file (without extension) is handled using `json` and `yaml` parsers. diff --git a/src/language-yaml/embed.js b/src/language-yaml/embed.js index cc3e0722c67d..cf246b8e02d8 100644 --- a/src/language-yaml/embed.js +++ b/src/language-yaml/embed.js @@ -3,11 +3,11 @@ function embed(path, print, textToDoc, options) { const node = path.getValue(); - // Try to format `.prettierrc` and `.stylelintrc` as `json` first + // Try to format `.prettierrc` as `json` first if ( node.type === "root" && options.filepath && - /(?:[/\\]|^)\.(?:prettier|stylelint)rc$/.test(options.filepath) + /(?:[/\\]|^)\.prettierrc$/.test(options.filepath) ) { return textToDoc(options.originalText, { ...options, parser: "json" }); } diff --git a/src/language-yaml/index.js b/src/language-yaml/index.js index 2474b28eea33..7205e75d8209 100644 --- a/src/language-yaml/index.js +++ b/src/language-yaml/index.js @@ -13,7 +13,6 @@ const languages = [ filenames: [ ...data.filenames.filter((filename) => filename !== "yarn.lock"), ".prettierrc", - ".stylelintrc", ], })), ]; diff --git a/tests/integration/__tests__/__snapshots__/support-info.js.snap b/tests/integration/__tests__/__snapshots__/support-info.js.snap index ccb51b57ae9f..aa93eae21681 100644 --- a/tests/integration/__tests__/__snapshots__/support-info.js.snap +++ b/tests/integration/__tests__/__snapshots__/support-info.js.snap @@ -742,8 +742,7 @@ exports[`CLI --support-info (stdout) 1`] = ` \\".clang-tidy\\", \\".gemrc\\", \\"glide.lock\\", - \\".prettierrc\\", - \\".stylelintrc\\" + \\".prettierrc\\" ], \\"linguistLanguageId\\": 407, \\"name\\": \\"YAML\\", diff --git a/tests/integration/__tests__/with-parser-inference.js b/tests/integration/__tests__/with-parser-inference.js index 4a243935d7db..020005d12d44 100644 --- a/tests/integration/__tests__/with-parser-inference.js +++ b/tests/integration/__tests__/with-parser-inference.js @@ -28,18 +28,6 @@ describe("infers parser from filename", () => { ).toEqual("{}\n"); }); - test("json from .stylelintrc", () => { - expect( - prettier.format(" { } ", { filepath: "x/y/.stylelintrc" }) - ).toEqual("{}\n"); - }); - - test("yaml from .stylelintrc", () => { - expect( - prettier.format(" extends: '' ", { filepath: "x/y/.stylelintrc" }) - ).toEqual('extends: ""\n'); - }); - test("babel from Jakefile", () => { expect( prettier.format("let foo = ( x = 1 ) => x", { filepath: "x/y/Jakefile" })