From 97add0cd9651bc1d1a9628953c58fede9df95707 Mon Sep 17 00:00:00 2001 From: JounQin Date: Thu, 30 Jun 2022 09:57:29 +0800 Subject: [PATCH] chore: do not format .svelte fixtures unexpectedly --- patches/@1stg+lint-staged+1.7.5.patch | 13 +++++++++++++ .../@ota-meshi/eslint-plugin-svelte/App.svelte | 4 ++-- test/prettier.js | 16 ++++++++-------- 3 files changed, 23 insertions(+), 10 deletions(-) create mode 100644 patches/@1stg+lint-staged+1.7.5.patch diff --git a/patches/@1stg+lint-staged+1.7.5.patch b/patches/@1stg+lint-staged+1.7.5.patch new file mode 100644 index 00000000..4e5205c3 --- /dev/null +++ b/patches/@1stg+lint-staged+1.7.5.patch @@ -0,0 +1,13 @@ +diff --git a/node_modules/@1stg/lint-staged/base.js b/node_modules/@1stg/lint-staged/base.js +index 827bd15..51c8e5d 100644 +--- a/node_modules/@1stg/lint-staged/base.js ++++ b/node_modules/@1stg/lint-staged/base.js +@@ -1,7 +1,7 @@ + const { isPkgAvailable, tryFile } = require('@pkgr/utils') + + const config = [ +- '*.{*sh,env,env.*,gql,html,json,properties,pug,rb,svelte,vue,toml,yaml,yml}', ++ '*.{*sh,env,env.*,gql,html,json,properties,pug,rb,vue,toml,yaml,yml}', + '.*rc', + 'Dockerfile', + ].reduce( diff --git a/test/fixtures/@ota-meshi/eslint-plugin-svelte/App.svelte b/test/fixtures/@ota-meshi/eslint-plugin-svelte/App.svelte index 57c6aa8f..3658f9a4 100644 --- a/test/fixtures/@ota-meshi/eslint-plugin-svelte/App.svelte +++ b/test/fixtures/@ota-meshi/eslint-plugin-svelte/App.svelte @@ -1,5 +1,5 @@ -

Hello {name}!

+

Hello { name }!

diff --git a/test/prettier.js b/test/prettier.js index b4bfd6a2..50357230 100644 --- a/test/prettier.js +++ b/test/prettier.js @@ -264,14 +264,14 @@ runFixture('@ota-meshi/eslint-plugin-svelte/*.svelte', [ [ { column: 5, - endColumn: 13, + endColumn: 11, endLine: 2, fix: { - range: [13, 21], - text: 'name =', + range: [13, 19], + text: 'name', }, line: 2, - message: 'Replace `·name·=·` with `name·=`', + message: 'Replace `·name·` with `name`', messageId: 'replace', nodeType: null, ruleId: 'prettier/prettier', @@ -279,14 +279,14 @@ runFixture('@ota-meshi/eslint-plugin-svelte/*.svelte', [ }, { column: 4, - endColumn: 7, + endColumn: 20, endLine: 5, fix: { - range: [45, 48], - text: '>', + range: [45, 61], + text: '>Hello {name', }, line: 5, - message: 'Replace `·>·` with `>`', + message: 'Replace `·>·Hello·{·name·` with `>Hello·{name`', messageId: 'replace', nodeType: null, ruleId: 'prettier/prettier',