Skip to content
Permalink
Browse files

Feature/update warning message (#171)

* remove experimental json module

* change: change indentation warning for greater clarity
  • Loading branch information...
ryan-jones authored and dariocravero committed Jun 27, 2019
1 parent df212ca commit 3755a5e1de7fcd1c16df0a53852bedd6d8660f0b
Showing with 31 additions and 9 deletions.
  1. +31 −9 parse/index.js
@@ -128,13 +128,21 @@ export default ({
if (meant && meant !== family) {
warnings.push({
loc: fontFamilyProp.loc,
type: `The font "${family}" is missing. Did you mean "${meant}" instead?\nIf not, download the font files (eg, "${font.id}.woff2", "${font.id}.woff", "${font.id}.ttf", etc) and add the to the "Fonts" folder.`,
type: `The font "${family}" is missing. Did you mean "${meant}" instead?\nIf not, download the font files (eg, "${
font.id
}.woff2", "${font.id}.woff", "${
font.id
}.ttf", etc) and add the to the "Fonts" folder.`,
line: lines[fontFamilyProp.loc.start.line - 1],
})
} else {
warnings.push({
loc: fontFamilyProp.loc,
type: `The font "${family}" is missing.\nDownload the font files (eg, "${font.id}.woff2", "${font.id}.woff", "${font.id}.ttf", etc) and add the to the "Fonts" folder.`,
type: `The font "${family}" is missing.\nDownload the font files (eg, "${
font.id
}.woff2", "${font.id}.woff", "${
font.id
}.ttf", etc) and add the to the "Fonts" folder.`,
line: lines[fontFamilyProp.loc.start.line - 1],
})
}
@@ -270,14 +278,18 @@ export default ({
if (block.isBasic) {
warnings.push({
loc: block.loc,
type: `A basic block "${block.name}" can't be inside a List. Use a view you made instead.`,
type: `A basic block "${
block.name
}" can't be inside a List. Use a view you made instead.`,
line,
blocker: true,
})
} else if (last.children.length > 0) {
warnings.push({
loc: block.loc,
type: `A List can only have one view inside. "${block.name}" is outside of it. Put 1 empty line before.`,
type: `A List can only have one view inside. "${
block.name
}" is outside of it. Put 1 empty line before.`,
line,
})
} else {
@@ -293,7 +305,9 @@ export default ({
if (block.isBasic) {
warnings.push({
loc: block.loc,
type: `A basic block "${block.name}" cant' be inside a View. Use a view you made instead.`,
type: `A basic block "${
block.name
}" cant' be inside a View. Use a view you made instead.`,
line,
blocker: true,
})
@@ -309,7 +323,9 @@ ${block.name}
You should replace "${block.name}" with "SomeView ${block.name}"
That would mean that SomeView in ${block.name} will be replaced by ${block.name}.`,
That would mean that SomeView in ${block.name} will be replaced by ${
block.name
}.`,
})
}
last.children.push(block)
@@ -343,7 +359,9 @@ That would mean that SomeView in ${block.name} will be replaced by ${block.name}
warnings.push({
loc: block.loc,
type: `${block.is ||
block.name} is outside of the top block and it won't render.\nTo fix it, either:\na) add a Vertical at the top and indent all the code inside of it, or\nb) remove it.`,
block.name} is outside of the top block and it won't render. Views relies on indentation to nest child views within View blocks\nTo fix it, either:\na) Indent ${block.is ||
block.name} within the top block and indent all nested views within ${block.is ||
block.name}, or\nb) remove it.`,
line,
})
}
@@ -366,7 +384,9 @@ That would mean that SomeView in ${block.name} will be replaced by ${block.name}
}
} else if (stack.length === 0) {
warnings.push({
type: `A view must start with a View block. ${block.name} isn't valid.\nWrap everything within a View block at the top.`,
type: `A view must start with a View block. ${
block.name
} isn't valid.\nWrap everything within a View block at the top.`,
line,
loc: block.loc,
})
@@ -712,7 +732,9 @@ That would mean that SomeView in ${block.name} will be replaced by ${block.name}
) {
warnings.push({
loc: propNode.loc,
type: `You're missing a base prop for ${propNode.name}. Add it before all whens on the block.`,
type: `You're missing a base prop for ${
propNode.name
}. Add it before all whens on the block.`,
line,
})
}

0 comments on commit 3755a5e

Please sign in to comment.
You can’t perform that action at this time.