Skip to content

Commit 8a72e59

Browse files
committed
Code Formatting
1 parent b93262b commit 8a72e59

12 files changed

+413
-352
lines changed

.xo-config.cjs

+61
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
module.exports = {
2+
extensions: ["js"],
3+
ignores: [
4+
'./dist', './ios',
5+
],
6+
rules: {
7+
semi: ["error", "never"],
8+
indent: ["error", 2, {
9+
SwitchCase: 1
10+
}],
11+
quotes: ["error", "single", {
12+
allowTemplateLiterals: true
13+
}],
14+
curly: ["error", "multi-line"],
15+
"object-curly-spacing": ["error", "always"],
16+
"arrow-parens": ["error", "always"],
17+
"capitalized-comments": "off",
18+
"import/extensions": [
19+
'error',
20+
"never",
21+
{
22+
'json': "always",
23+
'css': 'always',
24+
'scss': 'always',
25+
},
26+
],
27+
"node/file-extension-in-import": [
28+
"error",
29+
"never",
30+
{
31+
"tryExtensions": [".js", ".json"],
32+
'.json': "always",
33+
'.css': 'always',
34+
'.scss': 'always',
35+
},
36+
],
37+
"import/no-unassigned-import": [
38+
'error',
39+
{
40+
"allow": ["**/*.css", "**/*.scss"],
41+
},
42+
],
43+
// 'no-multiple-empty-lines': ['error', { max: 2, maxEOF: 0 }],
44+
// 'padding-line-between-statements': ['error', { blankLine: 'any', prev: '*', next: '*' }],
45+
// 'no-unused-vars': ['warn', { caughtErrors: 'none', varsIgnorePattern: '^error$', args: 'none' }],
46+
// 'require-await': 'error',
47+
// 'no-return-await': 'off',
48+
"unicorn/filename-case": [
49+
"error",
50+
{
51+
cases: {
52+
camelCase: true,
53+
pascalCase: true,
54+
},
55+
ignore: ["\\d*-[\\w\\d]*.js"],
56+
},
57+
],
58+
// 'unicorn/prefer-optional-catch-binding': 'off',
59+
// 'unicorn/no-process-exit': 'off',
60+
},
61+
};

_data/gear.js

+27-27
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,35 @@
1-
const CSVToJSON = require('csvtojson');
1+
const CSVToJSON = require('csvtojson')
22

33
const compare = (a, b) => {
4-
a.Priority = (a.Priority) ? Number.parseInt(a.Priority, 10) : a.Priority = 9000;
5-
b.Priority = (b.Priority) ? Number.parseInt(b.Priority, 10) : b.Priority = 9000;
6-
if (a.Priority > b.Priority) {
7-
return 1;
8-
}
4+
a.Priority = (a.Priority) ? Number.parseInt(a.Priority, 10) : a.Priority = 9000
5+
b.Priority = (b.Priority) ? Number.parseInt(b.Priority, 10) : b.Priority = 9000
6+
if (a.Priority > b.Priority) {
7+
return 1
8+
}
99

10-
if (a.Priority < b.Priority) {
11-
return -1;
12-
}
10+
if (a.Priority < b.Priority) {
11+
return -1
12+
}
1313

14-
if (a.Title > b.Title) {
15-
return 1;
16-
}
14+
if (a.Title > b.Title) {
15+
return 1
16+
}
1717

18-
if (a.Title < b.Title) {
19-
return -1;
20-
}
18+
if (a.Title < b.Title) {
19+
return -1
20+
}
2121

22-
return 0;
23-
};
22+
return 0
23+
}
2424

2525
module.exports = function () {
26-
return new Promise(async (resolve, reject) => {
27-
try {
28-
const gears = await CSVToJSON().fromFile('_data/gear.csv');
29-
const gearsSorted = gears.sort(compare);
30-
return resolve(gearsSorted);
31-
} catch (error) {
32-
console.error('error while loading gears CSV file:', error);
33-
}
34-
});
35-
};
26+
return new Promise(async (resolve) => {
27+
try {
28+
const gears = await CSVToJSON().fromFile('_data/gear.csv')
29+
const gearsSorted = gears.sort(compare)
30+
return resolve(gearsSorted)
31+
} catch (error) {
32+
console.error('error while loading gears CSV file:', error)
33+
}
34+
})
35+
}

_data/git.js

+8-8
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
const git = require('async-git');
1+
const git = require('async-git')
22

33
module.exports = async function () {
4-
return {
5-
commitsha: await git.short,
6-
curbranch: await git.branch,
7-
commitdate: await git.date,
8-
origin: await git.origin,
9-
};
10-
};
4+
return {
5+
commitsha: await git.short,
6+
curbranch: await git.branch,
7+
commitdate: await git.date,
8+
origin: await git.origin,
9+
}
10+
}

