lint for the lint gods

* fix trailing comma and indentation warnings
* turn off typescript-eslint indent rule (to workaround myriad issues)
* add manual single line ignore (i _think_ that is the right move 🤷🏼‍♂️ anyway)
pull/5031/head
john gravois 5 years ago
parent 1644f207b1
commit 354ab15945
No known key found for this signature in database
GPG Key ID: C062A77053A255FC

@ -10,5 +10,9 @@ module.exports = {
'estree'
],
'svelte3/compiler': require('./compiler')
},
// workaround for https://github.com/typescript-eslint/typescript-eslint/issues/1824 and rely solely on 'indent' rule
rules: {
"@typescript-eslint/indent": "off"
}
};

@ -8,7 +8,7 @@ import {
create_scopes,
extract_names,
Scope,
extract_identifiers,
extract_identifiers
} from './utils/scope';
import Stylesheet from './css/Stylesheet';
import { test } from '../config';
@ -155,7 +155,7 @@ export default class Component {
) || { start: 0, end: 0 };
this.warn(svelteOptions, {
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;
@ -190,7 +190,7 @@ export default class Component {
this.add_var({
name,
injected: true,
referenced: true,
referenced: true
});
} else if (name[0] === '$') {
this.add_var({
@ -198,7 +198,7 @@ export default class Component {
injected: true,
referenced: true,
mutated: true,
writable: true,
writable: true
});
const subscribable_name = name.slice(1);
@ -289,7 +289,7 @@ export default class Component {
}
const imported_helpers = Array.from(this.helpers, ([name, alias]) => ({
name,
alias,
alias
}));
create_module(
@ -305,7 +305,7 @@ export default class Component {
.filter(variable => variable.module && variable.export_name)
.map(variable => ({
name: variable.name,
as: variable.export_name,
as: variable.export_name
}))
);
@ -342,9 +342,9 @@ export default class Component {
reassigned: v.reassigned || false,
referenced: v.referenced || false,
writable: v.writable || false,
referenced_from_script: v.referenced_from_script || false,
referenced_from_script: v.referenced_from_script || false
})),
stats: this.stats.render(),
stats: this.stats.render()
};
}
@ -409,7 +409,7 @@ export default class Component {
source: this.source,
start: pos.start,
end: pos.end,
filename: this.compile_options.filename,
filename: this.compile_options.filename
});
}
@ -441,7 +441,7 @@ export default class Component {
pos: pos.start,
filename: this.compile_options.filename,
toString: () =>
`${warning.message} (${start.line}:${start.column})\n${frame}`,
`${warning.message} (${start.line}:${start.column})\n${frame}`
});
}
@ -453,7 +453,7 @@ export default class Component {
if (node.type === 'ExportDefaultDeclaration') {
this.error(node, {
code: `default-export`,
message: `A component cannot have a default export`,
message: `A component cannot have a default export`
});
}
@ -461,7 +461,7 @@ export default class Component {
if (node.source) {
this.error(node, {
code: `not-implemented`,
message: `A component currently cannot have an export ... from`,
message: `A component currently cannot have an export ... from`
});
}
if (node.declaration) {
@ -531,10 +531,10 @@ export default class Component {
if (node.type === 'LabeledStatement' && node.label.name === '$') {
component.warn(node as any, {
code: 'module-script-reactive-declaration',
message: '$: has no effect in a module script',
message: '$: has no effect in a module script'
});
}
},
}
});
const { scope, globals } = create_scopes(script.content);
@ -544,7 +544,7 @@ export default class Component {
if (name[0] === '$') {
this.error(node as any, {
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`
});
}
@ -562,7 +562,7 @@ export default class Component {
if (name[0] === '$') {
this.error(node as any, {
code: 'illegal-subscription',
message: `Cannot reference store value inside <script context="module">`,
message: `Cannot reference store value inside <script context="module">`
});
} else {
this.add_var({
@ -623,7 +623,7 @@ export default class Component {
if (name[0] === '$') {
this.error(node as any, {
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`
});
}
@ -647,12 +647,12 @@ export default class Component {
injected: true,
writable: true,
reassigned: true,
initialised: true,
initialised: true
});
} else if (is_reserved_keyword(name)) {
this.add_var({
name,
injected: true,
injected: true
});
} else if (name[0] === '$') {
if (name === '$' || name[1] === '$') {
@ -666,7 +666,7 @@ export default class Component {
name,
injected: true,
mutated: true,
writable: true,
writable: true
});
this.add_reference(name.slice(1));
@ -764,7 +764,7 @@ export default class Component {
if (map.has(node)) {
scope = scope.parent;
}
},
}
});
for (const [parent, prop, index] of to_remove) {
@ -832,7 +832,7 @@ export default class Component {
if (map.has(node)) {
scope = scope.parent;
}
},
}
});
}
@ -844,7 +844,7 @@ export default class Component {
) {
this.warn(node as any, {
code: 'non-top-level-reactive-declaration',
message: '$: has no effect outside of the top-level',
message: '$: has no effect outside of the top-level'
});
}
@ -872,7 +872,7 @@ export default class Component {
if (node.body.type !== 'BlockStatement') {
node.body = {
type: 'BlockStatement',
body: [node.body],
body: [node.body]
};
}
node.body.body.push(inside[0]);
@ -881,8 +881,8 @@ export default class Component {
type: 'BlockStatement',
body: [
before[0],
node,
],
node
]
};
}
return null;
@ -918,7 +918,7 @@ export default class Component {
// TODO is this still true post-#3539?
component.error(declarator as any, {
code: 'destructured-prop',
message: `Cannot declare props in destructured declaration`,
message: `Cannot declare props in destructured declaration`
});
}
@ -981,7 +981,7 @@ export default class Component {
if (node.type === 'ExportNamedDeclaration' && node.declaration) {
(parent as Program).body[index] = node.declaration;
}
},
}
});
}
@ -995,7 +995,7 @@ export default class Component {
hoistable_nodes,
var_lookup,
injected_reactive_declaration_vars,
imports,
imports
} = this;
const top_level_function_declarations = new Map();
@ -1127,7 +1127,7 @@ export default class Component {
if (map.has(node)) {
scope = scope.parent;
}
},
}
});
checked.add(fn_declaration);
@ -1218,7 +1218,7 @@ export default class Component {
if (map.has(node)) {
scope = scope.parent;
}
},
}
});
const { expression } = node.body as ExpressionStatement;
@ -1228,7 +1228,7 @@ export default class Component {
assignees,
dependencies,
node,
declaration,
declaration
});
}
});
@ -1309,7 +1309,7 @@ export default class Component {
this.warn(node, {
code: 'missing-declaration',
message,
message
});
}
@ -1332,7 +1332,7 @@ function process_component_options(component: Component, nodes) {
'accessors' in component.compile_options
? component.compile_options.accessors
: !!component.compile_options.customElement,
preserveWhitespace: !!component.compile_options.preserveWhitespace,
preserveWhitespace: !!component.compile_options.preserveWhitespace
};
const node = nodes.find(node => node.name === 'svelte:options');
@ -1362,83 +1362,83 @@ function process_component_options(component: Component, nodes) {
const { name } = attribute;
switch (name) {
case 'tag': {
const code = 'invalid-tag-attribute';
const message = `'tag' must be a string literal`;
const tag = get_value(attribute, code, message);
case 'tag': {
const code = 'invalid-tag-attribute';
const message = `'tag' must be a string literal`;
const tag = get_value(attribute, code, message);
if (typeof tag !== 'string' && tag !== null)
component.error(attribute, { code, message });
if (typeof tag !== 'string' && tag !== null)
component.error(attribute, { code, message });
if (tag && !/^[a-zA-Z][a-zA-Z0-9]*-[a-zA-Z0-9-]+$/.test(tag)) {
component.error(attribute, {
code: `invalid-tag-property`,
message: `tag name must be two or more words joined by the '-' character`,
});
}
if (tag && !component.compile_options.customElement) {
component.warn(attribute, {
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?`
});
}
if (tag && !/^[a-zA-Z][a-zA-Z0-9]*-[a-zA-Z0-9-]+$/.test(tag)) {
component.error(attribute, {
code: `invalid-tag-property`,
message: `tag name must be two or more words joined by the '-' character`
});
}
component_options.tag = tag;
break;
if (tag && !component.compile_options.customElement) {
component.warn(attribute, {
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?`
});
}
case 'namespace': {
const code = 'invalid-namespace-attribute';
const message = `The 'namespace' attribute must be a string literal representing a valid namespace`;
const ns = get_value(attribute, code, message);
component_options.tag = tag;
break;
}
if (typeof ns !== 'string')
component.error(attribute, { code, message });
case 'namespace': {
const code = 'invalid-namespace-attribute';
const message = `The 'namespace' attribute must be a string literal representing a valid namespace`;
const ns = get_value(attribute, code, message);
if (valid_namespaces.indexOf(ns) === -1) {
const match = fuzzymatch(ns, valid_namespaces);
if (match) {
component.error(attribute, {
code: `invalid-namespace-property`,
message: `Invalid namespace '${ns}' (did you mean '${match}'?)`,
});
} else {
component.error(attribute, {
code: `invalid-namespace-property`,
message: `Invalid namespace '${ns}'`,
});
}
}
if (typeof ns !== 'string')
component.error(attribute, { code, message });
component_options.namespace = ns;
break;
if (valid_namespaces.indexOf(ns) === -1) {
const match = fuzzymatch(ns, valid_namespaces);
if (match) {
component.error(attribute, {
code: `invalid-namespace-property`,
message: `Invalid namespace '${ns}' (did you mean '${match}'?)`
});
} else {
component.error(attribute, {
code: `invalid-namespace-property`,
message: `Invalid namespace '${ns}'`
});
}
}
case 'accessors':
case 'immutable':
case 'preserveWhitespace': {
const code = `invalid-${name}-value`;
const message = `${name} attribute must be true or false`;
const value = get_value(attribute, code, message);
component_options.namespace = ns;
break;
}
if (typeof value !== 'boolean')
component.error(attribute, { code, message });
case 'accessors':
case 'immutable':
case 'preserveWhitespace': {
const code = `invalid-${name}-value`;
const message = `${name} attribute must be true or false`;
const value = get_value(attribute, code, message);
component_options[name] = value;
break;
}
if (typeof value !== 'boolean')
component.error(attribute, { code, message });
default:
component.error(attribute, {
code: `invalid-options-attribute`,
message: `<svelte:options> unknown attribute`,
});
component_options[name] = value;
break;
}
default:
component.error(attribute, {
code: `invalid-options-attribute`,
message: `<svelte:options> unknown attribute`
});
}
} else {
component.error(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`
});
}
});

@ -156,13 +156,13 @@ function apply_selector(blocks: Block[], node: Element, stack: Element[], to_enc
}
switch (block_might_apply_to_node(block, node)) {
case BlockAppliesToNode.NotPossible:
return false;
case BlockAppliesToNode.NotPossible:
return false;
case BlockAppliesToNode.UnknownSelectorType:
// bail. TODO figure out what these could be
to_encapsulate.push({ node, block });
return true;
case BlockAppliesToNode.UnknownSelectorType:
// bail. TODO figure out what these could be
to_encapsulate.push({ node, block });
return true;
}
if (block.combinator) {
@ -255,13 +255,13 @@ function test_attribute(operator, expected_value, case_insensitive, value) {
value = value.toLowerCase();
}
switch (operator) {
case '=': return value === expected_value;
case '~=': return value.split(/\s/).includes(expected_value);
case '|=': return `${value}-`.startsWith(`${expected_value}-`);
case '^=': return value.startsWith(expected_value);
case '$=': return value.endsWith(expected_value);
case '*=': return value.includes(expected_value);
default: throw new Error(`this shouldn't happen`);
case '=': return value === expected_value;
case '~=': return value.split(/\s/).includes(expected_value);
case '|=': return `${value}-`.startsWith(`${expected_value}-`);
case '^=': return value.startsWith(expected_value);
case '$=': return value.endsWith(expected_value);
case '*=': return value.includes(expected_value);
default: throw new Error(`this shouldn't happen`);
}
}

@ -52,7 +52,7 @@ function validate_options(options: CompileOptions, warnings: Warning[]) {
code: `options-lowercase-name`,
message,
filename,
toString: () => message,
toString: () => message
});
}
@ -62,7 +62,7 @@ function validate_options(options: CompileOptions, warnings: Warning[]) {
code: `options-loop-guard-timeout`,
message,
filename,
toString: () => message,
toString: () => message
});
}
}

