only warn on missing properties in dev mode, do not warn on whitelisted globals

pull/477/head
Conduitry 8 years ago
parent ec543cf9b6
commit c6304b19f7

@ -148,7 +148,9 @@ export default class Generator {
});
dependencies.forEach( name => {
if ( !globalWhitelist.has( name ) ) {
this.expectedProperties.add( name );
}
});
return {

@ -218,7 +218,7 @@ export default function dom ( parsed, source, options ) {
if ( options.dev ) {
generator.expectedProperties.forEach( prop => {
constructorBlock.addLine(
`if ( !( '${prop}' in this._state ) ) throw new Error( "Component was created without expected data property '${prop}'" );`
`if ( !( '${prop}' in this._state ) ) console.warn( "Component was created without expected data property '${prop}'" );`
);
});

@ -1,7 +1,7 @@
export default {
dev: true,
error ( assert, err ) {
assert.equal( err.message, `Component was created without expected data property 'value'` );
}
warnings: [
`Component was created without expected data property 'value'`
]
};

@ -1,7 +1,8 @@
export default {
dev: true,
error ( assert, err ) {
assert.equal( err.message, `Component was created without expected data property 'foo'` );
}
warnings: [
`Component was created without expected data property 'foo'`,
`Component was created without expected data property 'bar'`
]
};

@ -1 +1,4 @@
<p>{{foo}}</p>
<p>
{{Math.max(0, foo)}}
{{bar}}
</p>

Loading…
Cancel
Save