Skip to content

Commit ed05ef8

Browse files
committed
add base prop to extract meta error
1 parent 861b1c3 commit ed05ef8

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

dash/extract-meta.js

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -97,11 +97,11 @@ function logError(error, filePath) {
9797
}
9898
}
9999

100-
function isReservedPropName(propName, filepath) {
100+
function isReservedPropName(propName, filepath, baseProp) {
101101
reservedPatterns.forEach(reservedPattern => {
102102
if (reservedPattern.test(propName)) {
103103
logError(
104-
`\nERROR:${filepath}: "${propName}" matches reserved word ` +
104+
`\nERROR:${filepath}: "${baseProp ? baseProp + "." : ""}${propName}" matches reserved word ` +
105105
`pattern: ${reservedPattern.toString()}\n`,
106106
filepath
107107
);
@@ -157,7 +157,7 @@ function parseJSX(filepath) {
157157
function gatherComponents(sources, components = {}) {
158158
const names = [];
159159
const filepaths = [];
160-
let currentFilepath = ""; // For debugging purposes.
160+
let currentFilepath = "", currentBasePropName = ""; // For debugging purposes.
161161

162162
const gather = filepath => {
163163
if (ignorePattern && ignorePattern.test(filepath)) {
@@ -601,7 +601,11 @@ function gatherComponents(sources, components = {}) {
601601

602602
properties.forEach(prop => {
603603
const name = prop.getName();
604-
if (isReservedPropName(name, currentFilepath)) {
604+
605+
if (parentType === null) {
606+
currentBasePropName = name;
607+
}
608+
if (isReservedPropName(name, currentFilepath, currentBasePropName)) {
605609
return;
606610
}
607611
const propType = checker.getTypeOfSymbolAtLocation(

0 commit comments

Comments
 (0)