@ -75,7 +75,7 @@ export default class Binding extends Node {
if (info.expression.type === 'Identifier' && !variable.writable) component.error(this.expression.node, {
code: 'invalid-binding',
message: 'Cannot bind to a variable which is not writable',
message: 'Cannot bind to a variable which is not writable'
});
}

@ -167,55 +167,55 @@ export default class Element extends Node {
info.attributes.forEach(node => {
switch (node.type) {
case 'Action':
this.actions.push(new Action(component, this, scope, node));
break;
case 'Action':
this.actions.push(new Action(component, this, scope, node));
break;
case 'Attribute':
case 'Spread':
// special case
if (node.name === 'xmlns') this.namespace = node.value[0].data;
case 'Attribute':
case 'Spread':
// special case
if (node.name === 'xmlns') this.namespace = node.value[0].data;
this.attributes.push(new Attribute(component, this, scope, node));
break;
this.attributes.push(new Attribute(component, this, scope, node));
break;
case 'Binding':
this.bindings.push(new Binding(component, this, scope, node));
break;
case 'Binding':
this.bindings.push(new Binding(component, this, scope, node));
break;
case 'Class':
this.classes.push(new Class(component, this, scope, node));
break;
case 'Class':
this.classes.push(new Class(component, this, scope, node));
break;
case 'EventHandler':
this.handlers.push(new EventHandler(component, this, scope, node));
break;
case 'EventHandler':
this.handlers.push(new EventHandler(component, this, scope, node));
break;
case 'Let': {
const l = new Let(component, this, scope, node);
this.lets.push(l);
const dependencies = new Set([l.name.name]);
case 'Let': {
const l = new Let(component, this, scope, node);
this.lets.push(l);
const dependencies = new Set([l.name.name]);
l.names.forEach(name => {
scope.add(name, dependencies, this);
});
break;
}
l.names.forEach(name => {
scope.add(name, dependencies, this);
});
break;
}
case 'Transition':
{
const transition = new Transition(component, this, scope, node);
if (node.intro) this.intro = transition;
if (node.outro) this.outro = transition;
break;
}
case 'Transition':
{
const transition = new Transition(component, this, scope, node);
if (node.intro) this.intro = transition;
if (node.outro) this.outro = transition;
break;
}
case 'Animation':
this.animation = new Animation(component, this, scope, node);
break;
case 'Animation':
this.animation = new Animation(component, this, scope, node);
break;
default:
throw new Error(`Not implemented: ${node.type}`);
default:
throw new Error(`Not implemented: ${node.type}`);
}
});
@ -388,7 +388,7 @@ export default class Element extends Node {
if (/(^[0-9-.])|[\^$@%&#?!|()[\]{}^*+~;]/.test(name)) {
component.error(attribute, {
code: `illegal-attribute`,
message: `'${name}' is not a valid attribute name`,
message: `'${name}' is not a valid attribute name`
});
}
@ -412,7 +412,7 @@ export default class Element extends Node {
if (!(parent.type === 'InlineComponent' || within_custom_element(parent))) {
component.error(attribute, {
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`
});
}
}

@ -38,50 +38,50 @@ export default class InlineComponent extends Node {
info.attributes.forEach(node => {
/* eslint-disable no-fallthrough */
switch (node.type) {
case 'Action':
component.error(node, {
code: `invalid-action`,
message: `Actions can only be applied to DOM elements, not components`
});
case 'Action':
component.error(node, {
code: `invalid-action`,
message: `Actions can only be applied to DOM elements, not components`
});
case 'Attribute':
if (node.name === 'slot') {
component.error(node, {
code: `invalid-prop`,
message: `'slot' is reserved for future use in named slots`
});
}
// fallthrough
case 'Spread':
this.attributes.push(new Attribute(component, this, scope, node));
break;
case 'Binding':
this.bindings.push(new Binding(component, this, scope, node));
break;
case 'Class':
case 'Attribute':
if (node.name === 'slot') {
component.error(node, {
code: `invalid-class`,
message: `Classes can only be applied to DOM elements, not components`
code: `invalid-prop`,
message: `'slot' is reserved for future use in named slots`
});
}
// fallthrough
case 'Spread':
this.attributes.push(new Attribute(component, this, scope, node));
break;
case 'Binding':
this.bindings.push(new Binding(component, this, scope, node));
break;
case 'Class':
component.error(node, {
code: `invalid-class`,
message: `Classes can only be applied to DOM elements, not components`
});
case 'EventHandler':
this.handlers.push(new EventHandler(component, this, scope, node));
break;
case 'EventHandler':
this.handlers.push(new EventHandler(component, this, scope, node));
break;
case 'Let':
this.lets.push(new Let(component, this, scope, node));
break;
case 'Let':
this.lets.push(new Let(component, this, scope, node));
break;
case 'Transition':
component.error(node, {
code: `invalid-transition`,
message: `Transitions can only be applied to DOM elements, not components`
});
case 'Transition':
component.error(node, {
code: `invalid-transition`,
message: `Transitions can only be applied to DOM elements, not components`
});
default:
throw new Error(`Not implemented: ${node.type}`);
default:
throw new Error(`Not implemented: ${node.type}`);
}
/* eslint-enable no-fallthrough */
});

@ -12,7 +12,7 @@ const elements_without_text = new Set([
'dl',
'optgroup',
'select',
'video',
'video'
]);
export default class Text extends Node {

@ -20,23 +20,23 @@ export type Children = ReturnType<typeof map_children>;
function get_constructor(type) {
switch (type) {
case 'AwaitBlock': return AwaitBlock;
case 'Body': return Body;
case 'Comment': return Comment;
case 'EachBlock': return EachBlock;
case 'Element': return Element;
case 'Head': return Head;
case 'IfBlock': return IfBlock;
case 'InlineComponent': return InlineComponent;
case 'MustacheTag': return MustacheTag;
case 'Options': return Options;
case 'RawMustacheTag': return RawMustacheTag;
case 'DebugTag': return DebugTag;
case 'Slot': return Slot;
case 'Text': return Text;
case 'Title': return Title;
case 'Window': return Window;
default: throw new Error(`Not implemented: ${type}`);
case 'AwaitBlock': return AwaitBlock;
case 'Body': return Body;
case 'Comment': return Comment;
case 'EachBlock': return EachBlock;
case 'Element': return Element;
case 'Head': return Head;
case 'IfBlock': return IfBlock;
case 'InlineComponent': return InlineComponent;
case 'MustacheTag': return MustacheTag;
case 'Options': return Options;
case 'RawMustacheTag': return RawMustacheTag;
case 'DebugTag': return DebugTag;
case 'Slot': return Slot;
case 'Text': return Text;
case 'Title': return Title;
case 'Window': return Window;
default: throw new Error(`Not implemented: ${type}`);
}
}

@ -106,7 +106,7 @@ export default class Block {
intro: [],
update: [],
outro: [],
destroy: [],
destroy: []
};
this.has_animation = false;
@ -393,15 +393,15 @@ export default class Block {
${this.chunks.declarations}
${Array.from(this.variables.values()).map(({ id, init }) => {
return init
? b`let ${id} = ${init}`
: b`let ${id}`;
})}
return init
? b`let ${id} = ${init}`
: b`let ${id}`;
})}
${this.chunks.init}
${dev
? b`
? b`
const ${block} = ${return_value};
@dispatch_dev("SvelteRegisterBlock", {
block: ${block},
@ -411,9 +411,9 @@ export default class Block {
ctx: #ctx
});
return ${block};`
: b`
: b`
return ${return_value};`
}
}
`;
return body;

@ -76,7 +76,7 @@ export default class Renderer {
bindings: new Map(),
dependencies: new Set(),
dependencies: new Set()
});
this.block.has_update_method = true;

@ -90,8 +90,8 @@ export default function dom(
${uses_rest && !uses_props && x`$$props = @assign(@assign({}, $$props), @exclude_internal_props($$new_props))`}
${uses_rest && renderer.invalidate('$$restProps', x`$$restProps = ${compute_rest}`)}
${writable_props.map(prop =>
b`if ('${prop.export_name}' in ${$$props}) ${renderer.invalidate(prop.name, x`${prop.name} = ${$$props}.${prop.export_name}`)};`
)}
b`if ('${prop.export_name}' in ${$$props}) ${renderer.invalidate(prop.name, x`${prop.name} = ${$$props}.${prop.export_name}`)};`
)}
${component.slots.size > 0 &&
b`if ('$$scope' in ${$$props}) ${renderer.invalidate('$$scope', x`$$scope = ${$$props}.$$scope`)};`}
}
@ -190,8 +190,8 @@ export default function dom(
${$$props} => {
${uses_props && renderer.invalidate('$$props', x`$$props = @assign(@assign({}, $$props), $$new_props)`)}
${injectable_vars.map(
v => b`if ('${v.name}' in $$props) ${renderer.invalidate(v.name, x`${v.name} = ${$$props}.${v.name}`)};`
)}
v => b`if ('${v.name}' in $$props) ${renderer.invalidate(v.name, x`${v.name} = ${$$props}.${v.name}`)};`
)}
}
`;

@ -265,8 +265,8 @@ const attribute_lookup = {
'optgroup',
'option',
'select',
'textarea',
],
'textarea'
]
},
formnovalidate: { property_name: 'formNoValidate', applies_to: ['button', 'input'] },
hidden: {},
@ -293,9 +293,9 @@ const attribute_lookup = {
'progress',
'param',
'select',
'textarea',
],
},
'textarea'
]
}
};
Object.keys(attribute_lookup).forEach(name => {

@ -117,75 +117,75 @@ export default class BindingWrapper {
// special cases
switch (this.node.name) {
case 'group':
{
const { binding_group, is_context, contexts, index } = get_binding_group(parent.renderer, this.node, block);
block.renderer.add_to_context(`$$binding_groups`);
if (is_context) {
if (contexts.length > 1) {
let binding_group = x`${block.renderer.reference('$$binding_groups')}[${index}]`;
for (const name of contexts.slice(0, -1)) {
binding_group = x`${binding_group}[${block.renderer.reference(name)}]`;
block.chunks.init.push(
b`${binding_group} = ${binding_group} || [];`
);
}
case 'group':
{
const { binding_group, is_context, contexts, index } = get_binding_group(parent.renderer, this.node, block);
block.renderer.add_to_context(`$$binding_groups`);
if (is_context) {
if (contexts.length > 1) {
let binding_group = x`${block.renderer.reference('$$binding_groups')}[${index}]`;
for (const name of contexts.slice(0, -1)) {
binding_group = x`${binding_group}[${block.renderer.reference(name)}]`;
block.chunks.init.push(
b`${binding_group} = ${binding_group} || [];`
);
}
block.chunks.init.push(
b`${binding_group(true)} = [];`
);
}
block.chunks.hydrate.push(
b`${binding_group(true)}.push(${parent.var});`
);
block.chunks.destroy.push(
b`${binding_group(true)}.splice(${binding_group(true)}.indexOf(${parent.var}), 1);`
block.chunks.init.push(
b`${binding_group(true)} = [];`
);
break;
}
case 'textContent':
update_conditions.push(x`${this.snippet} !== ${parent.var}.textContent`);
mount_conditions.push(x`${this.snippet} !== void 0`);
break;
block.chunks.hydrate.push(
b`${binding_group(true)}.push(${parent.var});`
);
case 'innerHTML':
update_conditions.push(x`${this.snippet} !== ${parent.var}.innerHTML`);
mount_conditions.push(x`${this.snippet} !== void 0`);
break;
block.chunks.destroy.push(
b`${binding_group(true)}.splice(${binding_group(true)}.indexOf(${parent.var}), 1);`
);
break;
}
case 'currentTime':
update_conditions.push(x`!@_isNaN(${this.snippet})`);
mount_dom = null;
break;
case 'playbackRate':
case 'volume':
update_conditions.push(x`!@_isNaN(${this.snippet})`);
mount_conditions.push(x`!@_isNaN(${this.snippet})`);
break;
case 'paused':
{
// this is necessary to prevent audio restarting by itself
const last = block.get_unique_name(`${parent.var.name}_is_paused`);
block.add_variable(last, x`true`);
update_conditions.push(x`${last} !== (${last} = ${this.snippet})`);
update_dom = b`${parent.var}[${last} ? "pause" : "play"]();`;
case 'textContent':
update_conditions.push(x`${this.snippet} !== ${parent.var}.textContent`);
mount_conditions.push(x`${this.snippet} !== void 0`);
break;
case 'innerHTML':
update_conditions.push(x`${this.snippet} !== ${parent.var}.innerHTML`);
mount_conditions.push(x`${this.snippet} !== void 0`);
break;
case 'currentTime':
update_conditions.push(x`!@_isNaN(${this.snippet})`);
mount_dom = null;
break;
case 'playbackRate':
case 'volume':
update_conditions.push(x`!@_isNaN(${this.snippet})`);
mount_conditions.push(x`!@_isNaN(${this.snippet})`);
break;
case 'paused':
{
// this is necessary to prevent audio restarting by itself
const last = block.get_unique_name(`${parent.var.name}_is_paused`);
block.add_variable(last, x`true`);
update_conditions.push(x`${last} !== (${last} = ${this.snippet})`);
update_dom = b`${parent.var}[${last} ? "pause" : "play"]();`;
mount_dom = null;
break;
}
case 'value':
if (parent.node.get_static_attribute_value('type') === 'file') {
update_dom = null;
mount_dom = null;
break;
}
case 'value':
if (parent.node.get_static_attribute_value('type') === 'file') {
update_dom = null;
mount_dom = null;
}
}
if (update_dom) {
@ -305,7 +305,7 @@ function get_binding_group(renderer: Renderer, value: Binding, block: Block) {
},
is_context: contexts.length > 0,
contexts,
index,
index
});
}
@ -319,11 +319,11 @@ function get_event_handler(
name: string,
lhs: Node
): {
uses_context: boolean;
mutation: (Node | Node[]);
contextual_dependencies: Set<string>;
lhs?: Node;
} {
uses_context: boolean;
mutation: (Node | Node[]);
contextual_dependencies: Set<string>;
lhs?: Node;
} {
const contextual_dependencies = new Set<string>(binding.node.expression.contextual_dependencies);
const context = block.bindings.get(name);
@ -358,7 +358,7 @@ function get_event_handler(
uses_context: binding.node.is_contextual || binding.node.expression.uses_context, // TODO this is messy
mutation,
contextual_dependencies,
lhs,
lhs
};
}

@ -130,7 +130,7 @@ const events = [
event_names: ['toggle'],
filter: (node: Element, _name: string) =>
node.name === 'details'
},
}
];
export default class ElementWrapper extends Wrapper {
@ -567,9 +567,9 @@ export default class ElementWrapper extends Wrapper {
function ${handler}(${params}) {
${binding_group.bindings.map(b => b.handler.mutation)}
${Array.from(dependencies)
.filter(dep => dep[0] !== '$')
.filter(dep => !contextual_dependencies.has(dep))
.map(dep => b`${this.renderer.invalidate(dep)};`)}
.filter(dep => dep[0] !== '$')
.filter(dep => !contextual_dependencies.has(dep))
.map(dep => b`${this.renderer.invalidate(dep)};`)}
}
`);

@ -267,22 +267,22 @@ export default class IfBlockWrapper extends Wrapper {
block.chunks.init.push(b`
function ${select_block_type}(#ctx, #dirty) {
${this.branches.map(({ dependencies, condition, snippet, block }) => condition
? b`
? b`
${snippet && (
dependencies.length > 0
? b`if (${condition} == null || ${block.renderer.dirty(dependencies)}) ${condition} = !!${snippet}`
: b`if (${condition} == null) ${condition} = !!${snippet}`
)}
dependencies.length > 0
? b`if (${condition} == null || ${block.renderer.dirty(dependencies)}) ${condition} = !!${snippet}`
: b`if (${condition} == null) ${condition} = !!${snippet}`
)}
if (${condition}) return ${block.name};`
: b`return ${block.name};`)}
: b`return ${block.name};`)}
}
`);
} else {
block.chunks.init.push(b`
function ${select_block_type}(#ctx, #dirty) {
${this.branches.map(({ condition, snippet, block }) => condition
? b`if (${snippet || condition}) return ${block.name};`
: b`return ${block.name};`)}
? b`if (${snippet || condition}) return ${block.name};`
: b`return ${block.name};`)}
}
`);
}
@ -385,25 +385,25 @@ export default class IfBlockWrapper extends Wrapper {
const ${if_blocks} = [];
${this.needs_update
? b`
? b`
function ${select_block_type}(#ctx, #dirty) {
${this.branches.map(({ dependencies, condition, snippet }, i) => condition
? b`
? b`
${snippet && (
dependencies.length > 0
? b`if (${block.renderer.dirty(dependencies)}) ${condition} = !!${snippet}`
: b`if (${condition} == null) ${condition} = !!${snippet}`
)}
dependencies.length > 0
? b`if (${block.renderer.dirty(dependencies)}) ${condition} = !!${snippet}`
: b`if (${condition} == null) ${condition} = !!${snippet}`
)}
if (${condition}) return ${i};`
: b`return ${i};`)}
: b`return ${i};`)}
${!has_else && b`return -1;`}
}
`
: b`
: b`
function ${select_block_type}(#ctx, #dirty) {
${this.branches.map(({ condition, snippet }, i) => condition
? b`if (${snippet || condition}) return ${i};`
: b`return ${i};`)}
? b`if (${snippet || condition}) return ${i};`
: b`return ${i};`)}
${!has_else && b`return -1;`}
}
`}
@ -532,11 +532,11 @@ export default class IfBlockWrapper extends Wrapper {
if (${name}) {
${dynamic && b`${name}.p(#ctx, #dirty);`}
${
has_transitions &&
has_transitions &&
b`if (${block.renderer.dirty(branch.dependencies)}) {
@transition_in(${name}, 1);
}`
}
}
} else {
${name} = ${branch.block.name}(#ctx);
${name}.c();
@ -603,7 +603,7 @@ export default class IfBlockWrapper extends Wrapper {
// as -1
operator: val.operator,
prefix: val.prefix,
argument: val.argument,
argument: val.argument
};
}
}

