diff --git a/src/compiler/compile/css/Stylesheet.ts b/src/compiler/compile/css/Stylesheet.ts index 246dab0f1219..27438947ff62 100644 --- a/src/compiler/compile/css/Stylesheet.ts +++ b/src/compiler/compile/css/Stylesheet.ts @@ -435,7 +435,7 @@ export default class Stylesheet { child.warn_on_unused_selector((selector: Selector) => { component.warn(selector.node, { code: `css-unused-selector`, - message: `Unused CSS selector` + message: `Unused CSS selector "${this.source.slice(selector.node.start, selector.node.end)}"` }); }); }); diff --git a/test/css/samples/empty-class/_config.js b/test/css/samples/empty-class/_config.js index cc766d947895..064de4a56441 100644 --- a/test/css/samples/empty-class/_config.js +++ b/test/css/samples/empty-class/_config.js @@ -2,7 +2,7 @@ export default { warnings: [{ filename: "SvelteComponent.svelte", code: `css-unused-selector`, - message: "Unused CSS selector", + message: 'Unused CSS selector ".x"', start: { line: 4, column: 1, diff --git a/test/css/samples/global-with-unused-descendant/_config.js b/test/css/samples/global-with-unused-descendant/_config.js index 3ed2dd27285c..69a69ad65048 100644 --- a/test/css/samples/global-with-unused-descendant/_config.js +++ b/test/css/samples/global-with-unused-descendant/_config.js @@ -13,7 +13,7 @@ export default { 3: color: red; 4: } `, - message: 'Unused CSS selector', + message: 'Unused CSS selector ":global(.foo) .bar"', pos: 9, start: { character: 9, diff --git a/test/css/samples/omit-scoping-attribute-descendant/_config.js b/test/css/samples/omit-scoping-attribute-descendant/_config.js index a4aaec7c19d5..25e2a28ebbf0 100644 --- a/test/css/samples/omit-scoping-attribute-descendant/_config.js +++ b/test/css/samples/omit-scoping-attribute-descendant/_config.js @@ -1,7 +1,7 @@ export default { warnings: [{ code: `css-unused-selector`, - message: 'Unused CSS selector', + message: 'Unused CSS selector "div > p"', start: { line: 8, column: 1, diff --git a/test/css/samples/unused-selector-leading/_config.js b/test/css/samples/unused-selector-leading/_config.js index 20310a5847c5..2516567f597b 100644 --- a/test/css/samples/unused-selector-leading/_config.js +++ b/test/css/samples/unused-selector-leading/_config.js @@ -3,7 +3,7 @@ export default { { filename: "SvelteComponent.svelte", code: `css-unused-selector`, - message: "Unused CSS selector", + message: 'Unused CSS selector ".foo"', start: { line: 4, column: 1, @@ -27,7 +27,7 @@ export default { { filename: "SvelteComponent.svelte", code: `css-unused-selector`, - message: "Unused CSS selector", + message: 'Unused CSS selector ".baz"', start: { line: 4, column: 13, diff --git a/test/css/samples/unused-selector-string-concat/_config.js b/test/css/samples/unused-selector-string-concat/_config.js index 81318fd3ac72..ea8f85754e82 100644 --- a/test/css/samples/unused-selector-string-concat/_config.js +++ b/test/css/samples/unused-selector-string-concat/_config.js @@ -2,7 +2,7 @@ export default { warnings: [ { code: 'css-unused-selector', - message: 'Unused CSS selector', + message: 'Unused CSS selector ".fooaa"', frame: ` 9: `, - message: 'Unused CSS selector', + message: 'Unused CSS selector ".unused"', pos: 198, start: { character: 198, diff --git a/test/css/samples/unused-selector-ternary-nested/_config.js b/test/css/samples/unused-selector-ternary-nested/_config.js index afee5ac82290..936ac639e5eb 100644 --- a/test/css/samples/unused-selector-ternary-nested/_config.js +++ b/test/css/samples/unused-selector-ternary-nested/_config.js @@ -2,7 +2,7 @@ export default { warnings: [ { code: 'css-unused-selector', - message: 'Unused CSS selector', + message: 'Unused CSS selector ".hover.unused"', frame: ` 13: .thing.active {color: blue;} 14: .hover { color: blue; } @@ -16,7 +16,7 @@ export default { }, { code: 'css-unused-selector', - message: 'Unused CSS selector', + message: 'Unused CSS selector ".unused"', frame: ` 15: .hover.unused { color: blue; } 16: diff --git a/test/css/samples/unused-selector-ternary/_config.js b/test/css/samples/unused-selector-ternary/_config.js index 4ff271310802..4eb12f3fe226 100644 --- a/test/css/samples/unused-selector-ternary/_config.js +++ b/test/css/samples/unused-selector-ternary/_config.js @@ -6,7 +6,7 @@ export default { warnings: [{ filename: "SvelteComponent.svelte", code: `css-unused-selector`, - message: "Unused CSS selector", + message: 'Unused CSS selector ".maybeactive"', start: { line: 16, column: 1, diff --git a/test/css/samples/unused-selector/_config.js b/test/css/samples/unused-selector/_config.js index 49fb3a27e767..790eb9e87591 100644 --- a/test/css/samples/unused-selector/_config.js +++ b/test/css/samples/unused-selector/_config.js @@ -2,7 +2,7 @@ export default { warnings: [{ filename: "SvelteComponent.svelte", code: `css-unused-selector`, - message: "Unused CSS selector", + message: 'Unused CSS selector ".bar"', start: { line: 8, column: 1,