Skip to content

Commit

Permalink
some linting and tidying
Browse files Browse the repository at this point in the history
  • Loading branch information
Conduitry committed May 5, 2019
1 parent c4c2143 commit 43f82af
Show file tree
Hide file tree
Showing 20 changed files with 94 additions and 251 deletions.
36 changes: 18 additions & 18 deletions easing.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -6,39 +6,39 @@ Distributed under MIT License https://github.com/mattdesl/eases/blob/master/LICE
export { identity as linear } from './internal';

export function backInOut(t) {
var s = 1.70158 * 1.525;
const s = 1.70158 * 1.525;
if ((t *= 2) < 1) return 0.5 * (t * t * ((s + 1) * t - s));
return 0.5 * ((t -= 2) * t * ((s + 1) * t + s) + 2);
}

export function backIn(t) {
var s = 1.70158;
const s = 1.70158;
return t * t * ((s + 1) * t - s);
}

export function backOut(t) {
var s = 1.70158;
const s = 1.70158;
return --t * t * ((s + 1) * t + s) + 1;
}

export function bounceOut(t) {
var a = 4.0 / 11.0;
var b = 8.0 / 11.0;
var c = 9.0 / 10.0;
const a = 4.0 / 11.0;
const b = 8.0 / 11.0;
const c = 9.0 / 10.0;

var ca = 4356.0 / 361.0;
var cb = 35442.0 / 1805.0;
var cc = 16061.0 / 1805.0;
const ca = 4356.0 / 361.0;
const cb = 35442.0 / 1805.0;
const cc = 16061.0 / 1805.0;

var t2 = t * t;
const t2 = t * t;

return t < a
? 7.5625 * t2
: t < b
? 9.075 * t2 - 9.9 * t + 3.4
: t < c
? ca * t2 - cb * t + cc
: 10.8 * t * t - 20.52 * t + 10.72;
? 9.075 * t2 - 9.9 * t + 3.4
: t < c
? ca * t2 - cb * t + cc
: 10.8 * t * t - 20.52 * t + 10.72;
}

export function bounceInOut(t) {
Expand Down Expand Up @@ -73,7 +73,7 @@ export function cubicIn(t) {
}

export function cubicOut(t) {
var f = t - 1.0;
const f = t - 1.0;
return f * f * f + 1.0;
}

Expand Down Expand Up @@ -102,8 +102,8 @@ export function expoInOut(t) {
return t === 0.0 || t === 1.0
? t
: t < 0.5
? +0.5 * Math.pow(2.0, 20.0 * t - 10.0)
: -0.5 * Math.pow(2.0, 10.0 - t * 20.0) + 1.0;
? +0.5 * Math.pow(2.0, 20.0 * t - 10.0)
: -0.5 * Math.pow(2.0, 10.0 - t * 20.0) + 1.0;
}

export function expoIn(t) {
Expand Down Expand Up @@ -161,7 +161,7 @@ export function sineInOut(t) {
}

export function sineIn(t) {
var v = Math.cos(t * Math.PI * 0.5);
const v = Math.cos(t * Math.PI * 0.5);
if (Math.abs(v) < 1e-14) return 1;
else return 1 - v;
}
Expand Down
2 changes: 1 addition & 1 deletion register.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ const fs = require('fs');
const path = require('path');
const { compile } = require('./compiler.js');

let extensions = ['.svelte', '.html'];
const extensions = ['.svelte', '.html'];
let compileOptions = {};

function capitalise(name) {
Expand Down
2 changes: 1 addition & 1 deletion site/.eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
],
"plugins": ["svelte3"],
"parserOptions": {
"ecmaVersion": 8,
"ecmaVersion": 9,
"sourceType": "module"
},
"settings": {
Expand Down
6 changes: 0 additions & 6 deletions site/rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,6 @@ export default {
module: true
})
],

// temporary, pending Rollup 1.0
experimentalCodeSplitting: true
},