@ -111,7 +111,7 @@ export default class InlineComponentWrapper extends Wrapper {
if (variable.reassigned || variable.export_name || variable.is_reactive_dependency) {
this.renderer.component.warn(this.node, {
code: 'reactive-component',
message: `<${name}/> will not be reactive if ${name} changes. Use <svelte:component this={${name}}/> if you want this reactivity.`,
message: `<${name}/> will not be reactive if ${name} changes. Use <svelte:component this={${name}}/> if you want this reactivity.`
});
}
}
@ -160,8 +160,8 @@ export default class InlineComponentWrapper extends Wrapper {
? [
p`$$slots: {
${Array.from(this.slots).map(([name, slot]) => {
return p`${name}: [${slot.block.name}, ${slot.get_context || null}, ${slot.get_changes || null}]`;
})}
return p`${name}: [${slot.block.name}, ${slot.get_context || null}, ${slot.get_changes || null}]`;
})}
}`,
p`$$scope: {
ctx: #ctx
@ -250,8 +250,8 @@ export default class InlineComponentWrapper extends Wrapper {
unchanged
? x`${levels}[${i}]`
: condition
? x`${condition} && ${change_object}`
: change_object
? x`${condition} && ${change_object}`
: change_object
);
});

@ -16,7 +16,7 @@ const associated_events = {
outerHeight: 'resize',
scrollX: 'scroll',
scrollY: 'scroll',
scrollY: 'scroll'
};
const properties = {
@ -29,7 +29,7 @@ const readonly = new Set([
'innerHeight',
'outerWidth',
'outerHeight',
'online',
'online'
]);
export default class WindowWrapper extends Wrapper {

@ -17,9 +17,9 @@ export default function bind_this(component: Component, block: Block, binding: B
const body = b`
${mutation}
${Array.from(dependencies)
.filter(dep => dep[0] !== '$')
.filter(dep => !contextual_dependencies.has(dep))
.map(dep => b`${block.renderer.invalidate(dep)};`)}
.filter(dep => dep[0] !== '$')
.filter(dep => !contextual_dependencies.has(dep))
.map(dep => b`${block.renderer.invalidate(dep)};`)}
`;
if (contextual_dependencies.size) {

@ -34,13 +34,13 @@ export function get_slot_definition(block: Block, scope: TemplateScope, lets: Le
type: 'Property',
kind: 'init',
key: l.name,
value,
value
});
});
const changes_input = {
type: 'ObjectPattern',
properties,
properties
};
const names: Set<string> = new Set();

@ -5,15 +5,15 @@ export function compare_node(a: Node | void, b: Node | void) {
if (!a || !b) return false;
if (a.type !== b.type) return false;
switch (a.type) {
case "Identifier":
return a.name === (b as Identifier).name;
case "MemberExpression":
return (
compare_node(a.object, (b as MemberExpression).object) &&
case "Identifier":
return a.name === (b as Identifier).name;
case "MemberExpression":
return (
compare_node(a.object, (b as MemberExpression).object) &&
compare_node(a.property, (b as MemberExpression).property) &&
a.computed === (b as MemberExpression).computed
);
case 'Literal':
return a.value === (b as Literal).value;
);
case 'Literal':
return a.value === (b as Literal).value;
}
}

@ -31,9 +31,9 @@ export default function flatten_reference(node: Node) {
function to_string(node: Node) {
switch (node.type) {
case 'Literal':
return String(node.value);
case 'Identifier':
return node.name;
case 'Literal':
return String(node.value);
case 'Identifier':
return node.name;
}
}

@ -14,21 +14,21 @@ export default function is_used_as_reference(
/* eslint-disable no-fallthrough */
switch (parent.type) {
// disregard the `foo` in `const foo = bar`
case 'VariableDeclarator':
return node !== parent.id;
// disregard the `foo` in `const foo = bar`
case 'VariableDeclarator':
return node !== parent.id;
// disregard the `foo`, `bar` in `function foo(bar){}`
case 'FunctionDeclaration':
case 'FunctionDeclaration':
// disregard the `foo` in `import { foo } from 'foo'`
case 'ImportSpecifier':
case 'ImportSpecifier':
// disregard the `foo` in `import foo from 'foo'`
case 'ImportDefaultSpecifier':
case 'ImportDefaultSpecifier':
// disregard the `foo` in `import * as foo from 'foo'`
case 'ImportNamespaceSpecifier':
case 'ImportNamespaceSpecifier':
// disregard the `foo` in `export { foo }`
case 'ExportSpecifier':
return false;
default:
return true;
case 'ExportSpecifier':
return false;
default:
return true;
}
}

@ -12,11 +12,11 @@ export function escape(data: string, { only_escape_at_symbol = false } = {}) {
}
const escaped = {
'"': '&quot;',
"'": '&#39;',
'"': '&quot;',
"'": '&#39;',
'&': '&amp;',
'<': '&lt;',
'>': '&gt;',
'>': '&gt;'
};
export function escape_html(html) {

@ -34,7 +34,7 @@ export class Parser {
start: null,
end: null,
type: 'Fragment',
children: [],
children: []
};
this.stack.push(this.html);

@ -57,6 +57,6 @@ export default function read_script(parser: Parser, start: number, attributes: N
start,
end: parser.index,
context: get_context(parser, attributes, start),
content: ast,
content: ast
};
}

@ -14,7 +14,7 @@ export default function read_style(parser: Parser, start: number, attributes: No
try {
ast = parse(styles, {
positions: true,
offset: content_start,
offset: content_start
});
} catch (err) {
if (err.name === 'CssSyntaxError') {

@ -134,9 +134,9 @@ export default function mustache(parser: Parser) {
type: 'IfBlock',
elseif: true,
expression,
children: [],
},
],
children: []
}
]
};
parser.stack.push(block.else.children[0]);
@ -161,7 +161,7 @@ export default function mustache(parser: Parser) {
start: parser.index,
end: null,
type: 'ElseBlock',
children: [],
children: []
};
parser.stack.push(block.else);
@ -260,14 +260,14 @@ export default function mustache(parser: Parser) {
type: 'CatchBlock',
children: [],
skip: true
},
}
} :
{
start,
end: null,
type,
expression,
children: [],
children: []
};
parser.allow_whitespace();
@ -350,7 +350,7 @@ export default function mustache(parser: Parser) {
start,
end: parser.index,
type: 'RawMustacheTag',
expression,
expression
});
} else if (parser.eat('@debug')) {
let identifiers;
@ -394,7 +394,7 @@ export default function mustache(parser: Parser) {
start,
end: parser.index,
type: 'MustacheTag',
expression,
expression
});
}
}

@ -25,16 +25,16 @@ const specials = new Map([
'script',
{
read: read_script,
property: 'js',
},
property: 'js'
}
],
[
'style',
{
read: read_style,
property: 'css',
},
],
property: 'css'
}
]
]);
const SELF = /^svelte:self(?=[\s/>])/;
@ -63,7 +63,7 @@ export default function tag(parser: Parser) {
start,
end: parser.index,
type: 'Comment',
data,
data
});
return;
@ -116,7 +116,7 @@ export default function tag(parser: Parser) {
type,
name,
attributes: [],
children: [],
children: []
};
parser.allow_whitespace();
@ -424,7 +424,7 @@ function read_attribute(parser: Parser, unique_names: Set<string>) {
end,
type: 'Attribute',
name,
value,
value
};
}
@ -491,7 +491,7 @@ function read_sequence(parser: Parser, done: () => boolean): TemplateNode[] {
start: index,
end: parser.index,
type: 'MustacheTag',
expression,
expression
});
current_chunk = {

@ -19,7 +19,7 @@ export default function text(parser: Parser) {
end: parser.index,
type: 'Text',
raw: data,
data: decode_character_references(data),
data: decode_character_references(data)
};
parser.current().children.push(node);

@ -2030,5 +2030,5 @@ export default {
sc: 8827,
wp: 8472,
wr: 8768,
xi: 958,
xi: 958
};

@ -32,7 +32,7 @@ const windows_1252 = [
339,
157,
382,
376,
376
];
const entity_pattern = new RegExp(
@ -124,7 +124,7 @@ const disallowed_contents = new Map([
'address article aside blockquote div dl fieldset footer form h1 h2 h3 h4 h5 h6 header hgroup hr main menu nav ol p pre section table ul'.split(
' '
)
),
)
],
['rt', new Set(['rt', 'rp'])],
['rp', new Set(['rt', 'rp'])],
@ -135,7 +135,7 @@ const disallowed_contents = new Map([
['tfoot', new Set(['tbody'])],
['tr', new Set(['tr', 'tbody'])],
['td', new Set(['td', 'th', 'tr'])],
['th', new Set(['td', 'th', 'tr'])],
['th', new Set(['td', 'th', 'tr'])]
]);
// can this be a child of the parent element, or does it implicitly

@ -2,29 +2,29 @@ import { TemplateNode } from '../../interfaces';
export function to_string(node: TemplateNode) {
switch (node.type) {
case 'IfBlock':
return '{#if} block';
case 'ThenBlock':
return '{:then} block';
case 'ElseBlock':
return '{:else} block';
case 'PendingBlock':
case 'AwaitBlock':
return '{#await} block';
case 'CatchBlock':
return '{:catch} block';
case 'EachBlock':
return '{#each} block';
case 'RawMustacheTag':
return '{@html} block';
case 'DebugTag':
return '{@debug} block';
case 'Element':
case 'InlineComponent':
case 'Slot':
case 'Title':
return `<${node.name}> tag`;
default:
return node.type;
case 'IfBlock':
return '{#if} block';
case 'ThenBlock':
return '{:then} block';
case 'ElseBlock':
return '{:else} block';
case 'PendingBlock':
case 'AwaitBlock':
return '{#await} block';
case 'CatchBlock':
return '{:catch} block';
case 'EachBlock':
return '{#each} block';
case 'RawMustacheTag':
return '{@html} block';
case 'DebugTag':
return '{@debug} block';
case 'Element':
case 'InlineComponent':
case 'Slot':
case 'Title':
return `<${node.name}> tag`;
default:
return node.type;
}
}

@ -49,7 +49,7 @@ async function replace_async(str: string, re: RegExp, func: (...any) => Promise<
({
offset: args[args.length - 2],
length: args[0].length,
replacement: res,
replacement: res
}) as Replacement
)
);

@ -206,7 +206,7 @@ class FuzzySet {
match_score = matches[match_index];
results.push([
match_score / (vector_normal * items[match_index][0]),
items[match_index][1],
items[match_index][1]
]);
}
@ -218,7 +218,7 @@ class FuzzySet {
for (let i = 0; i < end_index; ++i) {
new_results.push([
_distance(results[i][1], normalized_value),
results[i][1],
results[i][1]
]);
}
results = new_results;

@ -105,7 +105,7 @@ export const reserved = new Set([
'void',
'while',
'with',
'yield',
'yield'
]);
const void_element_names = /^(?:area|base|br|col|command|embed|hr|img|input|keygen|link|meta|param|source|track|wbr)$/;

@ -17,7 +17,7 @@ export const valid_namespaces = [
svg,
xlink,
xml,
xmlns,
xmlns
];
export const namespaces: Record<string, string> = { html, mathml, svg, xlink, xml, xmlns };

@ -113,7 +113,7 @@ export class SvelteComponentDev extends SvelteComponent {
hydrate?: boolean;
intro?: boolean;
$$inline?: boolean;
}) {
}) {
if (!options || (!options.target && !options.$$inline)) {
throw new Error(`'target' is a required option`);
}

@ -3,5 +3,5 @@ declare const global: any;
export const globals = (typeof window !== 'undefined'
? window
: typeof globalThis !== 'undefined'
? globalThis
: global) as unknown as typeof globalThis;
? globalThis
: global) as unknown as typeof globalThis;

@ -52,7 +52,7 @@ const subscriber_queue = [];
*/
export function readable<T>(value: T, start: StartStopNotifier<T>): Readable<T> {
return {
subscribe: writable(value, start).subscribe,
subscribe: writable(value, start).subscribe
};
}
@ -184,7 +184,7 @@ export function derived<T>(stores: Stores, fn: Function, initial_value?: T): Rea
},
() => {
pending |= (1 << i);
}),
})
);
inited = true;

@ -12,7 +12,7 @@ export default {
13: .foocc {color: red;}`,
start: { line: 11, column: 2, character: 206 },
end: { line: 11, column: 8, character: 212 },
pos: 206,
pos: 206
},
{
code: 'css-unused-selector',
@ -26,7 +26,7 @@ export default {
14: .foodd {color: red;}`,
start: { line: 12, column: 2, character: 229 },
end: { line: 12, column: 8, character: 235 },
pos: 229,
pos: 229
},
{
code: 'css-unused-selector',
@ -40,7 +40,7 @@ export default {
16: .bb {color: red;}`,
start: { line: 14, column: 2, character: 275 },
end: { line: 14, column: 8, character: 281 },
pos: 275,
pos: 275
},
{
code: 'css-unused-selector',
@ -54,7 +54,7 @@ export default {
22: .ddbar {color: red;}`,
start: { line: 20, column: 2, character: 401 },
end: { line: 20, column: 8, character: 407 },
pos: 401,
pos: 401
},
{
code: 'css-unused-selector',
@ -68,7 +68,7 @@ export default {
23: .fooaabar {color: red;}`,
start: { line: 21, column: 2, character: 424 },
end: { line: 21, column: 8, character: 430 },
pos: 424,
pos: 424
},
{
code: 'css-unused-selector',
@ -82,7 +82,7 @@ export default {
24: .foobbbar {color: red;}`,
start: { line: 22, column: 2, character: 447 },
end: { line: 22, column: 8, character: 453 },
pos: 447,
pos: 447
},
{
code: 'css-unused-selector',
@ -96,7 +96,7 @@ export default {
25: .fooccbar {color: red;}`,
start: { line: 23, column: 2, character: 470 },
end: { line: 23, column: 11, character: 479 },
pos: 470,
pos: 470
},
{
code: 'css-unused-selector',
@ -110,7 +110,7 @@ export default {
26: .fooddbar {color: red;}`,
start: { line: 24, column: 2, character: 496 },
end: { line: 24, column: 11, character: 505 },
pos: 496,
pos: 496
},
{
code: 'css-unused-selector',
@ -124,7 +124,7 @@ export default {
27: .baz {color: red;}`,
start: { line: 25, column: 2, character: 522 },
end: { line: 25, column: 11, character: 531 },
pos: 522,
pos: 522
},
{
code: 'css-unused-selector',
@ -137,7 +137,7 @@ export default {
29: </style>`,
start: { line: 28, column: 2, character: 595 },
end: { line: 28, column: 9, character: 602 },
pos: 595,
},
],
pos: 595
}
]
};

@ -1,3 +1,3 @@
export default {
warnings: [],
warnings: []
};

@ -5,7 +5,7 @@ export default {
end: {
character: 205,
column: 9,
line: 14,
line: 14
},
frame: `
12: .thing.active {color: blue;}
@ -18,8 +18,8 @@ export default {
start: {
character: 198,
column: 2,
line: 14,
},
},
],
line: 14
}
}
]
};

@ -12,7 +12,7 @@ export default {
17: .unused {color: blue;}`,
start: { line: 15, column: 2, character: 261 },
end: { line: 15, column: 15, character: 274 },
pos: 261,
pos: 261
},
{
code: 'css-unused-selector',
@ -25,7 +25,7 @@ export default {
18: </style>`,
start: { line: 17, column: 2, character: 295 },
end: { line: 17, column: 9, character: 302 },
pos: 295,
},
],
pos: 295
}
]
};

