From 37b1a20c170e864794e705223ec551896d8eef63 Mon Sep 17 00:00:00 2001
From: Ben McCann <322311+benmccann@users.noreply.github.com>
Date: Tue, 26 Jan 2021 20:36:12 -0800
Subject: [PATCH] Add spaces next to infix operators (#5902)
---
src/compiler/compile/render_dom/index.ts | 4 ++--
src/compiler/compile/render_dom/wrappers/Element/index.ts | 2 +-
src/compiler/compile/render_dom/wrappers/Slot.ts | 2 +-
src/compiler/parse/state/mustache.ts | 4 ++--
src/runtime/motion/spring.ts | 4 ++--
src/runtime/transition/index.ts | 2 +-
test/sourcemaps/samples/source-map-generator/_config.js | 2 +-
test/sourcemaps/samples/sourcemap-basename/_config.js | 2 +-
8 files changed, 11 insertions(+), 11 deletions(-)
diff --git a/src/compiler/compile/render_dom/index.ts b/src/compiler/compile/render_dom/index.ts
index 3b1f873ba5..8e7deb7a78 100644
--- a/src/compiler/compile/render_dom/index.ts
+++ b/src/compiler/compile/render_dom/index.ts
@@ -485,7 +485,7 @@ export default function dom(
${css.code && b`this.shadowRoot.innerHTML = \`\`;`}
- @init(this, { target: this.shadowRoot, props: ${init_props} }, ${definition}, ${has_create_fragment ? 'create_fragment': 'null'}, ${not_equal}, ${prop_indexes}, ${dirty});
+ @init(this, { target: this.shadowRoot, props: ${init_props} }, ${definition}, ${has_create_fragment ? 'create_fragment' : 'null'}, ${not_equal}, ${prop_indexes}, ${dirty});
${dev_props_check}
@@ -537,7 +537,7 @@ export default function dom(
constructor(options) {
super(${options.dev && 'options'});
${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 });`}
${dev_props_check}
diff --git a/src/compiler/compile/render_dom/wrappers/Element/index.ts b/src/compiler/compile/render_dom/wrappers/Element/index.ts
index 269edcfca8..73c75502e3 100644
--- a/src/compiler/compile/render_dom/wrappers/Element/index.ts
+++ b/src/compiler/compile/render_dom/wrappers/Element/index.ts
@@ -321,7 +321,7 @@ export default class ElementWrapper extends Wrapper {
literal.quasis.push(state.quasi);
block.chunks.create.push(
- b`${node}.${this.can_use_innerhtml ? 'innerHTML': 'textContent'} = ${literal};`
+ b`${node}.${this.can_use_innerhtml ? 'innerHTML' : 'textContent'} = ${literal};`
);
}
} else {
diff --git a/src/compiler/compile/render_dom/wrappers/Slot.ts b/src/compiler/compile/render_dom/wrappers/Slot.ts
index 699363a809..d343cfb201 100644
--- a/src/compiler/compile/render_dom/wrappers/Slot.ts
+++ b/src/compiler/compile/render_dom/wrappers/Slot.ts
@@ -173,7 +173,7 @@ export default class SlotWrapper extends Wrapper {
if (${slot}.p && ${renderer.dirty(dynamic_dependencies)}) {
@update_slot_spread(${slot}, ${slot_definition}, #ctx, ${renderer.reference('$$scope')}, #dirty, ${get_slot_changes_fn}, ${get_slot_spread_changes_fn}, ${get_slot_context_fn});
}
- `: b`
+ ` : b`
if (${slot}.p && ${renderer.dirty(dynamic_dependencies)}) {
@update_slot(${slot}, ${slot_definition}, #ctx, ${renderer.reference('$$scope')}, #dirty, ${get_slot_changes_fn}, ${get_slot_context_fn});
}
diff --git a/src/compiler/parse/state/mustache.ts b/src/compiler/parse/state/mustache.ts
index 33b589948d..ccb2d1d487 100644
--- a/src/compiler/parse/state/mustache.ts
+++ b/src/compiler/parse/state/mustache.ts
@@ -196,7 +196,7 @@ export default function mustache(parser: Parser) {
if (!parser.eat('}')) {
parser.require_whitespace();
- await_block[is_then ? 'value': 'error'] = read_context(parser);
+ await_block[is_then ? 'value' : 'error'] = read_context(parser);
parser.allow_whitespace();
parser.eat('}', true);
}
@@ -204,7 +204,7 @@ export default function mustache(parser: Parser) {
const new_block: TemplateNode = {
start,
end: null,
- type: is_then ? 'ThenBlock': 'CatchBlock',
+ type: is_then ? 'ThenBlock' : 'CatchBlock',
children: [],
skip: false
};
diff --git a/src/runtime/motion/spring.ts b/src/runtime/motion/spring.ts
index 8d2056256c..ff625ec41f 100644
--- a/src/runtime/motion/spring.ts
+++ b/src/runtime/motion/spring.ts
@@ -14,7 +14,7 @@ function tick_spring(ctx: TickContext, last_value: T, current_value: T, ta
// @ts-ignore
const delta = target_value - current_value;
// @ts-ignore
- const velocity = (current_value - last_value) / (ctx.dt||1/60); // guard div by 0
+ const velocity = (current_value - last_value) / (ctx.dt || 1 / 60); // guard div by 0
const spring = ctx.opts.stiffness * delta;
const damper = ctx.opts.damping * velocity;
const acceleration = (spring - damper) * ctx.inv_mass;
@@ -80,7 +80,7 @@ export function spring(value?: T, opts: SpringOpts = {}): Spring {
let inv_mass_recovery_rate = 0;
let cancel_task = false;
- function set(new_value: T, opts: SpringUpdateOpts={}): Promise {
+ function set(new_value: T, opts: SpringUpdateOpts = {}): Promise {
target_value = new_value;
const token = current_token = {};
diff --git a/src/runtime/transition/index.ts b/src/runtime/transition/index.ts
index 7e879cb941..246f3b14fb 100644
--- a/src/runtime/transition/index.ts
+++ b/src/runtime/transition/index.ts
@@ -237,7 +237,7 @@ export function crossfade({ fallback, ...defaults }: CrossfadeParams & {
css: (t, u) => `
opacity: ${t * opacity};
transform-origin: top left;
- transform: ${transform} translate(${u * dx}px,${u * dy}px) scale(${t + (1-t) * dw}, ${t + (1-t) * dh});
+ transform: ${transform} translate(${u * dx}px,${u * dy}px) scale(${t + (1 - t) * dw}, ${t + (1 - t) * dh});
`
};
}
diff --git a/test/sourcemaps/samples/source-map-generator/_config.js b/test/sourcemaps/samples/source-map-generator/_config.js
index fefb776f33..3cd15d9dda 100644
--- a/test/sourcemaps/samples/source-map-generator/_config.js
+++ b/test/sourcemaps/samples/source-map-generator/_config.js
@@ -6,7 +6,7 @@ export default {
style: async ({ content, filename }) => {
const src = new MagicString(content);
const idx = content.indexOf('baritone');
- src.overwrite(idx, idx+'baritone'.length, 'bar');
+ src.overwrite(idx, idx + 'baritone'.length, 'bar');
const map = SourceMapGenerator.fromSourceMap(
await new SourceMapConsumer(
diff --git a/test/sourcemaps/samples/sourcemap-basename/_config.js b/test/sourcemaps/samples/sourcemap-basename/_config.js
index d50dd882a6..33146af7e7 100644
--- a/test/sourcemaps/samples/sourcemap-basename/_config.js
+++ b/test/sourcemaps/samples/sourcemap-basename/_config.js
@@ -19,7 +19,7 @@ export default {
preprocess: [
{
style: ({ content, filename }) => {
- const external =`/* Filename from preprocess: ${filename} */` + external_code;
+ const external = `/* Filename from preprocess: ${filename} */` + external_code;
return magic_string_bundle([
{ code: external, filename: external_relative_filename },
{ code: content, filename }