From d5c45cbac9a91ad6a95993d6d43aedcd0a4ebe27 Mon Sep 17 00:00:00 2001 From: Rich Harris Date: Fri, 14 Sep 2018 21:14:18 -0400 Subject: [PATCH] all but two tests passing --- src/compile/Component.ts | 2 +- src/validate/html/index.ts | 30 ------------------------------ src/validate/index.ts | 5 ----- 3 files changed, 1 insertion(+), 36 deletions(-) delete mode 100644 src/validate/html/index.ts diff --git a/src/compile/Component.ts b/src/compile/Component.ts index bebafa48f7..71319f412d 100644 --- a/src/compile/Component.ts +++ b/src/compile/Component.ts @@ -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); diff --git a/src/validate/html/index.ts b/src/validate/html/index.ts deleted file mode 100644 index 0e3741fc65..0000000000 --- a/src/validate/html/index.ts +++ /dev/null @@ -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); -} diff --git a/src/validate/index.ts b/src/validate/index.ts index 1a50a468e7..71ae8af7e8 100644 --- a/src/validate/index.ts +++ b/src/validate/index.ts @@ -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 = {