upgrade ESLint config (#5472)

pull/7738/head
Ben McCann 5 years ago committed by GitHub
parent e6cfd43a84
commit b68fc1526e

4
package-lock.json generated

@ -144,8 +144,8 @@
} }
}, },
"@sveltejs/eslint-config": { "@sveltejs/eslint-config": {
"version": "github:sveltejs/eslint-config#848ce6464a9ae9c2f3a3095474701dfe9ab851df", "version": "github:sveltejs/eslint-config#673335baf2ebc4b845eca9ea8eb51a050fd5cc25",
"from": "github:sveltejs/eslint-config#v5.0.0", "from": "github:sveltejs/eslint-config#v5.2.0",
"dev": true "dev": true
}, },
"@tootallnate/once": { "@tootallnate/once": {

@ -37,7 +37,7 @@
"posttest": "agadoo internal/index.mjs", "posttest": "agadoo internal/index.mjs",
"prepublishOnly": "npm run lint && PUBLISH=true npm test", "prepublishOnly": "npm run lint && PUBLISH=true npm test",
"tsd": "tsc -p src/compiler --emitDeclarationOnly && tsc -p src/runtime --emitDeclarationOnly", "tsd": "tsc -p src/compiler --emitDeclarationOnly && tsc -p src/runtime --emitDeclarationOnly",
"lint": "eslint \"{src,test}/**/*.{ts,js}\"" "lint": "eslint '{src,test}/**/*.{ts,js}'"
}, },
"repository": { "repository": {
"type": "git", "type": "git",
@ -63,7 +63,7 @@
"@rollup/plugin-sucrase": "^3.0.0", "@rollup/plugin-sucrase": "^3.0.0",
"@rollup/plugin-typescript": "^2.0.1", "@rollup/plugin-typescript": "^2.0.1",
"@rollup/plugin-virtual": "^2.0.0", "@rollup/plugin-virtual": "^2.0.0",
"@sveltejs/eslint-config": "github:sveltejs/eslint-config#v5.0.0", "@sveltejs/eslint-config": "github:sveltejs/eslint-config#v5.2.0",
"@types/mocha": "^7.0.0", "@types/mocha": "^7.0.0",
"@types/node": "^8.10.53", "@types/node": "^8.10.53",
"@typescript-eslint/eslint-plugin": "^3.0.2", "@typescript-eslint/eslint-plugin": "^3.0.2",

@ -157,7 +157,7 @@ export default class Component {
) || { start: 0, end: 0 }; ) || { start: 0, end: 0 };
this.warn(svelteOptions, { this.warn(svelteOptions, {
code: 'custom-element-no-tag', code: 'custom-element-no-tag',
message: `No custom element 'tag' option was specified. To automatically register a custom element, specify a name with a hyphen in it, e.g. <svelte:options tag="my-thing"/>. To hide this warning, use <svelte:options tag={null}/>` message: 'No custom element \'tag\' option was specified. To automatically register a custom element, specify a name with a hyphen in it, e.g. <svelte:options tag="my-thing"/>. To hide this warning, use <svelte:options tag={null}/>'
}); });
} }
this.tag = this.component_options.tag || compile_options.tag; this.tag = this.component_options.tag || compile_options.tag;
@ -241,7 +241,7 @@ export default class Component {
const { compile_options, name } = this; const { compile_options, name } = this;
const { format = 'esm' } = compile_options; const { format = 'esm' } = compile_options;
const banner = `${this.file ? `${this.file} ` : ``}generated by Svelte v${'__VERSION__'}`; const banner = `${this.file ? `${this.file} ` : ''}generated by Svelte v${'__VERSION__'}`;
const program: any = { type: 'Program', body: result.js }; const program: any = { type: 'Program', body: result.js };
@ -458,16 +458,16 @@ export default class Component {
extract_exports(node) { extract_exports(node) {
if (node.type === 'ExportDefaultDeclaration') { if (node.type === 'ExportDefaultDeclaration') {
this.error(node, { this.error(node, {
code: `default-export`, code: 'default-export',
message: `A component cannot have a default export` message: 'A component cannot have a default export'
}); });
} }
if (node.type === 'ExportNamedDeclaration') { if (node.type === 'ExportNamedDeclaration') {
if (node.source) { if (node.source) {
this.error(node, { this.error(node, {
code: `not-implemented`, code: 'not-implemented',
message: `A component currently cannot have an export ... from` message: 'A component currently cannot have an export ... from'
}); });
} }
if (node.declaration) { if (node.declaration) {
@ -478,7 +478,7 @@ export default class Component {
variable.export_name = name; variable.export_name = name;
if (variable.writable && !(variable.referenced || variable.referenced_from_script || variable.subscribable)) { if (variable.writable && !(variable.referenced || variable.referenced_from_script || variable.subscribable)) {
this.warn(declarator, { this.warn(declarator, {
code: `unused-export-let`, code: 'unused-export-let',
message: `${this.name.name} has unused export property '${name}'. If it is for external reference only, please consider using \`export const ${name}\`` message: `${this.name.name} has unused export property '${name}'. If it is for external reference only, please consider using \`export const ${name}\``
}); });
} }
@ -501,7 +501,7 @@ export default class Component {
if (variable.writable && !(variable.referenced || variable.referenced_from_script || variable.subscribable)) { if (variable.writable && !(variable.referenced || variable.referenced_from_script || variable.subscribable)) {
this.warn(specifier, { this.warn(specifier, {
code: `unused-export-let`, code: 'unused-export-let',
message: `${this.name.name} has unused export property '${specifier.exported.name}'. If it is for external reference only, please consider using \`export const ${specifier.exported.name}\`` message: `${this.name.name} has unused export property '${specifier.exported.name}'. If it is for external reference only, please consider using \`export const ${specifier.exported.name}\``
}); });
} }
@ -550,7 +550,7 @@ export default class Component {
if (name[0] === '$') { if (name[0] === '$') {
this.error(node as any, { this.error(node as any, {
code: 'illegal-declaration', code: 'illegal-declaration',
message: `The $ prefix is reserved, and cannot be used for variable and import names` message: 'The $ prefix is reserved, and cannot be used for variable and import names'
}); });
} }
@ -568,7 +568,7 @@ export default class Component {
if (name[0] === '$') { if (name[0] === '$') {
this.error(node as any, { this.error(node as any, {
code: 'illegal-subscription', code: 'illegal-subscription',
message: `Cannot reference store value inside <script context="module">` message: 'Cannot reference store value inside <script context="module">'
}); });
} else { } else {
this.add_var({ this.add_var({
@ -629,7 +629,7 @@ export default class Component {
if (name[0] === '$') { if (name[0] === '$') {
this.error(node as any, { this.error(node as any, {
code: 'illegal-declaration', code: 'illegal-declaration',
message: `The $ prefix is reserved, and cannot be used for variable and import names` message: 'The $ prefix is reserved, and cannot be used for variable and import names'
}); });
} }
@ -867,8 +867,8 @@ export default class Component {
if (name[1] !== '$' && scope.has(name.slice(1)) && scope.find_owner(name.slice(1)) !== this.instance_scope) { if (name[1] !== '$' && scope.has(name.slice(1)) && scope.find_owner(name.slice(1)) !== this.instance_scope) {
this.error(node, { this.error(node, {
code: `contextual-store`, code: 'contextual-store',
message: `Stores must be declared at the top level of the component (this may change in a future version of Svelte)` message: 'Stores must be declared at the top level of the component (this may change in a future version of Svelte)'
}); });
} }
} }
@ -935,7 +935,7 @@ export default class Component {
// TODO is this still true post-#3539? // TODO is this still true post-#3539?
component.error(declarator as any, { component.error(declarator as any, {
code: 'destructured-prop', code: 'destructured-prop',
message: `Cannot declare props in destructured declaration` message: 'Cannot declare props in destructured declaration'
}); });
} }
@ -1379,7 +1379,7 @@ function process_component_options(component: Component, nodes) {
switch (name) { switch (name) {
case 'tag': { case 'tag': {
const code = 'invalid-tag-attribute'; const code = 'invalid-tag-attribute';
const message = `'tag' must be a string literal`; const message = "'tag' must be a string literal";
const tag = get_value(attribute, code, message); const tag = get_value(attribute, code, message);
if (typeof tag !== 'string' && tag !== null) if (typeof tag !== 'string' && tag !== null)
@ -1387,15 +1387,15 @@ function process_component_options(component: Component, nodes) {
if (tag && !/^[a-zA-Z][a-zA-Z0-9]*-[a-zA-Z0-9-]+$/.test(tag)) { if (tag && !/^[a-zA-Z][a-zA-Z0-9]*-[a-zA-Z0-9-]+$/.test(tag)) {
component.error(attribute, { component.error(attribute, {
code: `invalid-tag-property`, code: 'invalid-tag-property',
message: `tag name must be two or more words joined by the '-' character` message: "tag name must be two or more words joined by the '-' character"
}); });
} }
if (tag && !component.compile_options.customElement) { if (tag && !component.compile_options.customElement) {
component.warn(attribute, { component.warn(attribute, {
code: 'missing-custom-element-compile-options', code: 'missing-custom-element-compile-options',
message: `The 'tag' option is used when generating a custom element. Did you forget the 'customElement: true' compile option?` message: "The 'tag' option is used when generating a custom element. Did you forget the 'customElement: true' compile option?"
}); });
} }
@ -1405,7 +1405,7 @@ function process_component_options(component: Component, nodes) {
case 'namespace': { case 'namespace': {
const code = 'invalid-namespace-attribute'; const code = 'invalid-namespace-attribute';
const message = `The 'namespace' attribute must be a string literal representing a valid namespace`; const message = "The 'namespace' attribute must be a string literal representing a valid namespace";
const ns = get_value(attribute, code, message); const ns = get_value(attribute, code, message);
if (typeof ns !== 'string') if (typeof ns !== 'string')
@ -1415,12 +1415,12 @@ function process_component_options(component: Component, nodes) {
const match = fuzzymatch(ns, valid_namespaces); const match = fuzzymatch(ns, valid_namespaces);
if (match) { if (match) {
component.error(attribute, { component.error(attribute, {
code: `invalid-namespace-property`, code: 'invalid-namespace-property',
message: `Invalid namespace '${ns}' (did you mean '${match}'?)` message: `Invalid namespace '${ns}' (did you mean '${match}'?)`
}); });
} else { } else {
component.error(attribute, { component.error(attribute, {
code: `invalid-namespace-property`, code: 'invalid-namespace-property',
message: `Invalid namespace '${ns}'` message: `Invalid namespace '${ns}'`
}); });
} }
@ -1446,14 +1446,14 @@ function process_component_options(component: Component, nodes) {
default: default:
component.error(attribute, { component.error(attribute, {
code: `invalid-options-attribute`, code: 'invalid-options-attribute',
message: `<svelte:options> unknown attribute` message: '<svelte:options> unknown attribute'
}); });
} }
} else { } else {
component.error(attribute, { component.error(attribute, {
code: `invalid-options-attribute`, code: 'invalid-options-attribute',
message: `<svelte:options> can only have static 'tag', 'namespace', 'accessors', 'immutable' and 'preserveWhitespace' attributes` message: "<svelte:options> can only have static 'tag', 'namespace', 'accessors', 'immutable' and 'preserveWhitespace' attributes"
}); });
} }
}); });

@ -118,8 +118,8 @@ export default class Selector {
const selector = block.selectors[i]; const selector = block.selectors[i];
if (selector.type === 'PseudoClassSelector' && selector.name === 'global') { if (selector.type === 'PseudoClassSelector' && selector.name === 'global') {
component.error(selector, { component.error(selector, {
code: `css-invalid-global`, code: 'css-invalid-global',
message: `:global(...) must be the first element in a compound selector` message: ':global(...) must be the first element in a compound selector'
}); });
} }
} }
@ -139,8 +139,8 @@ export default class Selector {
for (let i = start; i < end; i += 1) { for (let i = start; i < end; i += 1) {
if (this.blocks[i].global) { if (this.blocks[i].global) {
component.error(this.blocks[i].selectors[0], { component.error(this.blocks[i].selectors[0], {
code: `css-invalid-global`, code: 'css-invalid-global',
message: `:global(...) can be at the start or end of a selector sequence, but not in the middle` message: ':global(...) can be at the start or end of a selector sequence, but not in the middle'
}); });
} }
} }
@ -286,7 +286,7 @@ function test_attribute(operator, expected_value, case_insensitive, value) {
case '^=': return value.startsWith(expected_value); case '^=': return value.startsWith(expected_value);
case '$=': return value.endsWith(expected_value); case '$=': return value.endsWith(expected_value);
case '*=': return value.includes(expected_value); case '*=': return value.includes(expected_value);
default: throw new Error(`this shouldn't happen`); default: throw new Error("this shouldn't happen");
} }
} }

@ -5,7 +5,7 @@ import Element from '../nodes/Element';
import { Ast } from '../../interfaces'; import { Ast } from '../../interfaces';
import Component from '../Component'; import Component from '../Component';
import { CssNode } from './interfaces'; import { CssNode } from './interfaces';
import hash from "../utils/hash"; import hash from '../utils/hash';
function remove_css_prefix(name: string): string { function remove_css_prefix(name: string): string {
return name.replace(/^-((webkit)|(moz)|(o)|(ms))-/, ''); return name.replace(/^-((webkit)|(moz)|(o)|(ms))-/, '');
@ -428,7 +428,7 @@ export default class Stylesheet {
this.children.forEach(child => { this.children.forEach(child => {
child.warn_on_unused_selector((selector: Selector) => { child.warn_on_unused_selector((selector: Selector) => {
component.warn(selector.node, { component.warn(selector.node, {
code: `css-unused-selector`, code: 'css-unused-selector',
message: `Unused CSS selector "${this.source.slice(selector.node.start, selector.node.end)}"` message: `Unused CSS selector "${this.source.slice(selector.node.start, selector.node.end)}"`
}); });
}); });

@ -46,9 +46,9 @@ function validate_options(options: CompileOptions, warnings: Warning[]) {
} }
if (name && /^[a-z]/.test(name)) { if (name && /^[a-z]/.test(name)) {
const message = `options.name should be capitalised`; const message = 'options.name should be capitalised';
warnings.push({ warnings.push({
code: `options-lowercase-name`, code: 'options-lowercase-name',
message, message,
filename, filename,
toString: () => message toString: () => message
@ -58,7 +58,7 @@ function validate_options(options: CompileOptions, warnings: Warning[]) {
if (loopGuardTimeout && !dev) { if (loopGuardTimeout && !dev) {
const message = 'options.loopGuardTimeout is for options.dev = true only'; const message = 'options.loopGuardTimeout is for options.dev = true only';
warnings.push({ warnings.push({
code: `options-loop-guard-timeout`, code: 'options-loop-guard-timeout',
message, message,
filename, filename,
toString: () => message toString: () => message

@ -17,8 +17,8 @@ export default class Animation extends Node {
if (parent.animation) { if (parent.animation) {
component.error(this, { component.error(this, {
code: `duplicate-animation`, code: 'duplicate-animation',
message: `An element can only have one 'animate' directive` message: "An element can only have one 'animate' directive"
}); });
} }
@ -26,8 +26,8 @@ export default class Animation extends Node {
if (!block || block.type !== 'EachBlock' || !block.key) { if (!block || block.type !== 'EachBlock' || !block.key) {
// TODO can we relax the 'immediate child' rule? // TODO can we relax the 'immediate child' rule?
component.error(this, { component.error(this, {
code: `invalid-animation`, code: 'invalid-animation',
message: `An element that use the animate directive must be the immediate child of a keyed each block` message: 'An element that use the animate directive must be the immediate child of a keyed each block'
}); });
} }

@ -3,7 +3,7 @@ import get_object from '../utils/get_object';
import Expression from './shared/Expression'; import Expression from './shared/Expression';
import Component from '../Component'; import Component from '../Component';
import TemplateScope from './shared/TemplateScope'; import TemplateScope from './shared/TemplateScope';
import {dimensions} from "../../utils/patterns"; import {dimensions} from '../../utils/patterns';
import { Node as ESTreeNode } from 'estree'; import { Node as ESTreeNode } from 'estree';
// TODO this should live in a specific binding // TODO this should live in a specific binding

@ -60,8 +60,8 @@ export default class EachBlock extends AbstractBlock {
if (this.children.length !== 1) { if (this.children.length !== 1) {
const child = this.children.find(child => !!(child as Element).animation); const child = this.children.find(child => !!(child as Element).animation);
component.error((child as Element).animation, { component.error((child as Element).animation, {
code: `invalid-animation`, code: 'invalid-animation',
message: `An element that use the animate directive must be the sole child of a keyed each block` message: 'An element that use the animate directive must be the sole child of a keyed each block'
}); });
} }
} }

@ -63,14 +63,14 @@ const a11y_no_onchange = new Set([
]); ]);
const a11y_labelable = new Set([ const a11y_labelable = new Set([
"button", 'button',
"input", 'input',
"keygen", 'keygen',
"meter", 'meter',
"output", 'output',
"progress", 'progress',
"select", 'select',
"textarea" 'textarea'
]); ]);
const invisible_elements = new Set(['meta', 'html', 'script', 'style']); const invisible_elements = new Set(['meta', 'html', 'script', 'style']);
@ -136,8 +136,8 @@ export default class Element extends Node {
const value_attribute = info.attributes.find(node => node.name === 'value'); const value_attribute = info.attributes.find(node => node.name === 'value');
if (value_attribute) { if (value_attribute) {
component.error(value_attribute, { component.error(value_attribute, {
code: `textarea-duplicate-value`, code: 'textarea-duplicate-value',
message: `A <textarea> can have either a value attribute or (equivalently) child content, but not both` message: 'A <textarea> can have either a value attribute or (equivalently) child content, but not both'
}); });
} }
@ -251,7 +251,7 @@ export default class Element extends Node {
if (a11y_distracting_elements.has(this.name)) { if (a11y_distracting_elements.has(this.name)) {
// no-distracting-elements // no-distracting-elements
this.component.warn(this, { this.component.warn(this, {
code: `a11y-distracting-elements`, code: 'a11y-distracting-elements',
message: `A11y: Avoid <${this.name}> elements` message: `A11y: Avoid <${this.name}> elements`
}); });
} }
@ -273,8 +273,8 @@ export default class Element extends Node {
if (!is_figure_parent) { if (!is_figure_parent) {
this.component.warn(this, { this.component.warn(this, {
code: `a11y-structure`, code: 'a11y-structure',
message: `A11y: <figcaption> must be an immediate child of <figure>` message: 'A11y: <figcaption> must be an immediate child of <figure>'
}); });
} }
} }
@ -290,8 +290,8 @@ export default class Element extends Node {
if (index !== -1 && (index !== 0 && index !== children.length - 1)) { if (index !== -1 && (index !== 0 && index !== children.length - 1)) {
this.component.warn(children[index], { this.component.warn(children[index], {
code: `a11y-structure`, code: 'a11y-structure',
message: `A11y: <figcaption> must be first or last child of <figure>` message: 'A11y: <figcaption> must be first or last child of <figure>'
}); });
} }
} }
@ -318,7 +318,7 @@ export default class Element extends Node {
if (invisible_elements.has(this.name)) { if (invisible_elements.has(this.name)) {
// aria-unsupported-elements // aria-unsupported-elements
component.warn(attribute, { component.warn(attribute, {
code: `a11y-aria-attributes`, code: 'a11y-aria-attributes',
message: `A11y: <${this.name}> should not have aria-* attributes` message: `A11y: <${this.name}> should not have aria-* attributes`
}); });
} }
@ -330,14 +330,14 @@ export default class Element extends Node {
if (match) message += ` (did you mean '${match}'?)`; if (match) message += ` (did you mean '${match}'?)`;
component.warn(attribute, { component.warn(attribute, {
code: `a11y-unknown-aria-attribute`, code: 'a11y-unknown-aria-attribute',
message message
}); });
} }
if (name === 'aria-hidden' && /^h[1-6]$/.test(this.name)) { if (name === 'aria-hidden' && /^h[1-6]$/.test(this.name)) {
component.warn(attribute, { component.warn(attribute, {
code: `a11y-hidden`, code: 'a11y-hidden',
message: `A11y: <${this.name}> element should not be hidden` message: `A11y: <${this.name}> element should not be hidden`
}); });
} }
@ -348,7 +348,7 @@ export default class Element extends Node {
if (invisible_elements.has(this.name)) { if (invisible_elements.has(this.name)) {
// aria-unsupported-elements // aria-unsupported-elements
component.warn(attribute, { component.warn(attribute, {
code: `a11y-misplaced-role`, code: 'a11y-misplaced-role',
message: `A11y: <${this.name}> should not have role attribute` message: `A11y: <${this.name}> should not have role attribute`
}); });
} }
@ -362,7 +362,7 @@ export default class Element extends Node {
if (match) message += ` (did you mean '${match}'?)`; if (match) message += ` (did you mean '${match}'?)`;
component.warn(attribute, { component.warn(attribute, {
code: `a11y-unknown-role`, code: 'a11y-unknown-role',
message message
}); });
} }
@ -371,24 +371,24 @@ export default class Element extends Node {
// no-access-key // no-access-key
if (name === 'accesskey') { if (name === 'accesskey') {
component.warn(attribute, { component.warn(attribute, {
code: `a11y-accesskey`, code: 'a11y-accesskey',
message: `A11y: Avoid using accesskey` message: 'A11y: Avoid using accesskey'
}); });
} }
// no-autofocus // no-autofocus
if (name === 'autofocus') { if (name === 'autofocus') {
component.warn(attribute, { component.warn(attribute, {
code: `a11y-autofocus`, code: 'a11y-autofocus',
message: `A11y: Avoid using autofocus` message: 'A11y: Avoid using autofocus'
}); });
} }
// scope // scope
if (name === 'scope' && this.name !== 'th') { if (name === 'scope' && this.name !== 'th') {
component.warn(attribute, { component.warn(attribute, {
code: `a11y-misplaced-scope`, code: 'a11y-misplaced-scope',
message: `A11y: The scope attribute should only be used with <th> elements` message: 'A11y: The scope attribute should only be used with <th> elements'
}); });
} }
@ -398,8 +398,8 @@ export default class Element extends Node {
// @ts-ignore todo is tabindex=true correct case? // @ts-ignore todo is tabindex=true correct case?
if (!isNaN(value) && +value > 0) { if (!isNaN(value) && +value > 0) {
component.warn(attribute, { component.warn(attribute, {
code: `a11y-positive-tabindex`, code: 'a11y-positive-tabindex',
message: `A11y: avoid tabindex values above zero` message: 'A11y: avoid tabindex values above zero'
}); });
} }
} }
@ -407,7 +407,7 @@ export default class Element extends Node {
if (/(^[0-9-.])|[\^$@%&#?!|()[\]{}^*+~;]/.test(name)) { if (/(^[0-9-.])|[\^$@%&#?!|()[\]{}^*+~;]/.test(name)) {
component.error(attribute, { component.error(attribute, {
code: `illegal-attribute`, code: 'illegal-attribute',
message: `'${name}' is not a valid attribute name` message: `'${name}' is not a valid attribute name`
}); });
} }
@ -415,14 +415,14 @@ export default class Element extends Node {
if (name === 'slot') { if (name === 'slot') {
if (!attribute.is_static) { if (!attribute.is_static) {
component.error(attribute, { component.error(attribute, {
code: `invalid-slot-attribute`, code: 'invalid-slot-attribute',
message: `slot attribute cannot have a dynamic value` message: 'slot attribute cannot have a dynamic value'
}); });
} }
if (component.slot_outlets.has(name)) { if (component.slot_outlets.has(name)) {
component.error(attribute, { component.error(attribute, {
code: `duplicate-slot-attribute`, code: 'duplicate-slot-attribute',
message: `Duplicate '${name}' slot` message: `Duplicate '${name}' slot`
}); });
@ -431,8 +431,8 @@ export default class Element extends Node {
if (!(parent.type === 'InlineComponent' || within_custom_element(parent))) { if (!(parent.type === 'InlineComponent' || within_custom_element(parent))) {
component.error(attribute, { component.error(attribute, {
code: `invalid-slotted-content`, code: 'invalid-slotted-content',
message: `Element with a slot='...' attribute must be a child of a component or a descendant of a custom element` message: 'Element with a slot=\'...\' attribute must be a child of a component or a descendant of a custom element'
}); });
} }
} }
@ -440,7 +440,7 @@ export default class Element extends Node {
if (name === 'is') { if (name === 'is') {
component.warn(attribute, { component.warn(attribute, {
code: 'avoid-is', code: 'avoid-is',
message: `The 'is' attribute is not supported cross-browser and should be avoided` message: 'The \'is\' attribute is not supported cross-browser and should be avoided'
}); });
} }
@ -471,7 +471,7 @@ export default class Element extends Node {
if (href_value === '' || href_value === '#' || /^\W*javascript:/i.test(href_value)) { if (href_value === '' || href_value === '#' || /^\W*javascript:/i.test(href_value)) {
component.warn(href_attribute, { component.warn(href_attribute, {
code: `a11y-invalid-attribute`, code: 'a11y-invalid-attribute',
message: `A11y: '${href_value}' is not a valid ${href_attribute.name} attribute` message: `A11y: '${href_value}' is not a valid ${href_attribute.name} attribute`
}); });
} }
@ -481,8 +481,8 @@ export default class Element extends Node {
if (!id_attribute_valid && !name_attribute_valid) { if (!id_attribute_valid && !name_attribute_valid) {
component.warn(this, { component.warn(this, {
code: `a11y-missing-attribute`, code: 'a11y-missing-attribute',
message: `A11y: <a> element should have an href attribute` message: 'A11y: <a> element should have an href attribute'
}); });
} }
} }
@ -520,8 +520,8 @@ export default class Element extends Node {
if (/\b(image|picture|photo)\b/i.test(alt_value)) { if (/\b(image|picture|photo)\b/i.test(alt_value)) {
component.warn(this, { component.warn(this, {
code: `a11y-img-redundant-alt`, code: 'a11y-img-redundant-alt',
message: `A11y: Screenreaders already announce <img> elements as an image.` message: 'A11y: Screenreaders already announce <img> elements as an image.'
}); });
} }
} }
@ -531,8 +531,8 @@ export default class Element extends Node {
const has_input_child = this.children.some(i => (i instanceof Element && a11y_labelable.has(i.name) )); const has_input_child = this.children.some(i => (i instanceof Element && a11y_labelable.has(i.name) ));
if (!attribute_map.has('for') && !has_input_child) { if (!attribute_map.has('for') && !has_input_child) {
component.warn(this, { component.warn(this, {
code: `a11y-label-has-associated-control`, code: 'a11y-label-has-associated-control',
message: `A11y: A form label must be associated with a control.` message: 'A11y: A form label must be associated with a control.'
}); });
} }
} }
@ -550,8 +550,8 @@ export default class Element extends Node {
if (!has_caption) { if (!has_caption) {
component.warn(this, { component.warn(this, {
code: `a11y-media-has-caption`, code: 'a11y-media-has-caption',
message: `A11y: Media elements must have a <track kind="captions">` message: 'A11y: Media elements must have a <track kind="captions">'
}); });
} }
} }
@ -559,8 +559,8 @@ export default class Element extends Node {
if (a11y_no_onchange.has(this.name)) { if (a11y_no_onchange.has(this.name)) {
if (handlers_map.has('change') && !handlers_map.has('blur')) { if (handlers_map.has('change') && !handlers_map.has('blur')) {
component.warn(this, { component.warn(this, {
code: `a11y-no-onchange`, code: 'a11y-no-onchange',
message: `A11y: on:blur must be used instead of on:change, unless absolutely necessary and it causes no negative consequences for keyboard only or screen reader users.` message: 'A11y: on:blur must be used instead of on:change, unless absolutely necessary and it causes no negative consequences for keyboard only or screen reader users.'
}); });
} }
} }
@ -578,8 +578,8 @@ export default class Element extends Node {
if (!attribute.is_static) { if (!attribute.is_static) {
component.error(attribute, { component.error(attribute, {
code: `invalid-type`, code: 'invalid-type',
message: `'type' attribute cannot be dynamic if input uses two-way binding` message: '\'type\' attribute cannot be dynamic if input uses two-way binding'
}); });
} }
@ -587,8 +587,8 @@ export default class Element extends Node {
if (value === true) { if (value === true) {
component.error(attribute, { component.error(attribute, {
code: `missing-type`, code: 'missing-type',
message: `'type' attribute must be specified` message: '\'type\' attribute must be specified'
}); });
} }
@ -605,7 +605,7 @@ export default class Element extends Node {
this.name !== 'select' this.name !== 'select'
) { ) {
component.error(binding, { component.error(binding, {
code: `invalid-binding`, code: 'invalid-binding',
message: `'value' is not a valid binding on <${this.name}> elements` message: `'value' is not a valid binding on <${this.name}> elements`
}); });
} }
@ -617,8 +617,8 @@ export default class Element extends Node {
if (attribute && !attribute.is_static) { if (attribute && !attribute.is_static) {
component.error(attribute, { component.error(attribute, {
code: `dynamic-multiple-attribute`, code: 'dynamic-multiple-attribute',
message: `'multiple' attribute cannot be dynamic if select uses two-way binding` message: '\'multiple\' attribute cannot be dynamic if select uses two-way binding'
}); });
} }
} else { } else {
@ -627,7 +627,7 @@ export default class Element extends Node {
} else if (name === 'checked' || name === 'indeterminate') { } else if (name === 'checked' || name === 'indeterminate') {
if (this.name !== 'input') { if (this.name !== 'input') {
component.error(binding, { component.error(binding, {
code: `invalid-binding`, code: 'invalid-binding',
message: `'${name}' is not a valid binding on <${this.name}> elements` message: `'${name}' is not a valid binding on <${this.name}> elements`
}); });
} }
@ -636,13 +636,13 @@ export default class Element extends Node {
if (type !== 'checkbox') { if (type !== 'checkbox') {
let message = `'${name}' binding can only be used with <input type="checkbox">`; let message = `'${name}' binding can only be used with <input type="checkbox">`;
if (type === 'radio') message += ` — for <input type="radio">, use 'group' binding`; if (type === 'radio') message += ' — for <input type="radio">, use \'group\' binding';
component.error(binding, { code: `invalid-binding`, message }); component.error(binding, { code: 'invalid-binding', message });
} }
} else if (name === 'group') { } else if (name === 'group') {
if (this.name !== 'input') { if (this.name !== 'input') {
component.error(binding, { component.error(binding, {
code: `invalid-binding`, code: 'invalid-binding',
message: `'group' is not a valid binding on <${this.name}> elements` message: `'group' is not a valid binding on <${this.name}> elements`
}); });
} }
@ -651,14 +651,14 @@ export default class Element extends Node {
if (type !== 'checkbox' && type !== 'radio') { if (type !== 'checkbox' && type !== 'radio') {
component.error(binding, { component.error(binding, {
code: `invalid-binding`, code: 'invalid-binding',
message: `'group' binding can only be used with <input type="checkbox"> or <input type="radio">` message: '\'group\' binding can only be used with <input type="checkbox"> or <input type="radio">'
}); });
} }
} else if (name === 'files') { } else if (name === 'files') {
if (this.name !== 'input') { if (this.name !== 'input') {
component.error(binding, { component.error(binding, {
code: `invalid-binding`, code: 'invalid-binding',
message: `'files' is not a valid binding on <${this.name}> elements` message: `'files' is not a valid binding on <${this.name}> elements`
}); });
} }
@ -667,15 +667,15 @@ export default class Element extends Node {
if (type !== 'file') { if (type !== 'file') {
component.error(binding, { component.error(binding, {
code: `invalid-binding`, code: 'invalid-binding',
message: `'files' binding can only be used with <input type="file">` message: '\'files\' binding can only be used with <input type="file">'
}); });
} }
} else if (name === 'open') { } else if (name === 'open') {
if (this.name !== 'details') { if (this.name !== 'details') {
component.error(binding, { component.error(binding, {
code: `invalid-binding`, code: 'invalid-binding',
message: `'${name}' binding can only be used with <details>` message: `'${name}' binding can only be used with <details>`
}); });
} }
@ -694,7 +694,7 @@ export default class Element extends Node {
) { ) {
if (this.name !== 'audio' && this.name !== 'video') { if (this.name !== 'audio' && this.name !== 'video') {
component.error(binding, { component.error(binding, {
code: `invalid-binding`, code: 'invalid-binding',
message: `'${name}' binding can only be used with <audio> or <video>` message: `'${name}' binding can only be used with <audio> or <video>`
}); });
} }
@ -704,7 +704,7 @@ export default class Element extends Node {
) { ) {
if (this.name !== 'video') { if (this.name !== 'video') {
component.error(binding, { component.error(binding, {
code: `invalid-binding`, code: 'invalid-binding',
message: `'${name}' binding can only be used with <video>` message: `'${name}' binding can only be used with <video>`
}); });
} }
@ -735,18 +735,18 @@ export default class Element extends Node {
if (!contenteditable) { if (!contenteditable) {
component.error(binding, { component.error(binding, {
code: `missing-contenteditable-attribute`, code: 'missing-contenteditable-attribute',
message: `'contenteditable' attribute is required for textContent and innerHTML two-way bindings` message: '\'contenteditable\' attribute is required for textContent and innerHTML two-way bindings'
}); });
} else if (contenteditable && !contenteditable.is_static) { } else if (contenteditable && !contenteditable.is_static) {
component.error(contenteditable, { component.error(contenteditable, {
code: `dynamic-contenteditable-attribute`, code: 'dynamic-contenteditable-attribute',
message: `'contenteditable' attribute cannot be dynamic if element uses two-way binding` message: '\'contenteditable\' attribute cannot be dynamic if element uses two-way binding'
}); });
} }
} else if (name !== 'this') { } else if (name !== 'this') {
component.error(binding, { component.error(binding, {
code: `invalid-binding`, code: 'invalid-binding',
message: `'${binding.name}' is not a valid binding` message: `'${binding.name}' is not a valid binding`
}); });
} }
@ -762,7 +762,7 @@ export default class Element extends Node {
if (this.children.length === 0) { if (this.children.length === 0) {
this.component.warn(this, { this.component.warn(this, {
code: `a11y-missing-content`, code: 'a11y-missing-content',
message: `A11y: <${this.name}> element should have child content` message: `A11y: <${this.name}> element should have child content`
}); });
} }
@ -775,14 +775,14 @@ export default class Element extends Node {
if (handler.modifiers.has('passive') && handler.modifiers.has('preventDefault')) { if (handler.modifiers.has('passive') && handler.modifiers.has('preventDefault')) {
component.error(handler, { component.error(handler, {
code: 'invalid-event-modifier', code: 'invalid-event-modifier',
message: `The 'passive' and 'preventDefault' modifiers cannot be used together` message: 'The \'passive\' and \'preventDefault\' modifiers cannot be used together'
}); });
} }
if (handler.modifiers.has('passive') && handler.modifiers.has('nonpassive')) { if (handler.modifiers.has('passive') && handler.modifiers.has('nonpassive')) {
component.error(handler, { component.error(handler, {
code: 'invalid-event-modifier', code: 'invalid-event-modifier',
message: `The 'passive' and 'nonpassive' modifiers cannot be used together` message: 'The \'passive\' and \'nonpassive\' modifiers cannot be used together'
}); });
} }
@ -799,13 +799,13 @@ export default class Element extends Node {
if (handler.can_make_passive) { if (handler.can_make_passive) {
component.warn(handler, { component.warn(handler, {
code: 'redundant-event-modifier', code: 'redundant-event-modifier',
message: `Touch event handlers that don't use the 'event' object are passive by default` message: 'Touch event handlers that don\'t use the \'event\' object are passive by default'
}); });
} }
} else { } else {
component.warn(handler, { component.warn(handler, {
code: 'redundant-event-modifier', code: 'redundant-event-modifier',
message: `The passive modifier only works with wheel and touch events` message: 'The passive modifier only works with wheel and touch events'
}); });
} }
} }
@ -876,7 +876,7 @@ function should_have_attribute(
attributes[0]; attributes[0];
node.component.warn(node, { node.component.warn(node, {
code: `a11y-missing-attribute`, code: 'a11y-missing-attribute',
message: `A11y: <${name}> element should have ${article} ${sequence} attribute` message: `A11y: <${name}> element should have ${article} ${sequence} attribute`
}); });
} }

@ -12,8 +12,8 @@ export default class Head extends Node {
if (info.attributes.length) { if (info.attributes.length) {
component.error(info.attributes[0], { component.error(info.attributes[0], {
code: `invalid-attribute`, code: 'invalid-attribute',
message: `<svelte:head> should not have any attributes or directives` message: '<svelte:head> should not have any attributes or directives'
}); });
} }

@ -40,15 +40,15 @@ export default class InlineComponent extends Node {
switch (node.type) { switch (node.type) {
case 'Action': case 'Action':
component.error(node, { component.error(node, {
code: `invalid-action`, code: 'invalid-action',
message: `Actions can only be applied to DOM elements, not components` message: 'Actions can only be applied to DOM elements, not components'
}); });
case 'Attribute': case 'Attribute':
if (node.name === 'slot') { if (node.name === 'slot') {
component.error(node, { component.error(node, {
code: `invalid-prop`, code: 'invalid-prop',
message: `'slot' is reserved for future use in named slots` message: "'slot' is reserved for future use in named slots"
}); });
} }
// fallthrough // fallthrough
@ -62,8 +62,8 @@ export default class InlineComponent extends Node {
case 'Class': case 'Class':
component.error(node, { component.error(node, {
code: `invalid-class`, code: 'invalid-class',
message: `Classes can only be applied to DOM elements, not components` message: 'Classes can only be applied to DOM elements, not components'
}); });
case 'EventHandler': case 'EventHandler':
@ -76,8 +76,8 @@ export default class InlineComponent extends Node {
case 'Transition': case 'Transition':
component.error(node, { component.error(node, {
code: `invalid-transition`, code: 'invalid-transition',
message: `Transitions can only be applied to DOM elements, not components` message: 'Transitions can only be applied to DOM elements, not components'
}); });
default: default:
@ -105,7 +105,7 @@ export default class InlineComponent extends Node {
if (modifier !== 'once') { if (modifier !== 'once') {
component.error(handler, { component.error(handler, {
code: 'invalid-event-modifier', code: 'invalid-event-modifier',
message: `Event modifiers other than 'once' can only be used on DOM elements` message: "Event modifiers other than 'once' can only be used on DOM elements"
}); });
} }
}); });

@ -1,9 +1,9 @@
import Expression from "./shared/Expression"; import Expression from './shared/Expression';
import map_children from "./shared/map_children"; import map_children from './shared/map_children';
import AbstractBlock from "./shared/AbstractBlock"; import AbstractBlock from './shared/AbstractBlock';
export default class KeyBlock extends AbstractBlock { export default class KeyBlock extends AbstractBlock {
type: "KeyBlock"; type: 'KeyBlock';
expression: Expression; expression: Expression;

@ -26,7 +26,7 @@ export default class Let extends Node {
if (!applicable.has(node.type)) { if (!applicable.has(node.type)) {
component.error(node as any, { component.error(node as any, {
code: 'invalid-let', code: 'invalid-let',
message: `let directive value must be an identifier or an object/array pattern` message: 'let directive value must be an identifier or an object/array pattern'
}); });
} }

@ -17,24 +17,24 @@ export default class Slot extends Element {
info.attributes.forEach(attr => { info.attributes.forEach(attr => {
if (attr.type !== 'Attribute') { if (attr.type !== 'Attribute') {
component.error(attr, { component.error(attr, {
code: `invalid-slot-directive`, code: 'invalid-slot-directive',
message: `<slot> cannot have directives` message: '<slot> cannot have directives'
}); });
} }
if (attr.name === 'name') { if (attr.name === 'name') {
if (attr.value.length !== 1 || attr.value[0].type !== 'Text') { if (attr.value.length !== 1 || attr.value[0].type !== 'Text') {
component.error(attr, { component.error(attr, {
code: `dynamic-slot-name`, code: 'dynamic-slot-name',
message: `<slot> name cannot be dynamic` message: '<slot> name cannot be dynamic'
}); });
} }
this.slot_name = attr.value[0].data; this.slot_name = attr.value[0].data;
if (this.slot_name === 'default') { if (this.slot_name === 'default') {
component.error(attr, { component.error(attr, {
code: `invalid-slot-name`, code: 'invalid-slot-name',
message: `default is a reserved word — it cannot be used as a slot name` message: 'default is a reserved word — it cannot be used as a slot name'
}); });
} }
} }

@ -37,7 +37,7 @@ export default class Text extends Node {
// svg namespace exclusions // svg namespace exclusions
if (/svg$/.test(parent_element.namespace)) { if (/svg$/.test(parent_element.namespace)) {
if (this.prev && this.prev.type === "Element" && this.prev.name === "tspan") return false; if (this.prev && this.prev.type === 'Element' && this.prev.name === 'tspan') return false;
} }
return parent_element.namespace || elements_without_text.has(parent_element.name); return parent_element.namespace || elements_without_text.has(parent_element.name);

@ -13,8 +13,8 @@ export default class Title extends Node {
if (info.attributes.length > 0) { if (info.attributes.length > 0) {
component.error(info.attributes[0], { component.error(info.attributes[0], {
code: `illegal-attribute`, code: 'illegal-attribute',
message: `<title> cannot have attributes` message: '<title> cannot have attributes'
}); });
} }
@ -22,7 +22,7 @@ export default class Title extends Node {
if (child.type !== 'Text' && child.type !== 'MustacheTag') { if (child.type !== 'Text' && child.type !== 'MustacheTag') {
component.error(child, { component.error(child, {
code: 'illegal-structure', code: 'illegal-structure',
message: `<title> can only contain text and {tags}` message: '<title> can only contain text and {tags}'
}); });
} }
}); });

@ -28,7 +28,7 @@ export default class Transition extends Node {
: `An element cannot have both ${describe(parent_transition)} directive and ${describe(this)} directive`; : `An element cannot have both ${describe(parent_transition)} directive and ${describe(this)} directive`;
component.error(info, { component.error(info, {
code: `duplicate-transition`, code: 'duplicate-transition',
message message
}); });
} }
@ -41,6 +41,6 @@ export default class Transition extends Node {
function describe(transition: Transition) { function describe(transition: Transition) {
return transition.directive === 'transition' return transition.directive === 'transition'
? `a 'transition'` ? "a 'transition'"
: `an '${transition.directive}'`; : `an '${transition.directive}'`;
} }

@ -36,7 +36,7 @@ export default class Window extends Node {
// TODO is this constraint necessary? // TODO is this constraint necessary?
component.error(node.expression, { component.error(node.expression, {
code: `invalid-binding`, code: 'invalid-binding',
message: `Bindings on <svelte:window> must be to top-level properties, e.g. '${parts[parts.length - 1]}' rather than '${parts.join('.')}'` message: `Bindings on <svelte:window> must be to top-level properties, e.g. '${parts[parts.length - 1]}' rather than '${parts.join('.')}'`
}); });
} }
@ -52,12 +52,12 @@ export default class Window extends Node {
if (match) { if (match) {
component.error(node, { component.error(node, {
code: `invalid-binding`, code: 'invalid-binding',
message: `${message} (did you mean '${match}'?)` message: `${message} (did you mean '${match}'?)`
}); });
} else { } else {
component.error(node, { component.error(node, {
code: `invalid-binding`, code: 'invalid-binding',
message: `${message} — valid bindings are ${list(valid_bindings)}` message: `${message} — valid bindings are ${list(valid_bindings)}`
}); });
} }

@ -85,8 +85,8 @@ export default class Expression {
const store_name = name.slice(1); const store_name = name.slice(1);
if (template_scope.names.has(store_name) || scope.has(store_name)) { if (template_scope.names.has(store_name) || scope.has(store_name)) {
component.error(node, { component.error(node, {
code: `contextual-store`, code: 'contextual-store',
message: `Stores must be declared at the top level of the component (this may change in a future version of Svelte)` message: 'Stores must be declared at the top level of the component (this may change in a future version of Svelte)'
}); });
} }
} }

@ -235,7 +235,7 @@ export default class Renderer {
if (!member) return; if (!member) return;
if (member.index.value === -1) { if (member.index.value === -1) {
throw new Error(`unset index`); throw new Error('unset index');
} }
const value = member.index.value as number; const value = member.index.value as number;

@ -81,7 +81,7 @@ export default function dom(
const uses_props = component.var_lookup.has('$$props'); const uses_props = component.var_lookup.has('$$props');
const uses_rest = component.var_lookup.has('$$restProps'); const uses_rest = component.var_lookup.has('$$restProps');
const $$props = uses_props || uses_rest ? `$$new_props` : `$$props`; const $$props = uses_props || uses_rest ? '$$new_props' : '$$props';
const props = component.vars.filter(variable => !variable.module && variable.export_name); const props = component.vars.filter(variable => !variable.module && variable.export_name);
const writable_props = props.filter(variable => variable.writable); const writable_props = props.filter(variable => variable.writable);
@ -524,7 +524,7 @@ export default function dom(
const declaration = b` const declaration = b`
class ${name} extends ${superclass} { class ${name} extends ${superclass} {
constructor(options) { constructor(options) {
super(${options.dev && `options`}); super(${options.dev && 'options'});
${should_add_css && b`if (!@_document.getElementById("${component.stylesheet.id}-style")) ${add_css}();`} ${should_add_css && b`if (!@_document.getElementById("${component.stylesheet.id}-style")) ${add_css}();`}
@init(this, options, ${definition}, ${has_create_fragment ? 'create_fragment': 'null'}, ${not_equal}, ${prop_indexes}, ${dirty}); @init(this, options, ${definition}, ${has_create_fragment ? 'create_fragment': 'null'}, ${not_equal}, ${prop_indexes}, ${dirty});
${options.dev && b`@dispatch_dev("SvelteRegisterComponent", { component: this, tagName: "${name.name}", options, id: create_fragment.name });`} ${options.dev && b`@dispatch_dev("SvelteRegisterComponent", { component: this, tagName: "${name.name}", options, id: create_fragment.name });`}

@ -177,8 +177,8 @@ export default class AwaitBlockWrapper extends Wrapper {
const snippet = this.node.expression.manipulate(block); const snippet = this.node.expression.manipulate(block);
const info = block.get_unique_name(`info`); const info = block.get_unique_name('info');
const promise = block.get_unique_name(`promise`); const promise = block.get_unique_name('promise');
block.add_variable(promise); block.add_variable(promise);

@ -29,7 +29,7 @@ export class ElseBlockWrapper extends Wrapper {
this.block = block.child({ this.block = block.child({
comment: create_debugging_comment(node, this.renderer.component), comment: create_debugging_comment(node, this.renderer.component),
name: this.renderer.component.get_unique_name(`create_else_block`), name: this.renderer.component.get_unique_name('create_else_block'),
type: 'else' type: 'else'
}); });
@ -441,11 +441,11 @@ export default class EachBlockWrapper extends Wrapper {
const destroy = this.node.has_animation const destroy = this.node.has_animation
? (this.block.has_outros ? (this.block.has_outros
? `@fix_and_outro_and_destroy_block` ? '@fix_and_outro_and_destroy_block'
: `@fix_and_destroy_block`) : '@fix_and_destroy_block')
: this.block.has_outros : this.block.has_outros
? `@outro_and_destroy_block` ? '@outro_and_destroy_block'
: `@destroy_block`; : '@destroy_block';
if (this.dependencies.size) { if (this.dependencies.size) {
this.updates.push(b` this.updates.push(b`
@ -563,7 +563,7 @@ export default class EachBlockWrapper extends Wrapper {
} }
`; `;
const start = this.block.has_update_method ? 0 : `#old_length`; const start = this.block.has_update_method ? 0 : '#old_length';
let remove_old_blocks; let remove_old_blocks;

@ -187,7 +187,7 @@ export default class AttributeWrapper extends BaseAttributeWrapper {
if (this.is_input_value) { if (this.is_input_value) {
const type = element.node.get_static_attribute_value('type'); const type = element.node.get_static_attribute_value('type');
if (type === null || type === "" || type === "text" || type === "email" || type === "password") { if (type === null || type === '' || type === 'text' || type === 'email' || type === 'password') {
condition = x`${condition} && ${element.var}.${property_name} !== ${should_cache ? last : value}`; condition = x`${condition} && ${element.var}.${property_name} !== ${should_cache ? last : value}`;
} }
} }
@ -277,7 +277,7 @@ export default class AttributeWrapper extends BaseAttributeWrapper {
if (this.node.is_true) return ''; if (this.node.is_true) return '';
const value = this.node.chunks; const value = this.node.chunks;
if (value.length === 0) return `=""`; if (value.length === 0) return '=""';
return `="${value.map(chunk => { return `="${value.map(chunk => {
return chunk.type === 'Text' return chunk.type === 'Text'

@ -88,20 +88,20 @@ export default class BindingWrapper {
update_conditions.push(block.renderer.dirty(dependency_array)); update_conditions.push(block.renderer.dirty(dependency_array));
} }
if (parent.node.name === "input") { if (parent.node.name === 'input') {
const type = parent.node.get_static_attribute_value("type"); const type = parent.node.get_static_attribute_value('type');
if ( if (
type === null || type === null ||
type === "" || type === '' ||
type === "text" || type === 'text' ||
type === "email" || type === 'email' ||
type === "password" type === 'password'
) { ) {
update_conditions.push( update_conditions.push(
x`${parent.var}.${this.node.name} !== ${this.snippet}` x`${parent.var}.${this.node.name} !== ${this.snippet}`
); );
} else if (type === "number") { } else if (type === 'number') {
update_conditions.push( update_conditions.push(
x`@to_number(${parent.var}.${this.node.name}) !== ${this.snippet}` x`@to_number(${parent.var}.${this.node.name}) !== ${this.snippet}`
); );
@ -118,7 +118,7 @@ export default class BindingWrapper {
{ {
const { binding_group, is_context, contexts, index } = get_binding_group(parent.renderer, this.node, block); const { binding_group, is_context, contexts, index } = get_binding_group(parent.renderer, this.node, block);
block.renderer.add_to_context(`$$binding_groups`); block.renderer.add_to_context('$$binding_groups');
if (is_context) { if (is_context) {
if (contexts.length > 1) { if (contexts.length > 1) {

@ -1,3 +1,3 @@
import { BaseAttributeWrapper } from "./Attribute"; import { BaseAttributeWrapper } from './Attribute';
export default class SpreadAttributeWrapper extends BaseAttributeWrapper {} export default class SpreadAttributeWrapper extends BaseAttributeWrapper {}

@ -1,13 +1,13 @@
import AttributeWrapper from "./Attribute"; import AttributeWrapper from './Attribute';
import BindingWrapper from "./Binding"; import BindingWrapper from './Binding';
import ElementWrapper from "./index"; import ElementWrapper from './index';
export default function handle_select_value_binding( export default function handle_select_value_binding(
attr: AttributeWrapper | BindingWrapper, attr: AttributeWrapper | BindingWrapper,
dependencies: Set<string> dependencies: Set<string>
) { ) {
const { parent } = attr; const { parent } = attr;
if (parent.node.name === "select") { if (parent.node.name === 'select') {
(parent as ElementWrapper).select_binding_dependencies = dependencies; (parent as ElementWrapper).select_binding_dependencies = dependencies;
dependencies.forEach((prop: string) => { dependencies.forEach((prop: string) => {
parent.renderer.component.indirect_dependencies.set(prop, new Set()); parent.renderer.component.indirect_dependencies.set(prop, new Set());

@ -685,7 +685,7 @@ export default class ElementWrapper extends Wrapper {
`); `);
} else if (this.node.name === 'input' && this.attributes.find(attr => attr.node.name === 'value')) { } else if (this.node.name === 'input' && this.attributes.find(attr => attr.node.name === 'value')) {
const type = this.node.get_static_attribute_value('type'); const type = this.node.get_static_attribute_value('type');
if (type === null || type === "" || type === "text" || type === "email" || type === "password") { if (type === null || type === '' || type === 'text' || type === 'email' || type === 'password') {
block.chunks.mount.push(b` block.chunks.mount.push(b`
${this.var}.value = ${data}.value; ${this.var}.value = ${data}.value;
`); `);
@ -956,7 +956,7 @@ function to_html(wrappers: Array<ElementWrapper | TextWrapper | MustacheTagWrapp
} }
}); });
state.quasi.value.raw += `"`; state.quasi.value.raw += '"';
}); });
if (!wrapper.void) { if (!wrapper.void) {

@ -69,7 +69,7 @@ export default class FragmentWrapper {
const child = nodes[i]; const child = nodes[i];
if (!child.type) { if (!child.type) {
throw new Error(`missing type`); throw new Error('missing type');
} }
if (!(child.type in wrappers)) { if (!(child.type in wrappers)) {

@ -55,7 +55,7 @@ class IfBlockBranch extends Wrapper {
}); });
if (should_cache) { if (should_cache) {
this.condition = block.get_unique_name(`show_if`); this.condition = block.get_unique_name('show_if');
this.snippet = (expression.manipulate(block) as Node); this.snippet = (expression.manipulate(block) as Node);
} else { } else {
this.condition = expression.manipulate(block); this.condition = expression.manipulate(block);
@ -65,7 +65,7 @@ class IfBlockBranch extends Wrapper {
this.block = block.child({ this.block = block.child({
comment: create_debugging_comment(node, parent.renderer.component), comment: create_debugging_comment(node, parent.renderer.component),
name: parent.renderer.component.get_unique_name( name: parent.renderer.component.get_unique_name(
is_else ? `create_else_block` : `create_if_block` is_else ? 'create_else_block' : 'create_if_block'
), ),
type: (node as IfBlock).expression ? 'if' : 'else' type: (node as IfBlock).expression ? 'if' : 'else'
}); });
@ -257,8 +257,8 @@ export default class IfBlockWrapper extends Wrapper {
{ name, anchor, has_else, if_exists_condition, has_transitions }, { name, anchor, has_else, if_exists_condition, has_transitions },
detaching detaching
) { ) {
const select_block_type = this.renderer.component.get_unique_name(`select_block_type`); const select_block_type = this.renderer.component.get_unique_name('select_block_type');
const current_block_type = block.get_unique_name(`current_block_type`); const current_block_type = block.get_unique_name('current_block_type');
const get_block = has_else const get_block = has_else
? x`${current_block_type}(#ctx)` ? x`${current_block_type}(#ctx)`
: x`${current_block_type} && ${current_block_type}(#ctx)`; : x`${current_block_type} && ${current_block_type}(#ctx)`;
@ -364,11 +364,11 @@ export default class IfBlockWrapper extends Wrapper {
{ name, anchor, has_else, has_transitions, if_exists_condition }, { name, anchor, has_else, has_transitions, if_exists_condition },
detaching detaching
) { ) {
const select_block_type = this.renderer.component.get_unique_name(`select_block_type`); const select_block_type = this.renderer.component.get_unique_name('select_block_type');
const current_block_type_index = block.get_unique_name(`current_block_type_index`); const current_block_type_index = block.get_unique_name('current_block_type_index');
const previous_block_index = block.get_unique_name(`previous_block_index`); const previous_block_index = block.get_unique_name('previous_block_index');
const if_block_creators = block.get_unique_name(`if_block_creators`); const if_block_creators = block.get_unique_name('if_block_creators');
const if_blocks = block.get_unique_name(`if_blocks`); const if_blocks = block.get_unique_name('if_blocks');
const if_current_block_type_index = has_else const if_current_block_type_index = has_else
? nodes => nodes ? nodes => nodes

@ -78,7 +78,7 @@ export default class InlineComponentWrapper extends Wrapper {
const default_slot = block.child({ const default_slot = block.child({
comment: create_debugging_comment(node, renderer.component), comment: create_debugging_comment(node, renderer.component),
name: renderer.component.get_unique_name(`create_default_slot`), name: renderer.component.get_unique_name('create_default_slot'),
type: 'slot' type: 'slot'
}); });

@ -1,19 +1,19 @@
import Wrapper from "./shared/Wrapper"; import Wrapper from './shared/Wrapper';
import Renderer from "../Renderer"; import Renderer from '../Renderer';
import Block from "../Block"; import Block from '../Block';
import EachBlock from "../../nodes/EachBlock"; import EachBlock from '../../nodes/EachBlock';
import KeyBlock from "../../nodes/KeyBlock"; import KeyBlock from '../../nodes/KeyBlock';
import create_debugging_comment from "./shared/create_debugging_comment"; import create_debugging_comment from './shared/create_debugging_comment';
import FragmentWrapper from "./Fragment"; import FragmentWrapper from './Fragment';
import { b, x } from "code-red"; import { b, x } from 'code-red';
import { Identifier } from "estree"; import { Identifier } from 'estree';
export default class KeyBlockWrapper extends Wrapper { export default class KeyBlockWrapper extends Wrapper {
node: KeyBlock; node: KeyBlock;
fragment: FragmentWrapper; fragment: FragmentWrapper;
block: Block; block: Block;
dependencies: string[]; dependencies: string[];
var: Identifier = { type: "Identifier", name: "key_block" }; var: Identifier = { type: 'Identifier', name: 'key_block' };
constructor( constructor(
renderer: Renderer, renderer: Renderer,
@ -33,8 +33,8 @@ export default class KeyBlockWrapper extends Wrapper {
if (this.dependencies.length) { if (this.dependencies.length) {
block = block.child({ block = block.child({
comment: create_debugging_comment(node, renderer.component), comment: create_debugging_comment(node, renderer.component),
name: renderer.component.get_unique_name("create_key_block"), name: renderer.component.get_unique_name('create_key_block'),
type: "key" type: 'key'
}); });
renderer.blocks.push(block); renderer.blocks.push(block);
} }
@ -89,8 +89,8 @@ export default class KeyBlockWrapper extends Wrapper {
block.chunks.claim.push(b`${this.var}.l(${parent_nodes});`); block.chunks.claim.push(b`${this.var}.l(${parent_nodes});`);
} }
block.chunks.mount.push( block.chunks.mount.push(
b`${this.var}.m(${parent_node || "#target"}, ${ b`${this.var}.m(${parent_node || '#target'}, ${
parent_node ? "null" : "#anchor" parent_node ? 'null' : '#anchor'
});` });`
); );
const anchor = this.get_or_create_anchor(block, parent_node, parent_nodes); const anchor = this.get_or_create_anchor(block, parent_node, parent_nodes);

@ -38,7 +38,7 @@ export default class SlotWrapper extends Wrapper {
if (this.node.children.length) { if (this.node.children.length) {
this.fallback = block.child({ this.fallback = block.child({
comment: create_debugging_comment(this.node.children[0], this.renderer.component), comment: create_debugging_comment(this.node.children[0], this.renderer.component),
name: this.renderer.component.get_unique_name(`fallback_block`), name: this.renderer.component.get_unique_name('fallback_block'),
type: 'fallback' type: 'fallback'
}); });
renderer.blocks.push(this.fallback); renderer.blocks.push(this.fallback);

@ -59,7 +59,7 @@ export default class TitleWrapper extends Wrapper {
} }
const last = this.node.should_cache && block.get_unique_name( const last = this.node.should_cache && block.get_unique_name(
`title_value` 'title_value'
); );
if (this.node.should_cache) block.add_variable(last); if (this.node.should_cache) block.add_variable(last);

@ -72,9 +72,9 @@ export default class WindowWrapper extends Wrapper {
}); });
}); });
const scrolling = block.get_unique_name(`scrolling`); const scrolling = block.get_unique_name('scrolling');
const clear_scrolling = block.get_unique_name(`clear_scrolling`); const clear_scrolling = block.get_unique_name('clear_scrolling');
const scrolling_timeout = block.get_unique_name(`scrolling_timeout`); const scrolling_timeout = block.get_unique_name('scrolling_timeout');
Object.keys(events).forEach(event => { Object.keys(events).forEach(event => {
const id = block.get_unique_name(`onwindow${event}`); const id = block.get_unique_name(`onwindow${event}`);
@ -156,7 +156,7 @@ export default class WindowWrapper extends Wrapper {
// another special case. (I'm starting to think these are all special cases.) // another special case. (I'm starting to think these are all special cases.)
if (bindings.online) { if (bindings.online) {
const id = block.get_unique_name(`onlinestatuschanged`); const id = block.get_unique_name('onlinestatuschanged');
const name = bindings.online; const name = bindings.online;
renderer.add_to_context(id.name); renderer.add_to_context(id.name);

@ -1,7 +1,7 @@
import EachBlock from "../../../nodes/EachBlock"; import EachBlock from '../../../nodes/EachBlock';
import InlineComponentWrapper from "../InlineComponent"; import InlineComponentWrapper from '../InlineComponent';
import ElementWrapper from "../Element"; import ElementWrapper from '../Element';
import Binding from "../../../nodes/Binding"; import Binding from '../../../nodes/Binding';
export default function mark_each_block_bindings( export default function mark_each_block_bindings(
parent: ElementWrapper | InlineComponentWrapper, parent: ElementWrapper | InlineComponentWrapper,
@ -16,7 +16,7 @@ export default function mark_each_block_bindings(
} }
}); });
if (binding.name === "group") { if (binding.name === 'group') {
// for `<input bind:group={} >`, we make sure that all the each blocks creates context with `index` // for `<input bind:group={} >`, we make sure that all the each blocks creates context with `index`
for (const name of binding.expression.contextual_dependencies) { for (const name of binding.expression.contextual_dependencies) {
const each_block = parent.node.scope.get_owner(name); const each_block = parent.node.scope.get_owner(name);

@ -84,20 +84,20 @@ export default function(node: Element, renderer: Renderer, options: RenderOption
attribute.chunks[0].type !== 'Text' attribute.chunks[0].type !== 'Text'
) { ) {
// a boolean attribute with one non-Text chunk // a boolean attribute with one non-Text chunk
renderer.add_string(` `); renderer.add_string(' ');
renderer.add_expression(x`${(attribute.chunks[0] as Expression).node} ? "${attribute.name}" : ""`); renderer.add_expression(x`${(attribute.chunks[0] as Expression).node} ? "${attribute.name}" : ""`);
} else if (name === 'class' && class_expression) { } else if (name === 'class' && class_expression) {
add_class_attribute = false; add_class_attribute = false;
renderer.add_string(` ${attribute.name}="`); renderer.add_string(` ${attribute.name}="`);
renderer.add_expression(x`[${get_class_attribute_value(attribute)}, ${class_expression}].join(' ').trim()`); renderer.add_expression(x`[${get_class_attribute_value(attribute)}, ${class_expression}].join(' ').trim()`);
renderer.add_string(`"`); renderer.add_string('"');
} else if (attribute.chunks.length === 1 && attribute.chunks[0].type !== 'Text') { } else if (attribute.chunks.length === 1 && attribute.chunks[0].type !== 'Text') {
const snippet = (attribute.chunks[0] as Expression).node; const snippet = (attribute.chunks[0] as Expression).node;
renderer.add_expression(x`@add_attribute("${attribute.name}", ${snippet}, ${boolean_attributes.has(name) ? 1 : 0})`); renderer.add_expression(x`@add_attribute("${attribute.name}", ${snippet}, ${boolean_attributes.has(name) ? 1 : 0})`);
} else { } else {
renderer.add_string(` ${attribute.name}="`); renderer.add_string(` ${attribute.name}="`);
renderer.add_expression((name === 'class' ? get_class_attribute_value : get_attribute_value)(attribute)); renderer.add_expression((name === 'class' ? get_class_attribute_value : get_attribute_value)(attribute));
renderer.add_string(`"`); renderer.add_string('"');
} }
}); });
if (add_class_attribute) { if (add_class_attribute) {

@ -104,6 +104,6 @@ function is_empty_template_literal(template_literal) {
return ( return (
template_literal.expressions.length === 0 && template_literal.expressions.length === 0 &&
template_literal.quasis.length === 1 && template_literal.quasis.length === 1 &&
template_literal.quasis[0].value.raw === "" template_literal.quasis[0].value.raw === ''
); );
} }

@ -5,11 +5,11 @@ import { x } from 'code-red';
export default function(node: Title, renderer: Renderer, options: RenderOptions) { export default function(node: Title, renderer: Renderer, options: RenderOptions) {
renderer.push(); renderer.push();
renderer.add_string(`<title>`); renderer.add_string('<title>');
renderer.render(node.children, options); renderer.render(node.children, options);
renderer.add_string(`</title>`); renderer.add_string('</title>');
const result = renderer.pop(); const result = renderer.pop();
renderer.add_expression(x`$$result.title = ${result}, ""`); renderer.add_expression(x`$$result.title = ${result}, ""`);

@ -1,13 +1,13 @@
import { Node, Literal, Identifier, MemberExpression } from "estree"; import { Node, Literal, Identifier, MemberExpression } from 'estree';
export function compare_node(a: Node | void, b: Node | void) { export function compare_node(a: Node | void, b: Node | void) {
if (a === b) return true; if (a === b) return true;
if (!a || !b) return false; if (!a || !b) return false;
if (a.type !== b.type) return false; if (a.type !== b.type) return false;
switch (a.type) { switch (a.type) {
case "Identifier": case 'Identifier':
return a.name === (b as Identifier).name; return a.name === (b as Identifier).name;
case "MemberExpression": case 'MemberExpression':
return ( return (
compare_node(a.object, (b as MemberExpression).object) && compare_node(a.object, (b as MemberExpression).object) &&
compare_node(a.property, (b as MemberExpression).property) && compare_node(a.property, (b as MemberExpression).property) &&

@ -13,7 +13,7 @@ export default function get_name_from_filename(filename: string) {
const base = parts.pop() const base = parts.pop()
.replace(/%/g, 'u') .replace(/%/g, 'u')
.replace(/\.[^.]+$/, "") .replace(/\.[^.]+$/, '')
.replace(/[^a-zA-Z_$0-9]+/g, '_') .replace(/[^a-zA-Z_$0-9]+/g, '_')
.replace(/^_/, '') .replace(/^_/, '')
.replace(/_$/, '') .replace(/_$/, '')

@ -1,6 +1,6 @@
// https://github.com/darkskyapp/string-hash/blob/master/index.js // https://github.com/darkskyapp/string-hash/blob/master/index.js
export default function hash(str: string): string { export default function hash(str: string): string {
str = str.replace(/\r/g, ""); str = str.replace(/\r/g, '');
let hash = 5381; let hash = 5381;
let i = str.length; let i = str.length;

@ -1,4 +1,4 @@
export const reserved_keywords = new Set(["$$props", "$$restProps", "$$slots"]); export const reserved_keywords = new Set(['$$props', '$$restProps', '$$slots']);
export function is_reserved_keyword(name) { export function is_reserved_keyword(name) {
return reserved_keywords.has(name); return reserved_keywords.has(name);

@ -1,16 +1,16 @@
import { MemberExpression, Identifier } from "estree"; import { MemberExpression, Identifier } from 'estree';
export function string_to_member_expression(name: string) { export function string_to_member_expression(name: string) {
const parts = name.split("."); const parts = name.split('.');
let node: MemberExpression | Identifier = { let node: MemberExpression | Identifier = {
type: "Identifier", type: 'Identifier',
name: parts[0] name: parts[0]
}; };
for (let i = 1; i < parts.length; i++) { for (let i = 1; i < parts.length; i++) {
node = { node = {
type: "MemberExpression", type: 'MemberExpression',
object: node, object: node,
property: { type: "Identifier", name: parts[i] } property: { type: 'Identifier', name: parts[i] }
} as MemberExpression; } as MemberExpression;
} }
return node; return node;

@ -1,4 +1,4 @@
import { Node, Program } from "estree"; import { Node, Program } from 'estree';
import { SourceMap } from 'magic-string'; import { SourceMap } from 'magic-string';
interface BaseNode { interface BaseNode {

@ -66,7 +66,7 @@ export class Parser {
if (state !== fragment) { if (state !== fragment) {
this.error({ this.error({
code: `unexpected-eof`, code: 'unexpected-eof',
message: 'Unexpected end of input' message: 'Unexpected end of input'
}); });
} }
@ -91,7 +91,7 @@ export class Parser {
acorn_error(err: any) { acorn_error(err: any) {
this.error({ this.error({
code: `parse-error`, code: 'parse-error',
message: err.message.replace(/ \(\d+:\d+\)$/, '') message: err.message.replace(/ \(\d+:\d+\)$/, '')
}, err.pos); }, err.pos);
} }
@ -169,7 +169,7 @@ export class Parser {
if (!allow_reserved && reserved.has(identifier)) { if (!allow_reserved && reserved.has(identifier)) {
this.error({ this.error({
code: `unexpected-reserved-word`, code: 'unexpected-reserved-word',
message: `'${identifier}' is a reserved word in JavaScript and cannot be used here` message: `'${identifier}' is a reserved word in JavaScript and cannot be used here`
}, start); }, start);
} }
@ -180,7 +180,7 @@ export class Parser {
read_until(pattern: RegExp) { read_until(pattern: RegExp) {
if (this.index >= this.template.length) if (this.index >= this.template.length)
this.error({ this.error({
code: `unexpected-eof`, code: 'unexpected-eof',
message: 'Unexpected end of input' message: 'Unexpected end of input'
}); });
@ -199,8 +199,8 @@ export class Parser {
require_whitespace() { require_whitespace() {
if (!whitespace.test(this.template[this.index])) { if (!whitespace.test(this.template[this.index])) {
this.error({ this.error({
code: `missing-whitespace`, code: 'missing-whitespace',
message: `Expected whitespace` message: 'Expected whitespace'
}); });
} }
@ -228,15 +228,15 @@ export default function parse(
if (instance_scripts.length > 1) { if (instance_scripts.length > 1) {
parser.error({ parser.error({
code: `invalid-script`, code: 'invalid-script',
message: `A component can only have one instance-level <script> element` message: 'A component can only have one instance-level <script> element'
}, instance_scripts[1].start); }, instance_scripts[1].start);
} }
if (module_scripts.length > 1) { if (module_scripts.length > 1) {
parser.error({ parser.error({
code: `invalid-script`, code: 'invalid-script',
message: `A component can only have one <script context="module"> element` message: 'A component can only have one <script context="module"> element'
}, module_scripts[1].start); }, module_scripts[1].start);
} }

@ -1,14 +1,14 @@
import { Parser } from "../index"; import { Parser } from '../index';
import { isIdentifierStart } from "acorn"; import { isIdentifierStart } from 'acorn';
import full_char_code_at from "../../utils/full_char_code_at"; import full_char_code_at from '../../utils/full_char_code_at';
import { import {
is_bracket_open, is_bracket_open,
is_bracket_close, is_bracket_close,
is_bracket_pair, is_bracket_pair,
get_bracket_close get_bracket_close
} from "../utils/bracket"; } from '../utils/bracket';
import { parse_expression_at } from "../acorn"; import { parse_expression_at } from '../acorn';
import { Pattern } from "estree"; import { Pattern } from 'estree';
export default function read_context( export default function read_context(
parser: Parser parser: Parser
@ -19,7 +19,7 @@ export default function read_context(
const code = full_char_code_at(parser.template, i); const code = full_char_code_at(parser.template, i);
if (isIdentifierStart(code, true)) { if (isIdentifierStart(code, true)) {
return { return {
type: "Identifier", type: 'Identifier',
name: parser.read_identifier(), name: parser.read_identifier(),
start, start,
end: parser.index end: parser.index
@ -28,8 +28,8 @@ export default function read_context(
if (!is_bracket_open(code)) { if (!is_bracket_open(code)) {
parser.error({ parser.error({
code: "unexpected-token", code: 'unexpected-token',
message: "Expected identifier or destructure pattern" message: 'Expected identifier or destructure pattern'
}); });
} }
@ -43,7 +43,7 @@ export default function read_context(
} else if (is_bracket_close(code)) { } else if (is_bracket_close(code)) {
if (!is_bracket_pair(bracket_stack[bracket_stack.length - 1], code)) { if (!is_bracket_pair(bracket_stack[bracket_stack.length - 1], code)) {
parser.error({ parser.error({
code: "unexpected-token", code: 'unexpected-token',
message: `Expected ${String.fromCharCode( message: `Expected ${String.fromCharCode(
get_bracket_close(bracket_stack[bracket_stack.length - 1]) get_bracket_close(bracket_stack[bracket_stack.length - 1])
)}` )}`

@ -12,7 +12,7 @@ function get_context(parser: Parser, attributes: any[], start: number): string {
if (context.value.length !== 1 || context.value[0].type !== 'Text') { if (context.value.length !== 1 || context.value[0].type !== 'Text') {
parser.error({ parser.error({
code: 'invalid-script', code: 'invalid-script',
message: `context attribute must be static` message: 'context attribute must be static'
}, start); }, start);
} }
@ -20,8 +20,8 @@ function get_context(parser: Parser, attributes: any[], start: number): string {
if (value !== 'module') { if (value !== 'module') {
parser.error({ parser.error({
code: `invalid-script`, code: 'invalid-script',
message: `If the context attribute is supplied, its value must be "module"` message: 'If the context attribute is supplied, its value must be "module"'
}, context.start); }, context.start);
} }
@ -33,8 +33,8 @@ export default function read_script(parser: Parser, start: number, attributes: N
const script_end = parser.template.indexOf(script_closing_tag, script_start); const script_end = parser.template.indexOf(script_closing_tag, script_start);
if (script_end === -1) parser.error({ if (script_end === -1) parser.error({
code: `unclosed-script`, code: 'unclosed-script',
message: `<script> must have a closing tag` message: '<script> must have a closing tag'
}); });
const source = parser.template.slice(0, script_start).replace(/[^\n]/g, ' ') + const source = parser.template.slice(0, script_start).replace(/[^\n]/g, ' ') +

@ -19,7 +19,7 @@ export default function read_style(parser: Parser, start: number, attributes: No
} catch (err) { } catch (err) {
if (err.name === 'CssSyntaxError') { if (err.name === 'CssSyntaxError') {
parser.error({ parser.error({
code: `css-syntax-error`, code: 'css-syntax-error',
message: err.message message: err.message
}, err.offset); }, err.offset);
} else { } else {
@ -40,7 +40,7 @@ export default function read_style(parser: Parser, start: number, attributes: No
if (is_ref_selector(a, b)) { if (is_ref_selector(a, b)) {
parser.error({ parser.error({
code: `invalid-ref-selector`, code: 'invalid-ref-selector',
message: 'ref selectors are no longer supported' message: 'ref selectors are no longer supported'
}, a.loc.start.offset); }, a.loc.start.offset);
} }
@ -49,15 +49,15 @@ export default function read_style(parser: Parser, start: number, attributes: No
if (node.type === 'Declaration' && node.value.type === 'Value' && node.value.children.length === 0) { if (node.type === 'Declaration' && node.value.type === 'Value' && node.value.children.length === 0) {
parser.error({ parser.error({
code: `invalid-declaration`, code: 'invalid-declaration',
message: `Declaration cannot be empty` message: 'Declaration cannot be empty'
}, node.start); }, node.start);
} }
if (node.type === 'PseudoClassSelector' && node.name === 'global' && node.children === null) { if (node.type === 'PseudoClassSelector' && node.name === 'global' && node.children === null) {
parser.error({ parser.error({
code: `css-syntax-error`, code: 'css-syntax-error',
message: `:global() must contain a selector` message: ':global() must contain a selector'
}, node.loc.start.offset); }, node.loc.start.offset);
} }

@ -67,8 +67,8 @@ export default function mustache(parser: Parser) {
expected = 'key'; expected = 'key';
} else { } else {
parser.error({ parser.error({
code: `unexpected-block-close`, code: 'unexpected-block-close',
message: `Unexpected block closing tag` message: 'Unexpected block closing tag'
}); });
} }
@ -100,7 +100,7 @@ export default function mustache(parser: Parser) {
if (parser.eat('if')) { if (parser.eat('if')) {
parser.error({ parser.error({
code: 'invalid-elseif', code: 'invalid-elseif',
message: `'elseif' should be 'else if'` message: "'elseif' should be 'else if'"
}); });
} }
@ -111,10 +111,10 @@ export default function mustache(parser: Parser) {
const block = parser.current(); const block = parser.current();
if (block.type !== 'IfBlock') { if (block.type !== 'IfBlock') {
parser.error({ parser.error({
code: `invalid-elseif-placement`, code: 'invalid-elseif-placement',
message: parser.stack.some(block => block.type === 'IfBlock') message: parser.stack.some(block => block.type === 'IfBlock')
? `Expected to close ${to_string(block)} before seeing {:else if ...} block` ? `Expected to close ${to_string(block)} before seeing {:else if ...} block`
: `Cannot have an {:else if ...} block outside an {#if ...} block` : 'Cannot have an {:else if ...} block outside an {#if ...} block'
}); });
} }
@ -149,10 +149,10 @@ export default function mustache(parser: Parser) {
const block = parser.current(); const block = parser.current();
if (block.type !== 'IfBlock' && block.type !== 'EachBlock') { if (block.type !== 'IfBlock' && block.type !== 'EachBlock') {
parser.error({ parser.error({
code: `invalid-else-placement`, code: 'invalid-else-placement',
message: parser.stack.some(block => block.type === 'IfBlock' || block.type === 'EachBlock') message: parser.stack.some(block => block.type === 'IfBlock' || block.type === 'EachBlock')
? `Expected to close ${to_string(block)} before seeing {:else} block` ? `Expected to close ${to_string(block)} before seeing {:else} block`
: `Cannot have an {:else} block outside an {#if ...} or {#each ...} block` : 'Cannot have an {:else} block outside an {#if ...} or {#each ...} block'
}); });
} }
@ -175,19 +175,19 @@ export default function mustache(parser: Parser) {
if (is_then) { if (is_then) {
if (block.type !== 'PendingBlock') { if (block.type !== 'PendingBlock') {
parser.error({ parser.error({
code: `invalid-then-placement`, code: 'invalid-then-placement',
message: parser.stack.some(block => block.type === 'PendingBlock') message: parser.stack.some(block => block.type === 'PendingBlock')
? `Expected to close ${to_string(block)} before seeing {:then} block` ? `Expected to close ${to_string(block)} before seeing {:then} block`
: `Cannot have an {:then} block outside an {#await ...} block` : 'Cannot have an {:then} block outside an {#await ...} block'
}); });
} }
} else { } else {
if (block.type !== 'ThenBlock' && block.type !== 'PendingBlock') { if (block.type !== 'ThenBlock' && block.type !== 'PendingBlock') {
parser.error({ parser.error({
code: `invalid-catch-placement`, code: 'invalid-catch-placement',
message: parser.stack.some(block => block.type === 'ThenBlock' || block.type === 'PendingBlock') message: parser.stack.some(block => block.type === 'ThenBlock' || block.type === 'PendingBlock')
? `Expected to close ${to_string(block)} before seeing {:catch} block` ? `Expected to close ${to_string(block)} before seeing {:catch} block`
: `Cannot have an {:catch} block outside an {#await ...} block` : 'Cannot have an {:catch} block outside an {#await ...} block'
}); });
} }
} }
@ -227,8 +227,8 @@ export default function mustache(parser: Parser) {
type = 'KeyBlock'; type = 'KeyBlock';
} else { } else {
parser.error({ parser.error({
code: `expected-block-type`, code: 'expected-block-type',
message: `Expected if, each, await or key` message: 'Expected if, each, await or key'
}); });
} }
@ -289,8 +289,8 @@ export default function mustache(parser: Parser) {
parser.allow_whitespace(); parser.allow_whitespace();
block.index = parser.read_identifier(); block.index = parser.read_identifier();
if (!block.index) parser.error({ if (!block.index) parser.error({
code: `expected-name`, code: 'expected-name',
message: `Expected name` message: 'Expected name'
}); });
parser.allow_whitespace(); parser.allow_whitespace();

@ -124,7 +124,7 @@ export default function tag(parser: Parser) {
if (is_closing_tag) { if (is_closing_tag) {
if (is_void(name)) { if (is_void(name)) {
parser.error({ parser.error({
code: `invalid-void-content`, code: 'invalid-void-content',
message: `<${name}> is a void element and cannot have children, or a closing tag` message: `<${name}> is a void element and cannot have children, or a closing tag`
}, start); }, start);
} }
@ -138,7 +138,7 @@ export default function tag(parser: Parser) {
? `</${name}> attempted to close <${name}> that was already automatically closed by <${parser.last_auto_closed_tag.reason}>` ? `</${name}> attempted to close <${name}> that was already automatically closed by <${parser.last_auto_closed_tag.reason}>`
: `</${name}> attempted to close an element that was not open`; : `</${name}> attempted to close an element that was not open`;
parser.error({ parser.error({
code: `invalid-closing-tag`, code: 'invalid-closing-tag',
message message
}, start); }, start);
} }
@ -179,16 +179,16 @@ export default function tag(parser: Parser) {
const index = element.attributes.findIndex(attr => attr.type === 'Attribute' && attr.name === 'this'); const index = element.attributes.findIndex(attr => attr.type === 'Attribute' && attr.name === 'this');
if (!~index) { if (!~index) {
parser.error({ parser.error({
code: `missing-component-definition`, code: 'missing-component-definition',
message: `<svelte:component> must have a 'this' attribute` message: "<svelte:component> must have a 'this' attribute"
}, start); }, start);
} }
const definition = element.attributes.splice(index, 1)[0]; const definition = element.attributes.splice(index, 1)[0];
if (definition.value === true || definition.value.length !== 1 || definition.value[0].type === 'Text') { if (definition.value === true || definition.value.length !== 1 || definition.value[0].type === 'Text') {
parser.error({ parser.error({
code: `invalid-component-definition`, code: 'invalid-component-definition',
message: `invalid component definition` message: 'invalid component definition'
}, definition.start); }, definition.start);
} }
@ -262,8 +262,8 @@ function read_tag_name(parser: Parser) {
if (!legal) { if (!legal) {
parser.error({ parser.error({
code: `invalid-self-placement`, code: 'invalid-self-placement',
message: `<svelte:self> components can only exist inside {#if} blocks, {#each} blocks, or slots passed to components` message: '<svelte:self> components can only exist inside {#if} blocks, {#each} blocks, or slots passed to components'
}, start); }, start);
} }
@ -290,8 +290,8 @@ function read_tag_name(parser: Parser) {
if (!valid_tag_name.test(name)) { if (!valid_tag_name.test(name)) {
parser.error({ parser.error({
code: `invalid-tag-name`, code: 'invalid-tag-name',
message: `Expected valid tag name` message: 'Expected valid tag name'
}, start); }, start);
} }
@ -304,7 +304,7 @@ function read_attribute(parser: Parser, unique_names: Set<string>) {
function check_unique(name: string) { function check_unique(name: string) {
if (unique_names.has(name)) { if (unique_names.has(name)) {
parser.error({ parser.error({
code: `duplicate-attribute`, code: 'duplicate-attribute',
message: 'Attributes need to be unique' message: 'Attributes need to be unique'
}, start); }, start);
} }
@ -373,8 +373,8 @@ function read_attribute(parser: Parser, unique_names: Set<string>) {
end = parser.index; end = parser.index;
} else if (parser.match_regex(/["']/)) { } else if (parser.match_regex(/["']/)) {
parser.error({ parser.error({
code: `unexpected-token`, code: 'unexpected-token',
message: `Expected =` message: 'Expected ='
}, parser.index); }, parser.index);
} }
@ -389,7 +389,7 @@ function read_attribute(parser: Parser, unique_names: Set<string>) {
if (type === 'Ref') { if (type === 'Ref') {
parser.error({ parser.error({
code: `invalid-ref-directive`, code: 'invalid-ref-directive',
message: `The ref directive is no longer supported — use \`bind:this={${directive_name}}\` instead` message: `The ref directive is no longer supported — use \`bind:this={${directive_name}}\` instead`
}, start); }, start);
} }
@ -397,8 +397,8 @@ function read_attribute(parser: Parser, unique_names: Set<string>) {
if (value[0]) { if (value[0]) {
if ((value as any[]).length > 1 || value[0].type === 'Text') { if ((value as any[]).length > 1 || value[0].type === 'Text') {
parser.error({ parser.error({
code: `invalid-directive-value`, code: 'invalid-directive-value',
message: `Directive value must be a JavaScript expression enclosed in curly braces` message: 'Directive value must be a JavaScript expression enclosed in curly braces'
}, value[0].start); }, value[0].start);
} }
} }
@ -453,11 +453,11 @@ function get_directive_type(name: string): DirectiveType {
} }
function read_attribute_value(parser: Parser) { function read_attribute_value(parser: Parser) {
const quote_mark = parser.eat(`'`) ? `'` : parser.eat(`"`) ? `"` : null; const quote_mark = parser.eat("'") ? "'" : parser.eat('"') ? '"' : null;
const regex = ( const regex = (
quote_mark === `'` ? /'/ : quote_mark === "'" ? /'/ :
quote_mark === `"` ? /"/ : quote_mark === '"' ? /"/ :
/(\/>|[\s"'=<>`])/ /(\/>|[\s"'=<>`])/
); );
@ -520,7 +520,7 @@ function read_sequence(parser: Parser, done: () => boolean): TemplateNode[] {
} }
parser.error({ parser.error({
code: `unexpected-eof`, code: 'unexpected-eof',
message: `Unexpected end of input` message: 'Unexpected end of input'
}); });
} }

@ -1,7 +1,7 @@
const SQUARE_BRACKET_OPEN = "[".charCodeAt(0); const SQUARE_BRACKET_OPEN = '['.charCodeAt(0);
const SQUARE_BRACKET_CLOSE = "]".charCodeAt(0); const SQUARE_BRACKET_CLOSE = ']'.charCodeAt(0);
const CURLY_BRACKET_OPEN = "{".charCodeAt(0); const CURLY_BRACKET_OPEN = '{'.charCodeAt(0);
const CURLY_BRACKET_CLOSE = "}".charCodeAt(0); const CURLY_BRACKET_CLOSE = '}'.charCodeAt(0);
export function is_bracket_open(code) { export function is_bracket_open(code) {
return code === SQUARE_BRACKET_OPEN || code === CURLY_BRACKET_OPEN; return code === SQUARE_BRACKET_OPEN || code === CURLY_BRACKET_OPEN;

@ -26,7 +26,7 @@ function parse_attributes(str: string) {
if (p === -1) { if (p === -1) {
attrs[attr] = true; attrs[attr] = true;
} else { } else {
attrs[attr.slice(0, p)] = `'"`.includes(attr[p + 1]) ? attrs[attr.slice(0, p)] = '\'"'.includes(attr[p + 1]) ?
attr.slice(p + 2, -1) : attr.slice(p + 2, -1) :
attr.slice(p + 1); attr.slice(p + 1);
} }

@ -6,17 +6,17 @@ export function dispatch_dev<T=any>(type: string, detail?: T) {
} }
export function append_dev(target: Node, node: Node) { export function append_dev(target: Node, node: Node) {
dispatch_dev("SvelteDOMInsert", { target, node }); dispatch_dev('SvelteDOMInsert', { target, node });
append(target, node); append(target, node);
} }
export function insert_dev(target: Node, node: Node, anchor?: Node) { export function insert_dev(target: Node, node: Node, anchor?: Node) {
dispatch_dev("SvelteDOMInsert", { target, node, anchor }); dispatch_dev('SvelteDOMInsert', { target, node, anchor });
insert(target, node, anchor); insert(target, node, anchor);
} }
export function detach_dev(node: Node) { export function detach_dev(node: Node) {
dispatch_dev("SvelteDOMRemove", { node }); dispatch_dev('SvelteDOMRemove', { node });
detach(node); detach(node);
} }
@ -39,15 +39,15 @@ export function detach_after_dev(before: Node) {
} }
export function listen_dev(node: Node, event: string, handler: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions | EventListenerOptions, has_prevent_default?: boolean, has_stop_propagation?: boolean) { export function listen_dev(node: Node, event: string, handler: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions | EventListenerOptions, has_prevent_default?: boolean, has_stop_propagation?: boolean) {
const modifiers = options === true ? [ "capture" ] : options ? Array.from(Object.keys(options)) : []; const modifiers = options === true ? [ 'capture' ] : options ? Array.from(Object.keys(options)) : [];
if (has_prevent_default) modifiers.push('preventDefault'); if (has_prevent_default) modifiers.push('preventDefault');
if (has_stop_propagation) modifiers.push('stopPropagation'); if (has_stop_propagation) modifiers.push('stopPropagation');
dispatch_dev("SvelteDOMAddEventListener", { node, event, handler, modifiers }); dispatch_dev('SvelteDOMAddEventListener', { node, event, handler, modifiers });
const dispose = listen(node, event, handler, options); const dispose = listen(node, event, handler, options);
return () => { return () => {
dispatch_dev("SvelteDOMRemoveEventListener", { node, event, handler, modifiers }); dispatch_dev('SvelteDOMRemoveEventListener', { node, event, handler, modifiers });
dispose(); dispose();
}; };
} }
@ -55,27 +55,27 @@ export function listen_dev(node: Node, event: string, handler: EventListenerOrEv
export function attr_dev(node: Element, attribute: string, value?: string) { export function attr_dev(node: Element, attribute: string, value?: string) {
attr(node, attribute, value); attr(node, attribute, value);
if (value == null) dispatch_dev("SvelteDOMRemoveAttribute", { node, attribute }); if (value == null) dispatch_dev('SvelteDOMRemoveAttribute', { node, attribute });
else dispatch_dev("SvelteDOMSetAttribute", { node, attribute, value }); else dispatch_dev('SvelteDOMSetAttribute', { node, attribute, value });
} }
export function prop_dev(node: Element, property: string, value?: any) { export function prop_dev(node: Element, property: string, value?: any) {
node[property] = value; node[property] = value;
dispatch_dev("SvelteDOMSetProperty", { node, property, value }); dispatch_dev('SvelteDOMSetProperty', { node, property, value });
} }
export function dataset_dev(node: HTMLElement, property: string, value?: any) { export function dataset_dev(node: HTMLElement, property: string, value?: any) {
node.dataset[property] = value; node.dataset[property] = value;
dispatch_dev("SvelteDOMSetDataset", { node, property, value }); dispatch_dev('SvelteDOMSetDataset', { node, property, value });
} }
export function set_data_dev(text, data) { export function set_data_dev(text, data) {
data = '' + data; data = '' + data;
if (text.wholeText === data) return; if (text.wholeText === data) return;
dispatch_dev("SvelteDOMSetData", { node: text, data }); dispatch_dev('SvelteDOMSetData', { node: text, data });
text.data = data; text.data = data;
} }
@ -115,7 +115,7 @@ export class SvelteComponentDev extends SvelteComponent {
$$inline?: boolean; $$inline?: boolean;
}) { }) {
if (!options || (!options.target && !options.$$inline)) { if (!options || (!options.target && !options.$$inline)) {
throw new Error(`'target' is a required option`); throw new Error("'target' is a required option");
} }
super(); super();
@ -124,7 +124,7 @@ export class SvelteComponentDev extends SvelteComponent {
$destroy() { $destroy() {
super.$destroy(); super.$destroy();
this.$destroy = () => { this.$destroy = () => {
console.warn(`Component was already destroyed`); // eslint-disable-line no-console console.warn('Component was already destroyed'); // eslint-disable-line no-console
}; };
} }
@ -137,7 +137,7 @@ export function loop_guard(timeout) {
const start = Date.now(); const start = Date.now();
return () => { return () => {
if (Date.now() - start > timeout) { if (Date.now() - start > timeout) {
throw new Error(`Infinite loop detected`); throw new Error('Infinite loop detected');
} }
}; };
} }

@ -1,4 +1,4 @@
import { has_prop } from "./utils"; import { has_prop } from './utils';
export function append(target: Node, node: Node) { export function append(target: Node, node: Node) {
target.appendChild(node); target.appendChild(node);
@ -269,7 +269,7 @@ export function add_resize_listener(node: HTMLElement, fn: () => void) {
const iframe = element('iframe'); const iframe = element('iframe');
iframe.setAttribute('style', iframe.setAttribute('style',
`display: block; position: absolute; top: 0; left: 0; width: 100%; height: 100%; ` + 'display: block; position: absolute; top: 0; left: 0; width: 100%; height: 100%; ' +
`overflow: hidden; border: 0; opacity: 0; pointer-events: none; z-index: ${z_index};` `overflow: hidden; border: 0; opacity: 0; pointer-events: none; z-index: ${z_index};`
); );
iframe.setAttribute('aria-hidden', 'true'); iframe.setAttribute('aria-hidden', 'true');
@ -280,7 +280,7 @@ export function add_resize_listener(node: HTMLElement, fn: () => void) {
let unsubscribe: () => void; let unsubscribe: () => void;
if (crossorigin) { if (crossorigin) {
iframe.src = `data:text/html,<script>onresize=function(){parent.postMessage(0,'*')}</script>`; iframe.src = "data:text/html,<script>onresize=function(){parent.postMessage(0,'*')}</script>";
unsubscribe = listen(window, 'message', (event: MessageEvent) => { unsubscribe = listen(window, 'message', (event: MessageEvent) => {
if (event.source === iframe.contentWindow) fn(); if (event.source === iframe.contentWindow) fn();
}); });

@ -113,7 +113,7 @@ export function validate_each_keys(ctx, list, get_context, get_key) {
for (let i = 0; i < list.length; i++) { for (let i = 0; i < list.length; i++) {
const key = get_key(get_context(ctx, list, i)); const key = get_key(get_context(ctx, list, i));
if (keys.has(key)) { if (keys.has(key)) {
throw new Error(`Cannot have duplicate keys in a keyed each`); throw new Error('Cannot have duplicate keys in a keyed each');
} }
keys.add(key); keys.add(key);
} }

@ -7,7 +7,7 @@ export function set_current_component(component) {
} }
export function get_current_component() { export function get_current_component() {
if (!current_component) throw new Error(`Function called outside component initialization`); if (!current_component) throw new Error('Function called outside component initialization');
return current_component; return current_component;
} }

@ -21,9 +21,9 @@ export function spread(args, classes_to_add) {
if (invalid_attribute_name_character.test(name)) return; if (invalid_attribute_name_character.test(name)) return;
const value = attributes[name]; const value = attributes[name];
if (value === true) str += " " + name; if (value === true) str += ' ' + name;
else if (boolean_attributes.has(name.toLowerCase())) { else if (boolean_attributes.has(name.toLowerCase())) {
if (value) str += " " + name; if (value) str += ' ' + name;
} else if (value != null) { } else if (value != null) {
str += ` ${name}="${String(value).replace(/"/g, '&#34;').replace(/'/g, '&#39;')}"`; str += ` ${name}="${String(value).replace(/"/g, '&#34;').replace(/'/g, '&#39;')}"`;
} }
@ -133,5 +133,5 @@ export function add_attribute(name, value, boolean) {
} }
export function add_classes(classes) { export function add_classes(classes) {
return classes ? ` class="${classes}"` : ``; return classes ? ` class="${classes}"` : '';
} }

@ -40,7 +40,7 @@ export function create_rule(node: Element & ElementCSSInlineStyle, a: number, b:
} }
const animation = node.style.animation || ''; const animation = node.style.animation || '';
node.style.animation = `${animation ? `${animation}, ` : ``}${name} ${duration}ms linear ${delay}ms 1 both`; node.style.animation = `${animation ? `${animation}, ` : ''}${name} ${duration}ms linear ${delay}ms 1 both`;
active += 1; active += 1;
return name; return name;

@ -1,5 +1,5 @@
import { identity as linear, is_function, noop, run_all } from './utils'; import { identity as linear, is_function, noop, run_all } from './utils';
import { now } from "./environment"; import { now } from './environment';
import { loop } from './loop'; import { loop } from './loop';
import { create_rule, delete_rule } from './style_manager'; import { create_rule, delete_rule } from './style_manager';
import { custom_event } from './dom'; import { custom_event } from './dom';

@ -1,4 +1,4 @@
import { Readable } from "svelte/store"; import { Readable } from 'svelte/store';
export function noop() {} export function noop() {}

@ -120,7 +120,7 @@ export function slide(node: Element, {
duration, duration,
easing, easing,
css: t => css: t =>
`overflow: hidden;` + 'overflow: hidden;' +
`opacity: ${Math.min(t * 20, 1) * opacity};` + `opacity: ${Math.min(t * 20, 1) * opacity};` +
`height: ${t * height}px;` + `height: ${t * height}px;` +
`padding-top: ${t * padding_top}px;` + `padding-top: ${t * padding_top}px;` +

@ -1,7 +1,7 @@
export default { export default {
warnings: [{ warnings: [{
filename: "SvelteComponent.svelte", filename: 'SvelteComponent.svelte',
code: `css-unused-selector`, code: 'css-unused-selector',
message: 'Unused CSS selector ".x"', message: 'Unused CSS selector ".x"',
start: { start: {
line: 4, line: 4,

@ -1,7 +1,7 @@
export default { export default {
warnings: [ warnings: [
{ {
code: "css-unused-selector", code: 'css-unused-selector',
frame: ` frame: `
13: 13:
14: /* no match */ 14: /* no match */
@ -15,7 +15,7 @@ export default {
end: { character: 276, column: 8, line: 15 } end: { character: 276, column: 8, line: 15 }
}, },
{ {
code: "css-unused-selector", code: 'css-unused-selector',
frame: ` frame: `
14: /* no match */ 14: /* no match */
15: .b ~ .c { color: green; } 15: .b ~ .c { color: green; }
@ -29,7 +29,7 @@ export default {
end: { character: 303, column: 8, line: 16 } end: { character: 303, column: 8, line: 16 }
}, },
{ {
code: "css-unused-selector", code: 'css-unused-selector',
frame: ` frame: `
15: .b ~ .c { color: green; } 15: .b ~ .c { color: green; }
16: .c ~ .d { color: green; } 16: .c ~ .d { color: green; }

@ -1,7 +1,7 @@
export default { export default {
warnings: [ warnings: [
{ {
code: "css-unused-selector", code: 'css-unused-selector',
frame: ` frame: `
33: 33:
34: /* no match */ 34: /* no match */

@ -1,7 +1,7 @@
export default { export default {
warnings: [ warnings: [
{ {
code: "css-unused-selector", code: 'css-unused-selector',
frame: ` frame: `
11: 11:
12: /* no match */ 12: /* no match */

@ -1,7 +1,7 @@
export default { export default {
warnings: [ warnings: [
{ {
code: "css-unused-selector", code: 'css-unused-selector',
frame: ` frame: `
16: 16:
17: /* no match */ 17: /* no match */

@ -1,7 +1,7 @@
export default { export default {
warnings: [ warnings: [
{ {
code: "css-unused-selector", code: 'css-unused-selector',
frame: ` frame: `
12: 12:
13: /* no match */ 13: /* no match */

@ -1,7 +1,7 @@
export default { export default {
warnings: [ warnings: [
{ {
code: "css-unused-selector", code: 'css-unused-selector',
frame: ` frame: `
14: 14:
15: /* no match */ 15: /* no match */
@ -15,7 +15,7 @@ export default {
end: { character: 276, column: 8, line: 16 } end: { character: 276, column: 8, line: 16 }
}, },
{ {
code: "css-unused-selector", code: 'css-unused-selector',
frame: ` frame: `
15: /* no match */ 15: /* no match */
16: .b ~ .c { color: green; } 16: .b ~ .c { color: green; }
@ -29,7 +29,7 @@ export default {
end: { character: 303, column: 8, line: 17 } end: { character: 303, column: 8, line: 17 }
}, },
{ {
code: "css-unused-selector", code: 'css-unused-selector',
frame: ` frame: `
16: .b ~ .c { color: green; } 16: .b ~ .c { color: green; }
17: .b ~ .d { color: green; } 17: .b ~ .d { color: green; }

@ -1,7 +1,7 @@
export default { export default {
warnings: [ warnings: [
{ {
code: "css-unused-selector", code: 'css-unused-selector',
frame: ` frame: `
8: 8:
9: /* no match */ 9: /* no match */
@ -15,7 +15,7 @@ export default {
end: { character: 118, column: 8, line: 10 } end: { character: 118, column: 8, line: 10 }
}, },
{ {
code: "css-unused-selector", code: 'css-unused-selector',
frame: ` frame: `
9: /* no match */ 9: /* no match */
10: .a ~ .b { color: green; } 10: .a ~ .b { color: green; }
@ -29,7 +29,7 @@ export default {
end: { character: 145, column: 8, line: 11 } end: { character: 145, column: 8, line: 11 }
}, },
{ {
code: "css-unused-selector", code: 'css-unused-selector',
frame: ` frame: `
10: .a ~ .b { color: green; } 10: .a ~ .b { color: green; }
11: .b ~ .c { color: green; } 11: .b ~ .c { color: green; }
@ -43,7 +43,7 @@ export default {
end: { character: 172, column: 8, line: 12 } end: { character: 172, column: 8, line: 12 }
}, },
{ {
code: "css-unused-selector", code: 'css-unused-selector',
frame: ` frame: `
11: .b ~ .c { color: green; } 11: .b ~ .c { color: green; }
12: .c ~ .f { color: green; } 12: .c ~ .f { color: green; }
@ -57,7 +57,7 @@ export default {
end: { character: 199, column: 8, line: 13 } end: { character: 199, column: 8, line: 13 }
}, },
{ {
code: "css-unused-selector", code: 'css-unused-selector',
frame: ` frame: `
12: .c ~ .f { color: green; } 12: .c ~ .f { color: green; }
13: .f ~ .g { color: green; } 13: .f ~ .g { color: green; }
@ -71,7 +71,7 @@ export default {
end: { character: 226, column: 8, line: 14 } end: { character: 226, column: 8, line: 14 }
}, },
{ {
code: "css-unused-selector", code: 'css-unused-selector',
frame: ` frame: `
13: .f ~ .g { color: green; } 13: .f ~ .g { color: green; }
14: .b ~ .f { color: green; } 14: .b ~ .f { color: green; }

@ -1,7 +1,7 @@
export default { export default {
warnings: [ warnings: [
{ {
code: "css-unused-selector", code: 'css-unused-selector',
frame: ` frame: `
3: margin-left: 4px; 3: margin-left: 4px;
4: } 4: }

@ -1,7 +1,7 @@
export default { export default {
warnings: [ warnings: [
{ {
code: "css-unused-selector", code: 'css-unused-selector',
frame: ` frame: `
10: 10:
11: /* no match */ 11: /* no match */
@ -15,7 +15,7 @@ export default {
end: { character: 288, column: 14, line: 12 } end: { character: 288, column: 14, line: 12 }
}, },
{ {
code: "css-unused-selector", code: 'css-unused-selector',
frame: ` frame: `
11: /* no match */ 11: /* no match */
12: article ~ div { color: green; } 12: article ~ div { color: green; }
@ -29,7 +29,7 @@ export default {
end: { character: 322, column: 15, line: 13 } end: { character: 322, column: 15, line: 13 }
}, },
{ {
code: "css-unused-selector", code: 'css-unused-selector',
frame: ` frame: `
12: article ~ div { color: green; } 12: article ~ div { color: green; }
13: span ~ article { color: green; } 13: span ~ article { color: green; }
@ -43,7 +43,7 @@ export default {
end: { character: 353, column: 12, line: 14 } end: { character: 353, column: 12, line: 14 }
}, },
{ {
code: "css-unused-selector", code: 'css-unused-selector',
frame: ` frame: `
13: span ~ article { color: green; } 13: span ~ article { color: green; }
14: b ~ article { color: green; } 14: b ~ article { color: green; }

@ -1,6 +1,6 @@
export default { export default {
warnings: [{ warnings: [{
code: `css-unused-selector`, code: 'css-unused-selector',
message: 'Unused CSS selector "div > p"', message: 'Unused CSS selector "div > p"',
start: { start: {
line: 8, line: 8,

@ -1,7 +1,7 @@
export default { export default {
warnings: [ warnings: [
{ {
code: "css-unused-selector", code: 'css-unused-selector',
frame: ` frame: `
12: 12:
13: /* no match */ 13: /* no match */
@ -15,7 +15,7 @@ export default {
end: { character: 249, column: 8, line: 14 } end: { character: 249, column: 8, line: 14 }
}, },
{ {
code: "css-unused-selector", code: 'css-unused-selector',
frame: ` frame: `
13: /* no match */ 13: /* no match */
14: .a + .e { color: green; } 14: .a + .e { color: green; }
@ -29,7 +29,7 @@ export default {
end: { character: 276, column: 8, line: 15 } end: { character: 276, column: 8, line: 15 }
}, },
{ {
code: "css-unused-selector", code: 'css-unused-selector',
frame: ` frame: `
14: .a + .e { color: green; } 14: .a + .e { color: green; }
15: .b + .c { color: green; } 15: .b + .c { color: green; }
@ -43,7 +43,7 @@ export default {
end: { character: 303, column: 8, line: 16 } end: { character: 303, column: 8, line: 16 }
}, },
{ {
code: "css-unused-selector", code: 'css-unused-selector',
frame: ` frame: `
15: .b + .c { color: green; } 15: .b + .c { color: green; }
16: .c + .d { color: green; } 16: .c + .d { color: green; }

@ -1,7 +1,7 @@
export default { export default {
warnings: [ warnings: [
{ {
code: "css-unused-selector", code: 'css-unused-selector',
frame: ` frame: `
24: } 24: }
25: /* not match */ 25: /* not match */

@ -1,7 +1,7 @@
export default { export default {
warnings: [ warnings: [
{ {
code: "css-unused-selector", code: 'css-unused-selector',
frame: ` frame: `
21: 21:
22: /* no match */ 22: /* no match */
@ -15,7 +15,7 @@ export default {
end: { character: 486, column: 8, line: 23 } end: { character: 486, column: 8, line: 23 }
}, },
{ {
code: "css-unused-selector", code: 'css-unused-selector',
frame: ` frame: `
22: /* no match */ 22: /* no match */
23: .a + .c { color: green; } 23: .a + .c { color: green; }
@ -29,7 +29,7 @@ export default {
end: { character: 513, column: 8, line: 24 } end: { character: 513, column: 8, line: 24 }
}, },
{ {
code: "css-unused-selector", code: 'css-unused-selector',
frame: ` frame: `
23: .a + .c { color: green; } 23: .a + .c { color: green; }
24: .a + .g { color: green; } 24: .a + .g { color: green; }
@ -43,7 +43,7 @@ export default {
end: { character: 540, column: 8, line: 25 } end: { character: 540, column: 8, line: 25 }
}, },
{ {
code: "css-unused-selector", code: 'css-unused-selector',
frame: ` frame: `
24: .a + .g { color: green; } 24: .a + .g { color: green; }
25: .b + .e { color: green; } 25: .b + .e { color: green; }
@ -57,7 +57,7 @@ export default {
end: { character: 567, column: 8, line: 26 } end: { character: 567, column: 8, line: 26 }
}, },
{ {
code: "css-unused-selector", code: 'css-unused-selector',
frame: ` frame: `
25: .b + .e { color: green; } 25: .b + .e { color: green; }
26: .c + .g { color: green; } 26: .c + .g { color: green; }
@ -71,7 +71,7 @@ export default {
end: { character: 594, column: 8, line: 27 } end: { character: 594, column: 8, line: 27 }
}, },
{ {
code: "css-unused-selector", code: 'css-unused-selector',
frame: ` frame: `
26: .c + .g { color: green; } 26: .c + .g { color: green; }
27: .c + .k { color: green; } 27: .c + .k { color: green; }
@ -85,7 +85,7 @@ export default {
end: { character: 621, column: 8, line: 28 } end: { character: 621, column: 8, line: 28 }
}, },
{ {
code: "css-unused-selector", code: 'css-unused-selector',
frame: ` frame: `
27: .c + .k { color: green; } 27: .c + .k { color: green; }
28: .d + .d { color: green; } 28: .d + .d { color: green; }
@ -99,7 +99,7 @@ export default {
end: { character: 648, column: 8, line: 29 } end: { character: 648, column: 8, line: 29 }
}, },
{ {
code: "css-unused-selector", code: 'css-unused-selector',
frame: ` frame: `
28: .d + .d { color: green; } 28: .d + .d { color: green; }
29: .e + .f { color: green; } 29: .e + .f { color: green; }
@ -113,7 +113,7 @@ export default {
end: { character: 675, column: 8, line: 30 } end: { character: 675, column: 8, line: 30 }
}, },
{ {
code: "css-unused-selector", code: 'css-unused-selector',
frame: ` frame: `
29: .e + .f { color: green; } 29: .e + .f { color: green; }
30: .f + .f { color: green; } 30: .f + .f { color: green; }
@ -127,7 +127,7 @@ export default {
end: { character: 702, column: 8, line: 31 } end: { character: 702, column: 8, line: 31 }
}, },
{ {
code: "css-unused-selector", code: 'css-unused-selector',
frame: ` frame: `
30: .f + .f { color: green; } 30: .f + .f { color: green; }
31: .g + .j { color: green; } 31: .g + .j { color: green; }

@ -1,7 +1,7 @@
export default { export default {
warnings: [ warnings: [
{ {
code: "css-unused-selector", code: 'css-unused-selector',
frame: ` frame: `
10: 10:
11: /* no match */ 11: /* no match */
@ -15,7 +15,7 @@ export default {
end: { character: 179, column: 8, line: 12 } end: { character: 179, column: 8, line: 12 }
}, },
{ {
code: "css-unused-selector", code: 'css-unused-selector',
frame: ` frame: `
11: /* no match */ 11: /* no match */
12: .a + .d { color: green; } 12: .a + .d { color: green; }

@ -1,7 +1,7 @@
export default { export default {
warnings: [ warnings: [
{ {
code: "css-unused-selector", code: 'css-unused-selector',
frame: ` frame: `
56: 56:
57: /* no match */ 57: /* no match */
@ -15,7 +15,7 @@ export default {
end: { character: 1236, column: 8, line: 58 } end: { character: 1236, column: 8, line: 58 }
}, },
{ {
code: "css-unused-selector", code: 'css-unused-selector',
frame: ` frame: `
57: /* no match */ 57: /* no match */
58: .a + .h { color: green; } 58: .a + .h { color: green; }
@ -29,7 +29,7 @@ export default {
end: { character: 1263, column: 8, line: 59 } end: { character: 1263, column: 8, line: 59 }
}, },
{ {
code: "css-unused-selector", code: 'css-unused-selector',
frame: ` frame: `
58: .a + .h { color: green; } 58: .a + .h { color: green; }
59: .a + .i { color: green; } 59: .a + .i { color: green; }
@ -43,7 +43,7 @@ export default {
end: { character: 1290, column: 8, line: 60 } end: { character: 1290, column: 8, line: 60 }
}, },
{ {
code: "css-unused-selector", code: 'css-unused-selector',
frame: ` frame: `
59: .a + .i { color: green; } 59: .a + .i { color: green; }
60: .c + .h { color: green; } 60: .c + .h { color: green; }
@ -57,7 +57,7 @@ export default {
end: { character: 1317, column: 8, line: 61 } end: { character: 1317, column: 8, line: 61 }
}, },
{ {
code: "css-unused-selector", code: 'css-unused-selector',
frame: ` frame: `
60: .c + .h { color: green; } 60: .c + .h { color: green; }
61: .c + .i { color: green; } 61: .c + .i { color: green; }
@ -71,7 +71,7 @@ export default {
end: { character: 1344, column: 8, line: 62 } end: { character: 1344, column: 8, line: 62 }
}, },
{ {
code: "css-unused-selector", code: 'css-unused-selector',
frame: ` frame: `
61: .c + .i { color: green; } 61: .c + .i { color: green; }
62: .d + .f { color: green; } 62: .d + .f { color: green; }
@ -85,7 +85,7 @@ export default {
end: { character: 1371, column: 8, line: 63 } end: { character: 1371, column: 8, line: 63 }
}, },
{ {
code: "css-unused-selector", code: 'css-unused-selector',
frame: ` frame: `
62: .d + .f { color: green; } 62: .d + .f { color: green; }
63: .d + .g { color: green; } 63: .d + .g { color: green; }
@ -99,7 +99,7 @@ export default {
end: { character: 1398, column: 8, line: 64 } end: { character: 1398, column: 8, line: 64 }
}, },
{ {
code: "css-unused-selector", code: 'css-unused-selector',
frame: ` frame: `
63: .d + .g { color: green; } 63: .d + .g { color: green; }
64: .e + .g { color: green; } 64: .e + .g { color: green; }

@ -1,7 +1,7 @@
export default { export default {
warnings: [ warnings: [
{ {
code: "css-unused-selector", code: 'css-unused-selector',
frame: ` frame: `
16: 16:
17: /* no match */ 17: /* no match */

@ -1,7 +1,7 @@
export default { export default {
warnings: [ warnings: [
{ {
code: "css-unused-selector", code: 'css-unused-selector',
frame: ` frame: `
12: 12:
13: /* no match */ 13: /* no match */

@ -1,7 +1,7 @@
export default { export default {
warnings: [ warnings: [
{ {
code: "css-unused-selector", code: 'css-unused-selector',
frame: ` frame: `
13: 13:
14: /* no match */ 14: /* no match */
@ -15,7 +15,7 @@ export default {
end: { character: 249, column: 8, line: 15 } end: { character: 249, column: 8, line: 15 }
}, },
{ {
code: "css-unused-selector", code: 'css-unused-selector',
frame: ` frame: `
14: /* no match */ 14: /* no match */
15: .a + .e { color: green; } 15: .a + .e { color: green; }
@ -29,7 +29,7 @@ export default {
end: { character: 276, column: 8, line: 16 } end: { character: 276, column: 8, line: 16 }
}, },
{ {
code: "css-unused-selector", code: 'css-unused-selector',
frame: ` frame: `
15: .a + .e { color: green; } 15: .a + .e { color: green; }
16: .b + .c { color: green; } 16: .b + .c { color: green; }
@ -43,7 +43,7 @@ export default {
end: { character: 303, column: 8, line: 17 } end: { character: 303, column: 8, line: 17 }
}, },
{ {
code: "css-unused-selector", code: 'css-unused-selector',
frame: ` frame: `
16: .b + .c { color: green; } 16: .b + .c { color: green; }
17: .b + .d { color: green; } 17: .b + .d { color: green; }

@ -1,7 +1,7 @@
export default { export default {
warnings: [ warnings: [
{ {
code: "css-unused-selector", code: 'css-unused-selector',
frame: ` frame: `
7: 7:
8: /* no match */ 8: /* no match */
@ -15,7 +15,7 @@ export default {
end: { character: 91, column: 8, line: 9 } end: { character: 91, column: 8, line: 9 }
}, },
{ {
code: "css-unused-selector", code: 'css-unused-selector',
frame: ` frame: `
8: /* no match */ 8: /* no match */
9: .a + .b { color: green; } 9: .a + .b { color: green; }
@ -29,7 +29,7 @@ export default {
end: { character: 118, column: 8, line: 10 } end: { character: 118, column: 8, line: 10 }
}, },
{ {
code: "css-unused-selector", code: 'css-unused-selector',
frame: ` frame: `
9: .a + .b { color: green; } 9: .a + .b { color: green; }
10: .b + .c { color: green; } 10: .b + .c { color: green; }

@ -1,7 +1,7 @@
export default { export default {
warnings: [ warnings: [
{ {
code: "css-unused-selector", code: 'css-unused-selector',
frame: ` frame: `
3: margin-left: 4px; 3: margin-left: 4px;
4: } 4: }

@ -1,7 +1,7 @@
export default { export default {
warnings: [ warnings: [
{ {
code: "css-unused-selector", code: 'css-unused-selector',
frame: ` frame: `
3: color: green; 3: color: green;
4: } 4: }
@ -15,7 +15,7 @@ export default {
end: { character: 58, column: 14, line: 5 } end: { character: 58, column: 14, line: 5 }
}, },
{ {
code: "css-unused-selector", code: 'css-unused-selector',
frame:` frame:`
6: color: green; 6: color: green;
@ -30,7 +30,7 @@ export default {
end: { character: 95, column: 15, line: 8 } end: { character: 95, column: 15, line: 8 }
}, },
{ {
code: "css-unused-selector", code: 'css-unused-selector',
frame: ` frame: `
9: color: green; 9: color: green;
@ -45,7 +45,7 @@ export default {
end: { character: 129, column: 12, line: 11 } end: { character: 129, column: 12, line: 11 }
}, },
{ {
code: "css-unused-selector", code: 'css-unused-selector',
frame: ` frame: `
12: color: green; 12: color: green;
13: } 13: }

@ -1,7 +1,7 @@
export default { export default {
warnings: [ warnings: [
{ {
code: "css-unused-selector", code: 'css-unused-selector',
message: 'Unused CSS selector "article > *"', message: 'Unused CSS selector "article > *"',
frame: ` frame: `
1: <style> 1: <style>
@ -14,7 +14,7 @@ export default {
end: { character: 21, column: 12, line: 2 } end: { character: 21, column: 12, line: 2 }
}, },
{ {
code: "css-unused-selector", code: 'css-unused-selector',
message: 'Unused CSS selector "article *"', message: 'Unused CSS selector "article *"',
frame: ` frame: `
4: } 4: }
@ -28,7 +28,7 @@ export default {
end: { character: 58, column: 10, line: 6 } end: { character: 58, column: 10, line: 6 }
}, },
{ {
code: "css-unused-selector", code: 'css-unused-selector',
message: 'Unused CSS selector ".article > *"', message: 'Unused CSS selector ".article > *"',
frame: ` frame: `
8: } 8: }

@ -1,8 +1,8 @@
export default { export default {
warnings: [ warnings: [
{ {
filename: "SvelteComponent.svelte", filename: 'SvelteComponent.svelte',
code: `css-unused-selector`, code: 'css-unused-selector',
message: 'Unused CSS selector ".foo"', message: 'Unused CSS selector ".foo"',
start: { start: {
line: 4, line: 4,
@ -25,8 +25,8 @@ export default {
}, },
{ {
filename: "SvelteComponent.svelte", filename: 'SvelteComponent.svelte',
code: `css-unused-selector`, code: 'css-unused-selector',
message: 'Unused CSS selector ".baz"', message: 'Unused CSS selector ".baz"',
start: { start: {
line: 4, line: 4,

@ -4,8 +4,8 @@ export default {
}, },
warnings: [{ warnings: [{
filename: "SvelteComponent.svelte", filename: 'SvelteComponent.svelte',
code: `css-unused-selector`, code: 'css-unused-selector',
message: 'Unused CSS selector ".maybeactive"', message: 'Unused CSS selector ".maybeactive"',
start: { start: {
line: 16, line: 16,

@ -1,7 +1,7 @@
export default { export default {
warnings: [{ warnings: [{
filename: "SvelteComponent.svelte", filename: 'SvelteComponent.svelte',
code: `css-unused-selector`, code: 'css-unused-selector',
message: 'Unused CSS selector ".bar"', message: 'Unused CSS selector ".bar"',
start: { start: {
line: 8, line: 8,

@ -4,7 +4,7 @@ import * as http from 'http';
import { rollup } from 'rollup'; import { rollup } from 'rollup';
import virtual from '@rollup/plugin-virtual'; import virtual from '@rollup/plugin-virtual';
import puppeteer from 'puppeteer'; import puppeteer from 'puppeteer';
import { addLineNumbers, loadConfig, loadSvelte } from "../helpers"; import { addLineNumbers, loadConfig, loadSvelte } from '../helpers';
import { deepEqual } from 'assert'; import { deepEqual } from 'assert';
const page = ` const page = `
@ -87,7 +87,7 @@ describe('custom-elements', function() {
transform(code, id) { transform(code, id) {
if (id.endsWith('.svelte')) { if (id.endsWith('.svelte')) {
const compiled = svelte.compile(code.replace(/\r/g, ""), { const compiled = svelte.compile(code.replace(/\r/g, ''), {
customElement: true, customElement: true,
dev: config.dev dev: config.dev
}); });

@ -1,6 +1,6 @@
export default { export default {
warnings: [{ warnings: [{
code: "avoid-is", code: 'avoid-is',
message: "The 'is' attribute is not supported cross-browser and should be avoided", message: "The 'is' attribute is not supported cross-browser and should be avoided",
pos: 98, pos: 98,
start: { start: {

@ -8,10 +8,10 @@ export default async function (target) {
const button = counter.shadowRoot.querySelector('button'); const button = counter.shadowRoot.querySelector('button');
assert.equal(counter.count, 0); assert.equal(counter.count, 0);
assert.equal(counter.shadowRoot.innerHTML, `<button>count: 0</button>`); assert.equal(counter.shadowRoot.innerHTML, '<button>count: 0</button>');
await button.dispatchEvent(new MouseEvent('click')); await button.dispatchEvent(new MouseEvent('click'));
assert.equal(counter.count, 1); assert.equal(counter.count, 1);
assert.equal(counter.shadowRoot.innerHTML, `<button>count: 1</button>`); assert.equal(counter.shadowRoot.innerHTML, '<button>count: 1</button>');
} }

@ -12,7 +12,7 @@ export default function (target) {
target.innerHTML = '<my-app foo=yes />'; target.innerHTML = '<my-app foo=yes />';
assert.deepEqual(warnings, [ assert.deepEqual(warnings, [
`<my-app> was created without expected prop 'bar'` "<my-app> was created without expected prop 'bar'"
]); ]);
console.warn = warn; console.warn = warn;

@ -1,6 +1,6 @@
export default { export default {
warnings: [{ warnings: [{
code: "custom-element-no-tag", code: 'custom-element-no-tag',
message: "No custom element 'tag' option was specified. To automatically register a custom element, specify a name with a hyphen in it, e.g. <svelte:options tag=\"my-thing\"/>. To hide this warning, use <svelte:options tag={null}/>", message: "No custom element 'tag' option was specified. To automatically register a custom element, specify a name with a hyphen in it, e.g. <svelte:options tag=\"my-thing\"/>. To hide this warning, use <svelte:options tag={null}/>",
pos: 0, pos: 0,
start: { start: {

@ -3,7 +3,7 @@ import CustomElement from './main.svelte';
export default function (target) { export default function (target) {
customElements.define('no-tag', CustomElement); customElements.define('no-tag', CustomElement);
target.innerHTML = `<no-tag name="world"></no-tag>`; target.innerHTML = '<no-tag name="world"></no-tag>';
const el = target.querySelector('no-tag'); const el = target.querySelector('no-tag');
const h1 = el.shadowRoot.querySelector('h1'); const h1 = el.shadowRoot.querySelector('h1');

@ -1,6 +1,6 @@
export default { export default {
warnings: [{ warnings: [{
code: "custom-element-no-tag", code: 'custom-element-no-tag',
message: "No custom element 'tag' option was specified. To automatically register a custom element, specify a name with a hyphen in it, e.g. <svelte:options tag=\"my-thing\"/>. To hide this warning, use <svelte:options tag={null}/>", message: "No custom element 'tag' option was specified. To automatically register a custom element, specify a name with a hyphen in it, e.g. <svelte:options tag=\"my-thing\"/>. To hide this warning, use <svelte:options tag={null}/>",
pos: 0, pos: 0,
start: { start: {

@ -3,7 +3,7 @@ import CustomElement from './main.svelte';
export default function (target) { export default function (target) {
customElements.define('no-tag', CustomElement); customElements.define('no-tag', CustomElement);
target.innerHTML = `<no-tag name="world"></no-tag>`; target.innerHTML = '<no-tag name="world"></no-tag>';
const el = target.querySelector('no-tag'); const el = target.querySelector('no-tag');
const h1 = el.shadowRoot.querySelector('h1'); const h1 = el.shadowRoot.querySelector('h1');

@ -3,7 +3,7 @@ import CustomElement from './main.svelte';
export default function (target) { export default function (target) {
customElements.define('no-tag', CustomElement); customElements.define('no-tag', CustomElement);
target.innerHTML = `<no-tag name="world"></no-tag>`; target.innerHTML = '<no-tag name="world"></no-tag>';
const el = target.querySelector('no-tag'); const el = target.querySelector('no-tag');
const h1 = el.shadowRoot.querySelector('h1'); const h1 = el.shadowRoot.querySelector('h1');

@ -19,6 +19,6 @@ export default {
component.foo = false; component.foo = false;
component.bar = true; component.bar = true;
assert.htmlEqual(target.innerHTML, `<p>bar!</p>`); assert.htmlEqual(target.innerHTML, '<p>bar!</p>');
} }
}; };

@ -2,7 +2,7 @@ export default {
skip: true, // existing nodes are blown away skip: true, // existing nodes are blown away
props: { props: {
raw: `<p>this is some html</p> <p>and so is this</p>` raw: '<p>this is some html</p> <p>and so is this</p>'
}, },
snapshot(target) { snapshot(target) {

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save