diff --git a/src/compile/Component.ts b/src/compile/Component.ts index 4a249d2287..ca0ff8b5ba 100644 --- a/src/compile/Component.ts +++ b/src/compile/Component.ts @@ -92,6 +92,7 @@ childKeys.Attribute = ['value']; export default class Component { stats: Stats; + disableWarn: boolean; ast: Ast; source: string; @@ -164,6 +165,7 @@ export default class Component { stats: Stats ) { this.stats = stats; + this.disableWarn = false; this.ast = ast; this.source = source; @@ -541,6 +543,10 @@ export default class Component { message: string } ) { + if (this.disableWarn) { + return; + } + if (!this.locator) { this.locator = getLocator(this.source, { offsetLine: 1 }); } diff --git a/src/compile/nodes/Comment.ts b/src/compile/nodes/Comment.ts index 97a28f25a1..9b8748d576 100644 --- a/src/compile/nodes/Comment.ts +++ b/src/compile/nodes/Comment.ts @@ -7,5 +7,12 @@ export default class Comment extends Node { constructor(component, parent, scope, info) { super(component, parent, scope, info); this.data = info.data; + + const value = this.data.trim(); + if (value === 'svelte-disable') { + component.disableWarn = true; + } else if (value === 'svelte-enable') { + component.disableWarn = false; + } } } \ No newline at end of file