Skip to content

Commit

Permalink
warn if options.name does not begin with a capital letter; tidying
Browse files Browse the repository at this point in the history
  • Loading branch information
Conduitry committed Apr 10, 2017
1 parent e76f4fe commit 3bcd0d6
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
4 changes: 4 additions & 0 deletions src/validate/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,10 @@ export default function validate ( parsed, source, { onerror, onwarn, name, file
onerror( error );
}

if ( name && !/^[A-Z]/.test( name ) ) {
onwarn({ message: `options.name should be capitalized` });
}

if ( parsed.js ) {
validateJs( validator, parsed.js );
}
Expand Down
3 changes: 1 addition & 2 deletions src/validate/js/propValidators/components.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@ export default function components ( validator, prop ) {
checkForComputedKeys( validator, prop.value.properties );

prop.value.properties.forEach( component => {
const char = component.key.name[0];
if ( char === char.toLowerCase() ) {
if ( !/^[A-Z]/.test( component.key.name ) ) {
validator.warn( `Component names should be capitalised`, component.start );
}
});
Expand Down

0 comments on commit 3bcd0d6

Please sign in to comment.