Skip to content

Commit

Permalink
😎 Autofix
Browse files Browse the repository at this point in the history
  • Loading branch information
omrilotan committed Sep 14, 2020
1 parent bc3028b commit a915f31
Show file tree
Hide file tree
Showing 13 changed files with 23 additions and 23 deletions.
4 changes: 2 additions & 2 deletions lib/build/activityPage/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@ const previewImage = require('../../previewImage');
* @param {string} o.template
* @param {object} o.appData
*/
module.exports = async function activityPage({base, dist, key, thing, template, appData}) {
module.exports = async function activityPage({ base, dist, key, thing, template, appData }) {
const preview = await previewImage({
dist: join(base, dist),
filename: key,
text: thing,
});

await writeFile(
join(base, dist, key, ['index', 'html'].join('.')),
join(base, dist, key, [ 'index', 'html' ].join('.')),
phrase(
template,
Object.assign(
Expand Down
2 changes: 1 addition & 1 deletion lib/build/constructAppData/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ module.exports = async function constructAppData({
size: all.length,
tagline,
link: homepage,
preview: [homepage , 'images', '960x640.png'].join('/'),
preview: [ homepage, 'images', '960x640.png' ].join('/'),
cacheKeyVersion,
};

Expand Down
2 changes: 1 addition & 1 deletion lib/build/createBundle/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const phrase = require('paraphrase/double');
*/
module.exports = async function createBundle(input, appData) {
const bundle = await rollup({ input });
const { output: [{ code }] } = await bundle.generate({
const { output: [ { code } ] } = await bundle.generate({
compact: false,
strict: false,
format: 'iife',
Expand Down
10 changes: 5 additions & 5 deletions lib/build/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,8 @@ const destinations = {
sources,
});

await writeFile(destinations.indoors, JSON.stringify(Object.keys({...indoors, ...anywhere})));
await writeFile(destinations.outdoors, JSON.stringify(Object.keys({...outdoors, ...anywhere})));
await writeFile(destinations.indoors, JSON.stringify(Object.keys({ ...indoors, ...anywhere })));
await writeFile(destinations.outdoors, JSON.stringify(Object.keys({ ...outdoors, ...anywhere })));
await writeFile(destinations.all, JSON.stringify(Object.keys(activities)));

await writeFile(destinations.scripts, await createBundle(sources.scripts, appData));
Expand All @@ -87,7 +87,7 @@ const destinations = {
const template = await readFile(sources.template);

Object.entries(activities).forEach(
([key, thing]) => activityPage({base, dist, key, thing, template, appData}),
([ key, thing ]) => activityPage({ base, dist, key, thing, template, appData }),
);

await writeFile(destinations.sitemap, await createSitemap(sources.sitemap, appData));
Expand All @@ -96,8 +96,8 @@ const destinations = {
'Built site with ',
Object.keys(activities).length,
' activities. ',
'(', Object.keys({...indoors, ...anywhere}).length, ' indoors,',
' ', Object.keys({...outdoors, ...anywhere}).length, ' outdoors)',
'(', Object.keys({ ...indoors, ...anywhere }).length, ' indoors,',
' ', Object.keys({ ...outdoors, ...anywhere }).length, ' outdoors)',
'\n',
'Build duration: ',
(Number(process.hrtime.bigint() - start) / 1e6).toFixed(2),
Expand Down
2 changes: 1 addition & 1 deletion lib/previewImage/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ module.exports = async function previewImage({ dist, filename, text }) {

words.forEach(
function (word) {
const testLine = [line, word].filter(Boolean).join(' ');
const testLine = [ line, word ].filter(Boolean).join(' ');
const testLineWidth = textContext.measureText(testLine).width;
if (testLineWidth > MAX_LINE_WIDTH) {

Expand Down
6 changes: 3 additions & 3 deletions lib/serve/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const {
const mime = require('mime-types');
const logger = require('../logger');

const [,, port = '1337'] = process.argv;
const [ ,, port = '1337' ] = process.argv;

module.exports = () => createServer(
async function(request, response) {
Expand All @@ -34,10 +34,10 @@ module.exports = () => createServer(
response.write(file, 'binary');
response.end();

logger.info(['🌐 http://127.0.0.1:', port, url].join(''));
logger.info([ '🌐 http://127.0.0.1:', port, url ].join(''));

} catch (error) {
response.writeHead(500, {'Content-Type': 'text/plain'});
response.writeHead(500, { 'Content-Type': 'text/plain' });
response.write(error.message);
response.end();

Expand Down
4 changes: 2 additions & 2 deletions lib/sortObjectByValue/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
*/
module.exports = obj => Object.fromEntries(Object.entries(obj).sort(sort));

function sort([, one], [, two]) {
const [a, b] = [one, two].map(
function sort([ , one ], [ , two ]) {
const [ a, b ] = [ one, two ].map(
value => value.toLowerCase(),
);

Expand Down
2 changes: 1 addition & 1 deletion scripts/sort/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ const { join } = require('path');
const readLines = require('../../lib/readLines');
const writeFile = require('../../lib/writeFile');

const [ , , ...files] = process.argv;
const [ , , ...files ] = process.argv;

async function sortFile (filename) {
const filepath = join(process.cwd(), filename);
Expand Down
4 changes: 2 additions & 2 deletions src/sames/serviceworker.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

function updateCacheKey(value = '1') {
version = value;
cacheKey = [CACHE_KEY_PREFIX, version].join('-');
cacheKey = [ CACHE_KEY_PREFIX, version ].join('-');
clearOldCache();
}

Expand Down Expand Up @@ -167,7 +167,7 @@
}

function err(error, message) {
error.message = [error.message, message].join(' ');
error.message = [ error.message, message ].join(' ');
setTimeout(() => { throw error; });
}
})();
2 changes: 1 addition & 1 deletion src/scripts/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { addShareButton } from './share/index.js';
/**
* @type {string[]} Existing lists
*/
const LISTS = ['all', 'indoors', 'outdoors'];
const LISTS = [ 'all', 'indoors', 'outdoors' ];

const next = location => fetch(`/${location}.json`)
.then(
Expand Down
2 changes: 1 addition & 1 deletion src/scripts/menu/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { location } from '../location/index.js';
import slider from '../slider/index.js';

export default function menu() {
const template = document.querySelector('template[name="nav"]');
const template = document.querySelector('template[name="nav"]');
if (!template) { return; }

const nav = template.content.querySelector('nav');
Expand Down
2 changes: 1 addition & 1 deletion src/scripts/service-worker/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export default async function registerServiceWorker() {

await navigator.serviceWorker.ready;
setTimeout(
() => navigator.serviceWorker.controller && navigator.serviceWorker.controller.postMessage({action: 'updateCacheKey', value: cacheKey()}),
() => navigator.serviceWorker.controller && navigator.serviceWorker.controller.postMessage({ action: 'updateCacheKey', value: cacheKey() }),
1000
);
}
Expand Down
4 changes: 2 additions & 2 deletions src/scripts/suggest.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ import random from './random/index.js';
const [ textarea ] = target;
const { value } = textarea;
if (!value) { return textarea.focus(); }
[target, textarea].forEach(e => e.setAttribute('disabled', 'disabled'));
[ target, textarea ].forEach(e => e.setAttribute('disabled', 'disabled'));
send(value).then(thanks).catch(
() => [target, textarea].forEach(e => e.removeAttribute('disabled'))
() => [ target, textarea ].forEach(e => e.removeAttribute('disabled'))
);
}
);
Expand Down

0 comments on commit a915f31

Please sign in to comment.