From aa188d4ca3ce94fa739452ce8fa78d63442eb1b5 Mon Sep 17 00:00:00 2001 From: Rich Harris Date: Tue, 16 May 2023 16:06:03 -0400 Subject: [PATCH] exclude create-svelte/template files from prettier, so that we can emit correctly formatted templates --- .prettierrc | 11 ++++++++--- packages/create-svelte/.prettierrc | 0 .../templates/default/src/routes/sverdle/+page.svelte | 4 +--- packages/create-svelte/test/check.js | 3 +-- 4 files changed, 10 insertions(+), 8 deletions(-) create mode 100644 packages/create-svelte/.prettierrc diff --git a/.prettierrc b/.prettierrc index 72264f51e616..207164c7dc84 100644 --- a/.prettierrc +++ b/.prettierrc @@ -5,13 +5,17 @@ "printWidth": 100, "overrides": [ { - "files": ["*.svelte"], + "files": [ + "*.svelte" + ], "options": { "bracketSameLine": false } }, { - "files": ["packages/*/README.md"], + "files": [ + "packages/*/README.md" + ], "options": { "useTabs": false, "tabWidth": 2 @@ -22,6 +26,7 @@ "**/CHANGELOG.md", "**/.svelte-kit/**", "documentation/**/*.md", + "packages/create-svelte/templates/**", "packages/package/test/fixtures/**/expected/**/*", "packages/package/test/watch/expected/**/*", "packages/package/test/watch/package/**/*", @@ -33,4 +38,4 @@ } } ] -} +} \ No newline at end of file diff --git a/packages/create-svelte/.prettierrc b/packages/create-svelte/.prettierrc new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/packages/create-svelte/templates/default/src/routes/sverdle/+page.svelte b/packages/create-svelte/templates/default/src/routes/sverdle/+page.svelte index bbd8fb350981..9d2fa3b42331 100644 --- a/packages/create-svelte/templates/default/src/routes/sverdle/+page.svelte +++ b/packages/create-svelte/templates/default/src/routes/sverdle/+page.svelte @@ -61,9 +61,7 @@ */ function update(event: MouseEvent) { const guess = data.guesses[i]; - const key = /** @type {HTMLButtonElement} */ (event.target as HTMLButtonElement).getAttribute( - 'data-key' - ); + const key = /** @type {HTMLButtonElement} */ (event.target as HTMLButtonElement).getAttribute('data-key'); if (key === 'backspace') { data.guesses[i] = guess.slice(0, -1); diff --git a/packages/create-svelte/test/check.js b/packages/create-svelte/test/check.js index 5112fd424fb4..b03bc90e969a 100644 --- a/packages/create-svelte/test/check.js +++ b/packages/create-svelte/test/check.js @@ -125,8 +125,7 @@ for (const template of templates) { // run provided scripts that are non-blocking. All of them should exit with 0 // package script requires lib dir - // TODO: lint should run before format - const scripts_to_test = ['format', 'lint', 'check', 'build', 'package'].filter( + const scripts_to_test = ['lint', 'format', 'check', 'build', 'package'].filter( (s) => s in pkg.scripts );