@ -153,7 +153,7 @@ export function normalizeHtml(window, html) {
export function setupHtmlEqual() {
const window = env();
assert.htmlEqual = (actual, expected, message) => {
assert.htmlEqual = (actual, expected, message) => { // eslint-disable-line no-import-assign
assert.deepEqual(
normalizeHtml(window, actual),
normalizeHtml(window, expected),

@ -7,7 +7,7 @@ export default {
return {
nullText,
undefinedText,
undefinedText
};
},
@ -17,5 +17,5 @@ export default {
assert.equal(nullText, snapshot.nullText);
assert.equal(undefinedText, snapshot.undefinedText);
},
}
};

@ -3,7 +3,7 @@ export default {
const h1 = target.querySelector('h1');
return {
h1,
h1
};
},

@ -1,6 +1,6 @@
export default {
options: {
dev: true,
loopGuardTimeout: 100,
},
loopGuardTimeout: 100
}
};

@ -2,7 +2,7 @@ export default {
preprocess: [
{
script: ({ content }) => ({ code: content.replace(/one/g, 'two') }),
style: ({ content }) => ({ code: content.replace(/one/g, 'three') }),
},
],
style: ({ content }) => ({ code: content.replace(/one/g, 'three') })
}
]
};

@ -11,7 +11,7 @@ export default {
<div d="4" e="5" foo="1"></div>
<button></button><button></button><button></button><button></button>
`,
async test({ assert, target, window, }) {
async test({ assert, target, window }) {
const [btn1, btn2, btn3, btn4] = target.querySelectorAll('button');
const clickEvent = new window.MouseEvent('click');

@ -13,7 +13,7 @@ export default {
<button></button><button></button><button></button><button></button>
`,
async test({ assert, target, window, }) {
async test({ assert, target, window }) {
const [btn1, btn2, btn3, btn4] = target.querySelectorAll('button');
const clickEvent = new window.MouseEvent('click');

@ -18,5 +18,5 @@ export default {
input.dispatchEvent(event);
assert.ok(blurred);
},
}
};

@ -1,7 +1,7 @@
export default {
props: {
target: 'World!',
display: true,
display: true
},
html: `
@ -16,5 +16,5 @@ export default {
assert.htmlEqual(target.innerHTML, `
<h1>Hello World!</h1>
`);
},
}
};

@ -7,5 +7,5 @@ export default {
await button.dispatchEvent(click);
await Promise.resolve();
assert.htmlEqual(target.innerHTML, `<button>2</button>`);
},
}
};

@ -1,7 +1,7 @@
const value = [];
export default {
props: {
value,
value
},
async test({ assert, component, target, window }) {
@ -32,7 +32,7 @@ export default {
'15',
'16',
'17',
'18',
'18'
]);
},
}
};

@ -33,5 +33,5 @@ export default {
<input>
<p>HE</p>
`);
},
}
};

