diff --git a/.eslintrc.json b/.eslintrc.json index 48c686c3ab..c821993c40 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -21,7 +21,10 @@ "prefer-const": [2, { "destructuring": "all" }], "arrow-spacing": 2, "no-inner-declarations": 0, - "@typescript-eslint/indent": ["warn", "tab", { "SwitchCase": 1 }], + "@typescript-eslint/indent": ["error", "tab", { + "SwitchCase": 1, + "ignoredNodes": ["TemplateLiteral"] + }], "@typescript-eslint/camelcase": "off", "@typescript-eslint/no-use-before-define": "off", "@typescript-eslint/array-type": ["error", "array-simple"], diff --git a/src/compiler/compile/render-dom/Block.ts b/src/compiler/compile/render-dom/Block.ts index 95c90ef101..0c585c5bf0 100644 --- a/src/compiler/compile/render-dom/Block.ts +++ b/src/compiler/compile/render-dom/Block.ts @@ -357,6 +357,7 @@ export default class Block { `); } + /* eslint-disable @typescript-eslint/indent,indent */ return deindent` ${this.variables.size > 0 && `var ${Array.from(this.variables.keys()) @@ -374,6 +375,7 @@ export default class Block { `.replace(/(#+)(\w*)/g, (_match: string, sigil: string, name: string) => { return sigil === '#' ? this.alias(name) : sigil.slice(1) + name; }); + /* eslint-enable @typescript-eslint/indent,indent */ } render_listeners(chunk: string = '') { diff --git a/src/compiler/compile/render-dom/index.ts b/src/compiler/compile/render-dom/index.ts index 143e553998..bdba98639a 100644 --- a/src/compiler/compile/render-dom/index.ts +++ b/src/compiler/compile/render-dom/index.ts @@ -74,6 +74,7 @@ export default function dom( const props = component.vars.filter(variable => !variable.module && variable.export_name); const writable_props = props.filter(variable => variable.writable); + /* eslint-disable @typescript-eslint/indent,indent */ const set = (uses_props || writable_props.length > 0 || component.slots.size > 0) ? deindent` ${$$props} => { @@ -86,6 +87,7 @@ export default function dom( } ` : null; + /* eslint-enable @typescript-eslint/indent,indent */ const body = []; @@ -369,7 +371,7 @@ export default function dom( }) .map(n => `$$dirty.${n}`).join(' || '); - let snippet = `[✂${d.node.body.start}-${d.node.end}✂]`; + let snippet = `[✂${d.node.body.start}-${d.node.end}✂]`; if (condition) snippet = `if (${condition}) { ${snippet} }`; if (condition || uses_props) { diff --git a/src/compiler/compile/render-dom/wrappers/IfBlock.ts b/src/compiler/compile/render-dom/wrappers/IfBlock.ts index 1b47c84a22..a6406d86c1 100644 --- a/src/compiler/compile/render-dom/wrappers/IfBlock.ts +++ b/src/compiler/compile/render-dom/wrappers/IfBlock.ts @@ -210,6 +210,7 @@ export default class IfBlockWrapper extends Wrapper { const current_block_type = block.get_unique_name(`current_block_type`); const current_block_type_and = has_else ? '' : `${current_block_type} && `; + /* eslint-disable @typescript-eslint/indent,indent */ block.builders.init.add_block(deindent` function ${select_block_type}(ctx) { ${this.branches @@ -217,6 +218,7 @@ export default class IfBlockWrapper extends Wrapper { .join('\n')} } `); + /* eslint-enable @typescript-eslint/indent,indent */ block.builders.init.add_block(deindent` var ${current_block_type} = ${select_block_type}(ctx); @@ -283,6 +285,7 @@ export default class IfBlockWrapper extends Wrapper { block.add_variable(current_block_type_index); block.add_variable(name); + /* eslint-disable @typescript-eslint/indent,indent */ block.builders.init.add_block(deindent` var ${if_block_creators} = [ ${this.branches.map(branch => branch.block.name).join(',\n')} @@ -297,6 +300,7 @@ export default class IfBlockWrapper extends Wrapper { ${!has_else && `return -1;`} } `); + /* eslint-enable @typescript-eslint/indent,indent */ if (has_else) { block.builders.init.add_block(deindent` @@ -429,7 +433,7 @@ export default class IfBlockWrapper extends Wrapper { } `; - // no `p()` here — we don't want to update outroing nodes, + // no `p()` here — we don't want to update outroing nodes, // as that will typically result in glitching const exit = branch.block.has_outro_method ? deindent` diff --git a/src/compiler/compile/render-dom/wrappers/InlineComponent/index.ts b/src/compiler/compile/render-dom/wrappers/InlineComponent/index.ts index 220a1328e7..290f5b9543 100644 --- a/src/compiler/compile/render-dom/wrappers/InlineComponent/index.ts +++ b/src/compiler/compile/render-dom/wrappers/InlineComponent/index.ts @@ -232,11 +232,13 @@ export default class InlineComponentWrapper extends Wrapper { .filter((attribute: Attribute) => attribute.is_dynamic) .forEach((attribute: Attribute) => { if (attribute.dependencies.size > 0) { + /* eslint-disable @typescript-eslint/indent,indent */ updates.push(deindent` if (${[...attribute.dependencies] .map(dependency => `changed.${dependency}`) .join(' || ')}) ${name_changes}${quote_prop_if_necessary(attribute.name)} = ${attribute.get_value(block)}; `); + /* eslint-enable @typescript-eslint/indent,indent */ } }); } @@ -262,7 +264,7 @@ export default class InlineComponentWrapper extends Wrapper { let object; if (binding.is_contextual && binding.expression.node.type === 'Identifier') { - // bind:x={y} — we can't just do `y = x`, we need to + // bind:x={y} — we can't just do `y = x`, we need to // to `array[index] = x; const { name } = binding.expression.node; const { snippet } = block.bindings.get(name); @@ -316,7 +318,7 @@ export default class InlineComponentWrapper extends Wrapper { let lhs = component.source.slice(binding.expression.node.start, binding.expression.node.end).trim(); if (binding.is_contextual && binding.expression.node.type === 'Identifier') { - // bind:x={y} — we can't just do `y = x`, we need to + // bind:x={y} — we can't just do `y = x`, we need to // to `array[index] = x; const { name } = binding.expression.node; const { object, property, snippet } = block.bindings.get(name);