server: {
Expand All @@ -81,9 +78,6 @@ export default {
require('module').builtinModules || Object.keys(process.binding('natives'))
)
],

// temporary, pending Rollup 1.0
experimentalCodeSplitting: true
},

serviceworker: {
Expand Down
8 changes: 0 additions & 8 deletions site/src/components/PreloadingIndicator.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,7 @@
let p = 0;
let visible = false;

const sleep = ms => new Promise(f => setTimeout(f, ms));

onMount(() => {
let running = true;

function next() {
visible = true;
p += 0.1;
Expand All @@ -18,10 +14,6 @@
}

setTimeout(next, 250);

return () => {
running = false;
};
});
</script>

Expand Down
2 changes: 1 addition & 1 deletion site/src/components/Repl/ReplWidget.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@

if (gist) {
fetch(`repl/${gist}.json`).then(r => r.json()).then(data => {
const { id, description, files } = data;
const { description, files } = data;

name = description;

Expand Down
2 changes: 1 addition & 1 deletion site/src/routes/_error.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
// we don't want to use <svelte:window bind:online> here,
// because we only care about the online state when
// the page first loads
let online = typeof navigator !== 'undefined'
const online = typeof navigator !== 'undefined'
? navigator.onLine
: true;
</script>
Expand Down
140 changes: 0 additions & 140 deletions site/src/routes/docs/_GuideContents.svelte

This file was deleted.

2 changes: 1 addition & 1 deletion site/src/routes/docs/index.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
</script>

<script>
import { Docs } from '@sveltejs/site-kit'
import { Docs } from '@sveltejs/site-kit';

export let sections;
</script>
Expand Down
32 changes: 16 additions & 16 deletions site/src/routes/examples/index.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
let offset = 1;
let repl;
let isLoading = false;
let cache = {};
const cache = {};

$: title = title_by_slug[active_slug] || '';
$: first_slug = sections[0].examples[0].slug;
Expand All @@ -50,21 +50,21 @@
} else {
isLoading = true;
fetch(`examples/${active_slug}.json`)
.then(async response => {
if (response.ok) {
const {files} = await response.json();
return process_example(files);
}
})
.then(components => {
cache[active_slug] = components;
repl.set({components});
offset = 1;
isLoading = false;
})
.catch(function(error) {
isLoading = false;
});
.then(async response => {
if (response.ok) {
const {files} = await response.json();
return process_example(files);
}
})
.then(components => {
cache[active_slug] = components;
repl.set({components});
offset = 1;
isLoading = false;
})
.catch(() => {
isLoading = false;
});
}
}

Expand Down
2 changes: 1 addition & 1 deletion site/src/routes/index.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
</script>

<style>
/* darken text for accesibility */
/* darken text for accessibility */
/* TODO does this belong elsewhere? */
:global(.back-light) {
--text: hsl(36, 3%, 44%);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,6 @@
try {
// Send all files back to API
// ~> Any missing files are considered deleted!
const files = {};
const { components } = repl.toJSON();

const r = await fetch(`repl/${gist.uid}.json`, {
Expand All @@ -127,7 +126,7 @@
throw new Error(`Received an HTTP ${r.status} response: ${error}`);
}

const result = await r.json();
await r.json();

justSaved = true;
await wait(600);
Expand Down Expand Up @@ -155,7 +154,7 @@
const pkg = JSON.parse(files[idx].data);
const deps = {};
imports.forEach(mod => {
const match = /^(@[^\/]+\/)?[^@\/]+/.exec(mod);
const match = /^(@[^/]+\/)?[^@/]+/.exec(mod);
deps[match[0]] = 'latest';
});
pkg.dependencies = deps;
Expand Down
1 change: 0 additions & 1 deletion site/src/routes/repl/[id]/index.json.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import send from '@polka/send';
import redirect from '@polka/redirect';
import body from '../_utils/body.js';
import * as httpie from 'httpie';
import { query, find } from '../../../utils/db';
Expand Down
Loading

0 comments on commit 43f82af

Please sign in to comment.