warn if options.name does not begin with a capital letter; tidying

pull/464/head
Conduitry 8 years ago
parent e76f4fe6cd
commit 4fe03652f8

@ -44,6 +44,15 @@ export default function validate ( parsed, source, { onerror, onwarn, name, file
onerror( error ); onerror( error );
} }
if ( name && !/^[A-Z]/.test( name ) ) {
const message = `options.name should be capitalised`;
onwarn({
message,
filename,
toString: () => message
});
}
if ( parsed.js ) { if ( parsed.js ) {
validateJs( validator, parsed.js ); validateJs( validator, parsed.js );
} }

@ -11,8 +11,7 @@ export default function components ( validator, prop ) {
checkForComputedKeys( validator, prop.value.properties ); checkForComputedKeys( validator, prop.value.properties );
prop.value.properties.forEach( component => { prop.value.properties.forEach( component => {
const char = component.key.name[0]; if ( !/^[A-Z]/.test( component.key.name ) ) {
if ( char === char.toLowerCase() ) {
validator.warn( `Component names should be capitalised`, component.start ); validator.warn( `Component names should be capitalised`, component.start );
} }
}); });

Loading…
Cancel
Save