Skip to content

Commit 4fe0365

Browse files
committed
warn if options.name does not begin with a capital letter; tidying
1 parent e76f4fe commit 4fe0365

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

src/validate/index.js

+9
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,15 @@ export default function validate ( parsed, source, { onerror, onwarn, name, file
4444
onerror( error );
4545
}
4646

47+
if ( name && !/^[A-Z]/.test( name ) ) {
48+
const message = `options.name should be capitalised`;
49+
onwarn({
50+
message,
51+
filename,
52+
toString: () => message
53+
});
54+
}
55+
4756
if ( parsed.js ) {
4857
validateJs( validator, parsed.js );
4958
}

src/validate/js/propValidators/components.js

+1-2
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,7 @@ export default function components ( validator, prop ) {
1111
checkForComputedKeys( validator, prop.value.properties );
1212

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

0 commit comments

Comments
 (0)