all but two tests passing

pull/1721/head
Rich Harris 7 years ago
parent 395a762982
commit d5c45cbac9

@ -53,6 +53,7 @@ function getIndentationLevel(str: string, b: number) {
}
function getIndentExclusionRanges(node: Node) {
// TODO can we fold this into a different pass?
const ranges: Node[] = [];
walk(node, {
enter(node: Node) {
@ -868,7 +869,6 @@ export default class Component {
if (js) {
this.addSourcemapLocations(js.content);
const indentation = detectIndentation(source.slice(js.start, js.end));
const indentationLevel = getIndentationLevel(source, js.content.body[0].start);
const indentExclusionRanges = getIndentExclusionRanges(js.content);

@ -1,30 +0,0 @@
import { Validator } from '../index';
import { Node } from '../../interfaces';
import unpackDestructuring from '../../utils/unpackDestructuring';
function isEmptyBlock(node: Node) {
if (!/Block$/.test(node.type) || !node.children) return false;
if (node.children.length > 1) return false;
const child = node.children[0];
return !child || (child.type === 'Text' && !/[^ \r\n\f\v\t]/.test(child.data));
}
export default function validateHtml(validator: Validator, html: Node) {
function visit(node: Node) {
if (node.type === 'EachBlock') {
const contexts = [];
unpackDestructuring(contexts, node.context, '');
contexts.forEach(prop => {
if (validator.helpers.has(prop.key.name)) {
validator.warn(prop.key, {
code: `each-context-clash`,
message: `Context clashes with a helper. Rename one or the other to eliminate any ambiguity`
});
}
});
}
}
html.children.forEach(visit);
}

@ -1,5 +1,4 @@
import validateJs from './js/index';
import validateHtml from './html/index';
import { getLocator, Location } from 'locate-character';
import getCodeFrame from '../utils/getCodeFrame';
import Stats from '../Stats';
@ -135,10 +134,6 @@ export default function validate(
stylesheet.validate(validator);
}
if (ast.html) {
validateHtml(validator, ast.html);
}
// need to do a second pass of the JS, now that we've analysed the markup
if (ast.js && validator.defaultExport) {
const categories = {

Loading…
Cancel
Save