_data/global.js

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
const moment = require('moment');
1+
const moment = require('moment')
22

33
module.exports = {
4-
dateReadable: date => moment(date).format('MMMM Do, YYYY'),
5-
dateReadableShort: date => moment(date).format('Do MMM YYYY'),
6-
dateHtml: date => moment(date).toISOString(),
7-
};
4+
dateReadable: (date) => moment(date).format('MMMM Do, YYYY'),
5+
dateReadableShort: (date) => moment(date).format('Do MMM YYYY'),
6+
dateHtml: (date) => moment(date).toISOString(),
7+
}

_data/layout.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
module.exports = 'page.pug';
1+
module.exports = 'page.pug'

_data/meta.js

+18-18
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
1-
const process = require('process');
2-
const path = require('path');
1+
const process = require('process')
2+
const path = require('path')
33

44
module.exports = {
5-
siteTitle: 'Chris Spiegl — Content Creator, World Traveler, and Consultant',
6-
siteName: 'ChrisSpiegl.com',
7-
url: 'https://ChrisSpiegl.com',
8-
imageResizer: (width, height, origin) => {
9-
const ext = path.extname(origin);
10-
const base = path.basename(origin, ext);
11-
const dir = path.dirname(origin);
12-
const imagePath = path.join(dir, `${base}-${width}w${ext}`);
13-
return imagePath;
14-
},
15-
authorEmail: 'chris@chrisspiegl.com',
16-
build: {
17-
env: process.env.ELEVENTY_ENV || process.env.NODE_ENV || 'development',
18-
timestamp: new Date(),
19-
},
20-
};
5+
siteTitle: 'Chris Spiegl — Content Creator, World Traveler, and Consultant',
6+
siteName: 'ChrisSpiegl.com',
7+
url: 'https://ChrisSpiegl.com',
8+
imageResizer(width, height, origin) {
9+
const ext = path.extname(origin)
10+
const base = path.basename(origin, ext)
11+
const dir = path.dirname(origin)
12+
const imagePath = path.join(dir, `${base}-${width}w${ext}`)
13+
return imagePath
14+
},
15+
authorEmail: 'chris@chrisspiegl.com',
16+
build: {
17+
env: process.env.ELEVENTY_ENV || process.env.NODE_ENV || 'development',
18+
timestamp: new Date(),
19+
},
20+
}

_data/nomadlist.js

+23-23
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,28 @@
1-
const axios = require('axios');
1+
const axios = require('axios')
22

33
module.exports = async function () {
4-
const url = 'https://nomadlist.com/@ChrisSpiegl';
5-
try {
6-
const {data} = await axios.get(`${url}?format=json`);
4+
const url = 'https://nomadlist.com/@ChrisSpiegl'
5+
try {
6+
const { data } = await axios.get(`${url}?format=json`)
77

8-
data.location.now.string = data.location.now.city === null ? 'Unknown' : `${data.location.now.city}, ${data.location.now.country}`;
9-
data.location.next.string = data.location.next.city === null ? 'Unknown' : `${data.location.next.city}, ${data.location.next.country}`;
8+
data.location.now.string = data.location.now.city === null ? 'Unknown' : `${data.location.now.city}, ${data.location.now.country}`
9+
data.location.next.string = data.location.next.city === null ? 'Unknown' : `${data.location.next.city}, ${data.location.next.country}`
1010

11-
const returnValue = {
12-
data,
13-
url,
14-
now: data.location.now,
15-
next: data.location.next,
16-
};
17-
return returnValue;
18-
} catch (error) {
19-
console.log(error);
20-
}
11+
const returnValue = {
12+
data,
13+
url,
14+
now: data.location.now,
15+
next: data.location.next,
16+
}
17+
return returnValue
18+
} catch (error) {
19+
console.log(error)
20+
}
2121

22-
return {
23-
data: {},
24-
url,
25-
now: 'Unknown',
26-
next: 'Unknown',
27-
};
28-
};
22+
return {
23+
data: {},
24+
url,
25+
now: 'Unknown',
26+
next: 'Unknown',
27+
}
28+
}

_data/qrcode.js

+40-40
Original file line numberDiff line numberDiff line change
@@ -1,45 +1,45 @@
1-
const QRCode = require('qrcode');
2-
const mkdirp = require('mkdirp');
1+
const QRCode = require('qrcode')
2+
const mkdirp = require('mkdirp')
33