@ -3,5 +3,5 @@ export default {
test({ assert, component, target }) {
const textarea = target.querySelector('textarea');
assert.ok(textarea.readOnly === false);
},
}
};

@ -3,5 +3,5 @@ export default {
test({ assert, component, target }) {
const textarea = target.querySelector('textarea');
assert.ok(textarea.readOnly);
},
}
};

@ -1,3 +1,3 @@
export default {
html: '<div data-potato=""></div>',
html: '<div data-potato=""></div>'
};

@ -1,5 +1,5 @@
export default {
html: `
<div><div title='foo'>bar</div></div>
`,
`
};

@ -1,3 +1,3 @@
export default {
html: `<div class="false"></div>`,
html: `<div class="false"></div>`
};

@ -1,7 +1,7 @@
export default {
props: {
testName1: "test1",
testName2: "test2",
testName2: "test2"
},
html: `<div class="test1test2"></div>`,

@ -1,7 +1,7 @@
export default {
props: {
testName1: "test1",
testName2: "test2",
testName2: "test2"
},
html: `<div class="test1test2 svelte-x1o6ra"></div>`,

@ -1,7 +1,7 @@
export default {
props: {
testName1: "test1",
testName2: "test2",
testName2: "test2"
},
html: `<div class="test1test2"></div>`,

@ -1,7 +1,7 @@
export default {
props: {
testName1: "test1",
testName2: "test2",
testName2: "test2"
},
html: `<div class="test1test2 svelte-x1o6ra"></div>`,

@ -1,3 +1,3 @@
export default {
html: `<div></div>`,
html: `<div></div>`
};

@ -2,7 +2,7 @@ export default {
skip_if_ssr: true,
props: {
foo: false,
foo: false
},
test({ assert, component, target }) {
@ -15,5 +15,5 @@ export default {
assert.ok(!inputs[0].checked);
assert.ok(inputs[1].checked);
},
}
};

@ -1,3 +1,3 @@
export default {
html: `<div></div>`,
html: `<div></div>`
};

@ -36,5 +36,5 @@ export default {
<editor contenteditable="true">good<span>bye</span></editor>
<p>hello good<span>bye</span></p>
`);
},
}
};

