From a8c35daa9a97c1f12c4edb26fca0bac4ebc6f545 Mon Sep 17 00:00:00 2001 From: Simon H <5968653+dummdidumm@users.noreply.github.com> Date: Wed, 14 Jul 2021 09:54:15 +0200 Subject: [PATCH] [fix] be able to silence more warnings (#6504) including css-unused-selector, unused-export-let, module-script-reactive-declaration Fixes #5954 Related to #5281 --- CHANGELOG.md | 1 + src/compiler/compile/Component.ts | 19 +++++++++++ src/compiler/compile/css/Stylesheet.ts | 4 +++ src/compiler/compile/nodes/Comment.ts | 6 +--- src/compiler/compile/render_dom/index.ts | 16 ++------- src/compiler/interfaces.ts | 9 ++++- src/compiler/parse/state/tag.ts | 4 ++- src/compiler/utils/extract_svelte_ignore.ts | 34 +++++++++++++++++++ src/compiler/utils/flatten.ts | 14 ++++++++ .../samples/comment-with-ignores/input.svelte | 1 + .../samples/comment-with-ignores/output.json | 16 +++++++++ test/parser/samples/comment/output.json | 3 +- .../samples/silence-warnings-2/input.svelte | 9 +++++ .../samples/silence-warnings-2/warnings.json | 1 + .../samples/silence-warnings/input.svelte | 15 ++++++++ .../samples/silence-warnings/warnings.json | 1 + 16 files changed, 131 insertions(+), 22 deletions(-) create mode 100644 src/compiler/utils/extract_svelte_ignore.ts create mode 100644 src/compiler/utils/flatten.ts create mode 100644 test/parser/samples/comment-with-ignores/input.svelte create mode 100644 test/parser/samples/comment-with-ignores/output.json create mode 100644 test/validator/samples/silence-warnings-2/input.svelte create mode 100644 test/validator/samples/silence-warnings-2/warnings.json create mode 100644 test/validator/samples/silence-warnings/input.svelte create mode 100644 test/validator/samples/silence-warnings/warnings.json diff --git a/CHANGELOG.md b/CHANGELOG.md index 93e153909326..79e5ee062408 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -21,6 +21,7 @@ * Support `bind:group` in SSR ([#4621](https://github.com/sveltejs/svelte/pull/4621)) * Add sourcemaps to html elements ([#6427](https://github.com/sveltejs/svelte/pull/6427)) * Make ` + + + diff --git a/test/validator/samples/silence-warnings-2/warnings.json b/test/validator/samples/silence-warnings-2/warnings.json new file mode 100644 index 000000000000..fe51488c7066 --- /dev/null +++ b/test/validator/samples/silence-warnings-2/warnings.json @@ -0,0 +1 @@ +[] diff --git a/test/validator/samples/silence-warnings/input.svelte b/test/validator/samples/silence-warnings/input.svelte new file mode 100644 index 000000000000..0e473f51db23 --- /dev/null +++ b/test/validator/samples/silence-warnings/input.svelte @@ -0,0 +1,15 @@ + + + + + + diff --git a/test/validator/samples/silence-warnings/warnings.json b/test/validator/samples/silence-warnings/warnings.json new file mode 100644 index 000000000000..fe51488c7066 --- /dev/null +++ b/test/validator/samples/silence-warnings/warnings.json @@ -0,0 +1 @@ +[]