Parse disable and enable comments

pull/1861/head
Timothy Johnson 7 years ago
parent 00b4e89651
commit 21c301b81a

@ -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 });
}

@ -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;
}
}
}
Loading…
Cancel
Save