@ -1,6 +1,6 @@
export default {
props: {
name: '<b>world</b>',
name: '<b>world</b>'
},
html: `
@ -34,5 +34,5 @@ export default {
<editor contenteditable="true">good<span>bye</span></editor>
<p>hello good<span>bye</span></p>
`);
},
}
};

@ -30,5 +30,5 @@ export default {
<editor contenteditable="true">goodbye</editor>
<p>hello goodbye</p>
`);
},
}
};

@ -1,6 +1,6 @@
export default {
props: {
name: 'world',
name: 'world'
},
html: `
@ -28,5 +28,5 @@ export default {
<editor contenteditable="true">goodbye</editor>
<p>hello goodbye</p>
`);
},
}
};

@ -2,7 +2,7 @@ export default {
skip_if_ssr: true,
props: {
indeterminate: true,
indeterminate: true
},
html: `
@ -38,5 +38,5 @@ export default {
<p>checked? true</p>
<p>indeterminate? true</p>
`);
},
}
};

@ -3,13 +3,13 @@ export default {
cats: [
{
name: "cat 0",
checked: false,
checked: false
},
{
name: "cat 1",
checked: false,
},
],
checked: false
}
]
},
html: `
@ -22,7 +22,7 @@ export default {
const newCats = cats.slice();
newCats.push({
name: "cat " + cats.length,
checked: false,
checked: false
});
component.cats = newCats;

@ -77,5 +77,5 @@ export default {
assert.equal(inputs[5].checked, false);
assert.equal(inputs[6].checked, false);
assert.equal(inputs[7].checked, true);
},
}
};

@ -7,13 +7,13 @@ const values = [
const selected_array = [
[values[1]],
[],
[values[2]],
[values[2]]
];
export default {
props: {
values,
selected_array,
selected_array
},
html: `

@ -7,13 +7,13 @@ const values = [
const selected_array = [
[values[1]],
[],
[values[2]],
[values[2]]
];
export default {
props: {
values,
selected_array,
selected_array
},
html: `

@ -27,5 +27,5 @@ export default {
component.value = 1;
assert.equal(component.value, 1);
assert.equal(input.value, "1");
},
}
};

@ -1,6 +1,6 @@
export default {
props: {
count: 42,
count: 42
},
html: `
@ -44,5 +44,5 @@ export default {
<input type='number'>
<p>undefined undefined</p>
`);
},
}
};