44
module.exports = async () => {
5-
const coins = {
6-
btc: {
7-
name: 'Bitcoin',
8-
addr: 'bc1qcnjmuyr3a0ysejqnzwtu0dylsyt3w7hggwa49x',
9-
link: 'bitcoin:bc1qcnjmuyr3a0ysejqnzwtu0dylsyt3w7hggwa49x?label=Donation&message=Thank%20You%21',
10-
},
11-
ltc: {
12-
name: 'Litecoin',
13-
addr: 'ltc1q2d3gqjn9y5evh0uvfesgqnqxwguwky78448aw7',
14-
link: 'litecoin:ltc1q2d3gqjn9y5evh0uvfesgqnqxwguwky78448aw7?label=Donation&message=Thank%20You%21',
15-
},
16-
doge: {
17-
name: 'Dogecoin',
18-
addr: 'DRZVXSnWM9BEL9FFLdE2qmUDBpbWLQC4Cp',
19-
link: 'DRZVXSnWM9BEL9FFLdE2qmUDBpbWLQC4Cp?label=Donation&message=Thank%20You%21',
20-
},
21-
xlm: {
22-
name: 'Stellar Lumens',
23-
addr: 'GADRZ6G2BXHUJGJQUNR4L6KK3RUPLT3AIV2CP6JQ37ICODJP4FMW7T5T',
24-
link: 'GADRZ6G2BXHUJGJQUNR4L6KK3RUPLT3AIV2CP6JQ37ICODJP4FMW7T5T?label=Donation&message=Thank%20You%21',
25-
},
26-
bat: {
27-
name: 'Basic Attention Token',
28-
addr: '0x5696005CA7F60F86F69bdBd897987c410D34398F',
29-
link: '0x5696005CA7F60F86F69bdBd897987c410D34398F?label=Donation&message=Thank%20You%21',
30-
},
31-
};
5+
const coins = {
6+
btc: {
7+
name: 'Bitcoin',
8+
addr: 'bc1qcnjmuyr3a0ysejqnzwtu0dylsyt3w7hggwa49x',
9+
link: 'bitcoin:bc1qcnjmuyr3a0ysejqnzwtu0dylsyt3w7hggwa49x?label=Donation&message=Thank%20You%21',
10+
},
11+
ltc: {
12+
name: 'Litecoin',
13+
addr: 'ltc1q2d3gqjn9y5evh0uvfesgqnqxwguwky78448aw7',
14+
link: 'litecoin:ltc1q2d3gqjn9y5evh0uvfesgqnqxwguwky78448aw7?label=Donation&message=Thank%20You%21',
15+
},
16+
doge: {
17+
name: 'Dogecoin',
18+
addr: 'DRZVXSnWM9BEL9FFLdE2qmUDBpbWLQC4Cp',
19+
link: 'DRZVXSnWM9BEL9FFLdE2qmUDBpbWLQC4Cp?label=Donation&message=Thank%20You%21',
20+
},
21+
xlm: {
22+
name: 'Stellar Lumens',
23+
addr: 'GADRZ6G2BXHUJGJQUNR4L6KK3RUPLT3AIV2CP6JQ37ICODJP4FMW7T5T',
24+
link: 'GADRZ6G2BXHUJGJQUNR4L6KK3RUPLT3AIV2CP6JQ37ICODJP4FMW7T5T?label=Donation&message=Thank%20You%21',
25+
},
26+
bat: {
27+
name: 'Basic Attention Token',
28+
addr: '0x5696005CA7F60F86F69bdBd897987c410D34398F',
29+
link: '0x5696005CA7F60F86F69bdBd897987c410D34398F?label=Donation&message=Thank%20You%21',
30+
},
31+
}
3232

33-
for (const coin of Object.keys(coins)) {
34-
const exportPath = '_site';
35-
const folderPath = '/assets/images/qrcodes';
36-
mkdirp.sync(exportPath + folderPath);
37-
coins[coin].filepath = `${folderPath}/${coin}-${coins[coin].addr}.svg`;
38-
await QRCode.toFile(`${exportPath}${coins[coin].filepath}`, coins[coin].link);
39-
coins[coin].rendered = `!!! ${coins[coin].name} — $${coin.toUpperCase()}: \`${coins[coin].addr}\`
33+
for (const coin of Object.keys(coins)) {
34+
const exportPath = '_site'
35+
const folderPath = '/assets/images/qrcodes'
36+
mkdirp.sync(exportPath + folderPath)
37+
coins[coin].filepath = `${folderPath}/${coin}-${coins[coin].addr}.svg`
38+
await QRCode.toFile(`${exportPath}${coins[coin].filepath}`, coins[coin].link)
39+
coins[coin].rendered = `!!! ${coins[coin].name} — $${coin.toUpperCase()}: \`${coins[coin].addr}\`
4040
![QR Code for $${coin.toUpperCase()} address](${coins[coin].filepath})
41-
!!!`;
42-
}
41+
!!!`
42+
}
4343

44-
return coins;
45-
};
44+
return coins
45+
}

0 commit comments

Comments
 (0)