diff --git a/package-lock.json b/package-lock.json index e04cc22175..5d4aa46575 100644 --- a/package-lock.json +++ b/package-lock.json @@ -144,8 +144,8 @@ } }, "@sveltejs/eslint-config": { - "version": "github:sveltejs/eslint-config#54081d752d199dba97db9f578665c87f18469da3", - "from": "github:sveltejs/eslint-config#v5.5.0", + "version": "github:sveltejs/eslint-config#cca8177349dd5a02b19a5865afc4a7066921409a", + "from": "github:sveltejs/eslint-config#v5.6.0", "dev": true }, "@tootallnate/once": { diff --git a/package.json b/package.json index a0f0b9e455..75e5c9e21f 100644 --- a/package.json +++ b/package.json @@ -63,7 +63,7 @@ "@rollup/plugin-sucrase": "^3.0.0", "@rollup/plugin-typescript": "^2.0.1", "@rollup/plugin-virtual": "^2.0.0", - "@sveltejs/eslint-config": "github:sveltejs/eslint-config#v5.5.0", + "@sveltejs/eslint-config": "github:sveltejs/eslint-config#v5.6.0", "@types/mocha": "^7.0.0", "@types/node": "^8.10.53", "@typescript-eslint/eslint-plugin": "^3.0.2", diff --git a/src/compiler/compile/Component.ts b/src/compiler/compile/Component.ts index d2542c9830..6e7e41f385 100644 --- a/src/compiler/compile/Component.ts +++ b/src/compiler/compile/Component.ts @@ -267,17 +267,13 @@ export default class Component { this.helpers.set(name, alias); node.name = alias.name; } - } - - else if (node.name[0] !== '#' && !is_valid(node.name)) { + } else if (node.name[0] !== '#' && !is_valid(node.name)) { // this hack allows x`foo.${bar}` where bar could be invalid const literal: Literal = { type: 'Literal', value: node.name }; if (parent.type === 'Property' && key === 'key') { parent.key = literal; - } - - else if (parent.type === 'MemberExpression' && key === 'property') { + } else if (parent.type === 'MemberExpression' && key === 'property') { parent.property = literal; parent.computed = true; } diff --git a/src/compiler/compile/css/Selector.ts b/src/compiler/compile/css/Selector.ts index e20aa43fb6..e910f4333c 100644 --- a/src/compiler/compile/css/Selector.ts +++ b/src/compiler/compile/css/Selector.ts @@ -248,25 +248,17 @@ function block_might_apply_to_node(block: Block, node: Element): BlockAppliesToN if (selector.type === 'ClassSelector') { if (!attribute_matches(node, 'class', name, '~=', false) && !node.classes.some(c => c.name === name)) return BlockAppliesToNode.NotPossible; - } - - else if (selector.type === 'IdSelector') { + } else if (selector.type === 'IdSelector') { if (!attribute_matches(node, 'id', name, '=', false)) return BlockAppliesToNode.NotPossible; - } - - else if (selector.type === 'AttributeSelector') { + } else if (selector.type === 'AttributeSelector') { if ( !(whitelist_attribute_selector.has(node.name.toLowerCase()) && whitelist_attribute_selector.get(node.name.toLowerCase()).has(selector.name.name.toLowerCase())) && !attribute_matches(node, selector.name.name, selector.value && unquote(selector.value), selector.matcher, selector.flags)) { return BlockAppliesToNode.NotPossible; } - } - - else if (selector.type === 'TypeSelector') { + } else if (selector.type === 'TypeSelector') { if (node.name.toLowerCase() !== name.toLowerCase() && name !== '*') return BlockAppliesToNode.NotPossible; - } - - else { + } else { return BlockAppliesToNode.UnknownSelectorType; } } diff --git a/src/compiler/compile/css/Stylesheet.ts b/src/compiler/compile/css/Stylesheet.ts index 5547c6eb0c..b0dab12b19 100644 --- a/src/compiler/compile/css/Stylesheet.ts +++ b/src/compiler/compile/css/Stylesheet.ts @@ -167,9 +167,7 @@ class Atrule { this.children.forEach(child => { child.apply(node); }); - } - - else if (is_keyframes_node(this.node)) { + } else if (is_keyframes_node(this.node)) { this.children.forEach((rule: Rule) => { rule.selectors.forEach(selector => { selector.used = true; diff --git a/src/compiler/compile/css/gather_possible_values.ts b/src/compiler/compile/css/gather_possible_values.ts index 4390e23c8d..e5560e4f87 100644 --- a/src/compiler/compile/css/gather_possible_values.ts +++ b/src/compiler/compile/css/gather_possible_values.ts @@ -5,14 +5,10 @@ export const UNKNOWN = {}; export function gather_possible_values(node: Node, set: Set) { if (node.type === 'Literal') { set.add(node.value); - } - - else if (node.type === 'ConditionalExpression') { + } else if (node.type === 'ConditionalExpression') { gather_possible_values(node.consequent, set); gather_possible_values(node.alternate, set); - } - - else { + } else { set.add(UNKNOWN); } } diff --git a/src/compiler/compile/nodes/Attribute.ts b/src/compiler/compile/nodes/Attribute.ts index 97d2fd7b2e..3844c750a2 100644 --- a/src/compiler/compile/nodes/Attribute.ts +++ b/src/compiler/compile/nodes/Attribute.ts @@ -38,9 +38,7 @@ export default class Attribute extends Node { this.chunks = null; this.is_static = false; - } - - else { + } else { this.name = info.name; this.is_true = info.value === true; this.is_static = true; diff --git a/src/compiler/compile/nodes/Body.ts b/src/compiler/compile/nodes/Body.ts index 74c63b1f57..f004b90e24 100644 --- a/src/compiler/compile/nodes/Body.ts +++ b/src/compiler/compile/nodes/Body.ts @@ -13,9 +13,7 @@ export default class Body extends Node { info.attributes.forEach(node => { if (node.type === 'EventHandler') { this.handlers.push(new EventHandler(component, this, scope, node)); - } - - else { + } else { // TODO there shouldn't be anything else here... } }); diff --git a/src/compiler/compile/nodes/Window.ts b/src/compiler/compile/nodes/Window.ts index d0ad313c6f..fef003c6e4 100644 --- a/src/compiler/compile/nodes/Window.ts +++ b/src/compiler/compile/nodes/Window.ts @@ -28,9 +28,7 @@ export default class Window extends Node { info.attributes.forEach(node => { if (node.type === 'EventHandler') { this.handlers.push(new EventHandler(component, this, scope, node)); - } - - else if (node.type === 'Binding') { + } else if (node.type === 'Binding') { if (node.expression.type !== 'Identifier') { const { parts } = flatten_reference(node.expression); @@ -64,13 +62,9 @@ export default class Window extends Node { } this.bindings.push(new Binding(component, this, scope, node)); - } - - else if (node.type === 'Action') { + } else if (node.type === 'Action') { this.actions.push(new Action(component, this, scope, node)); - } - - else { + } else { // TODO there shouldn't be anything else here... } }); diff --git a/src/compiler/compile/nodes/shared/Expression.ts b/src/compiler/compile/nodes/shared/Expression.ts index ef134f4359..1fc23830bd 100644 --- a/src/compiler/compile/nodes/shared/Expression.ts +++ b/src/compiler/compile/nodes/shared/Expression.ts @@ -261,17 +261,13 @@ export default class Expression { hoistable: true, referenced: true }); - } - - else if (contextual_dependencies.size === 0) { + } else if (contextual_dependencies.size === 0) { // function can be hoisted inside the component init component.partly_hoisted.push(declaration); block.renderer.add_to_context(id.name); this.replace(block.renderer.reference(id)); - } - - else { + } else { // we need a combo block/init recipe const deps = Array.from(contextual_dependencies); const function_expression = node as FunctionExpression; diff --git a/src/compiler/compile/render_dom/wrappers/Element/StyleAttribute.ts b/src/compiler/compile/render_dom/wrappers/Element/StyleAttribute.ts index 06ead11a3c..27157f46e4 100644 --- a/src/compiler/compile/render_dom/wrappers/Element/StyleAttribute.ts +++ b/src/compiler/compile/render_dom/wrappers/Element/StyleAttribute.ts @@ -164,9 +164,7 @@ function get_style_value(chunks: Array) { break; } - } - - else { + } else { value.push(chunk); } } diff --git a/src/compiler/compile/render_dom/wrappers/Element/index.ts b/src/compiler/compile/render_dom/wrappers/Element/index.ts index c6b88357a8..d273326a20 100644 --- a/src/compiler/compile/render_dom/wrappers/Element/index.ts +++ b/src/compiler/compile/render_dom/wrappers/Element/index.ts @@ -745,9 +745,7 @@ export default class ElementWrapper extends Wrapper { } block.chunks.destroy.push(b`if (detaching && ${name}) ${name}.end();`); - } - - else { + } else { const intro_name = intro && block.get_unique_name(`${this.var.name}_intro`); const outro_name = outro && block.get_unique_name(`${this.var.name}_outro`); @@ -920,22 +918,16 @@ function to_html(wrappers: Array deltas.get(old_key)) { diff --git a/src/runtime/internal/transitions.ts b/src/runtime/internal/transitions.ts index 343a8c82e4..21d67a12ba 100644 --- a/src/runtime/internal/transitions.ts +++ b/src/runtime/internal/transitions.ts @@ -318,9 +318,7 @@ export function create_bidirectional_transition(node: Element & ElementCSSInline } running_program = null; - } - - else if (now >= running_program.start) { + } else if (now >= running_program.start) { const p = now - running_program.start; t = running_program.a + running_program.d * easing(p / running_program.duration); tick(t, 1 - t);