@ -29,5 +29,5 @@ export default {
<input type=range min=0 max=20>
<p>20 of 20</p>
`);
},
}
};

@ -1,6 +1,6 @@
export default {
props: {
count: 42,
count: 42
},
html: `
@ -34,5 +34,5 @@ export default {
<input type='range'>
<p>number 44</p>
`);
},
}
};

@ -1,6 +1,6 @@
export default {
props: {
count: 42,
count: 42
},
html: `
@ -34,5 +34,5 @@ export default {
<input type='range'>
<p>number 44</p>
`);
},
}
};

@ -1,7 +1,7 @@
export default {
props: {
foo: 'a',
items: ['x'],
items: ['x']
},
html: `
@ -32,5 +32,5 @@ export default {
<div><input><p>b</p></div>
<div><input><p>y</p></div>
`);
},
}
};

@ -121,5 +121,5 @@ export default {
<p>done:one / done:two / remaining:four</p>
`);
},
}
};

@ -1,6 +1,6 @@
export default {
props: {
items: ['one', 'two', 'three'],
items: ['one', 'two', 'three']
},
html: `
@ -65,5 +65,5 @@ export default {
<input><p>five</p>
</div>
`);
},
}
};

@ -1,8 +1,8 @@
export default {
props: {
component: {
name: 'world',
},
name: 'world'
}
},
html: `
@ -36,5 +36,5 @@ export default {
<h1>Hello goodbye!</h1>
<input>
`);
},
}
};

@ -4,8 +4,8 @@ export default {
obj: {
foo: 'a',
bar: 'b',
baz: 'c',
},
baz: 'c'
}
},
html: `
@ -56,5 +56,5 @@ export default {
<input>
<pre>{"foo":"d","bar":"e","baz":"f"}</pre>
`);
},
}
};

@ -2,8 +2,8 @@ export default {
props: {
prop: 'name',
user: {
name: 'alice',
},
name: 'alice'
}
},
html: `
@ -40,5 +40,5 @@ export default {
<input>
<p>hello carol</p>
`);
},
}
};

@ -5,9 +5,9 @@ export default {
{
foo: 'a',
bar: 'b',
baz: 'c',
},
],
baz: 'c'
}
]
},
html: `
@ -58,5 +58,5 @@ export default {
<input>
<pre>{"foo":"d","bar":"e","baz":"f"}</pre>
`);
},
}
};

@ -3,8 +3,8 @@ export default {
items: [
{ description: 'one' },
{ description: 'two' },
{ description: 'three' },
],
{ description: 'three' }
]
},
html: `
@ -45,5 +45,5 @@ export default {
<div><input><p>four</p></div>
<div><input><p>five</p></div>
`);
},
}
};

@ -1,8 +1,8 @@
export default {
props: {
user: {
name: 'alice',
},
name: 'alice'
}
},
html: `
@ -39,5 +39,5 @@ export default {
<input>
<p>hello carol</p>
`);
},
}
};

@ -26,5 +26,5 @@ export default {
component.x = undefined;
assert.equal(input.value, '');
},
}
};

@ -1,6 +1,6 @@
export default {
props: {
name: 'world',
name: 'world'
},
html: `
@ -33,5 +33,5 @@ export default {
<input>
<p>hello goodbye</p>
`);
},
}
};

@ -24,7 +24,7 @@ export default {
`,
props: {
selected: 'b',
selected: 'b'
},
test({ assert, component, target }) {
@ -33,5 +33,5 @@ export default {
assert.equal(select.value, 'b');
assert.ok(options[1].selected);
},
}
};

@ -45,5 +45,5 @@ export default {
</optgroup>
</select>
`);
},
}
};

@ -24,7 +24,7 @@ export default {
`,
props: {
selected: 'one',
selected: 'one'
},
async test({ assert, component, target, window }) {
@ -53,5 +53,5 @@ export default {
`);
component.selected = 'three';
},
}
};

@ -37,5 +37,5 @@ export default {
assert.deepEqual(names, ['world', 'everybody', 'goodbye']);
unsubscribe();
},
}
};

@ -37,5 +37,5 @@ export default {
assert.deepEqual(names, ['world', 'everybody', 'goodbye']);
unsubscribe();
},
}
};

@ -1,6 +1,6 @@
export default {
props: {
value: 'some text',
value: 'some text'
},
html: `
@ -33,5 +33,5 @@ export default {
<textarea></textarea>
<p>goodbye</p>
`);
},
}
};

@ -1,3 +1,3 @@
export default {
error: `potato is not defined`,
error: `potato is not defined`
};

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

Loading…
Cancel
Save