Skip to content

Commit d8872f4

Browse files
authored
Merge pull request #2153 from StoDevX/tabs
Switch Prettier to using tabs instead of spaces 😈
2 parents f4d7970 + 8f113af commit d8872f4

File tree

271 files changed

+13412
-13411
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

271 files changed

+13412
-13411
lines changed

dangerfile.js

Lines changed: 555 additions & 555 deletions
Large diffs are not rendered by default.

data/news-styles.css

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,36 @@
11
body {
2-
font-family: -apple-system, Roboto, sans-serif;
3-
font-size: 16px;
4-
margin: 0;
5-
padding: 1em;
6-
word-wrap: break-word;
2+
font-family: -apple-system, Roboto, sans-serif;
3+
font-size: 16px;
4+
margin: 0;
5+
padding: 1em;
6+
word-wrap: break-word;
77
}
88
div,
99
figure {
10-
width: auto !important;
10+
width: auto !important;
1111
}
1212
img {
13-
max-width: 100%;
14-
height: auto;
15-
display: block;
16-
margin: 12px auto;
13+
max-width: 100%;
14+
height: auto;
15+
display: block;
16+
margin: 12px auto;
1717
}
1818
p {
19-
line-height: 1.2em;
20-
margin-bottom: 0.25em;
19+
line-height: 1.2em;
20+
margin-bottom: 0.25em;
2121
}
2222
iframe {
23-
max-width: 100%;
23+
max-width: 100%;
2424
}
2525
.aao-header {
26-
border-bottom: solid 2px #eaeaea;
27-
margin: 0 0 1em;
28-
padding-bottom: 1em;
29-
font-weight: bold;
30-
text-align: center;
26+
border-bottom: solid 2px #eaeaea;
27+
margin: 0 0 1em;
28+
padding-bottom: 1em;
29+
font-weight: bold;
30+
text-align: center;
3131
}
3232
.aao-header h1 {
33-
line-height: 1.1em;
34-
font-size: 1.5em;
35-
margin-bottom: 0;
33+
line-height: 1.1em;
34+
font-size: 1.5em;
35+
margin-bottom: 0;
3636
}

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@
5252
"preset": "react-native"
5353
},
5454
"prettier": {
55+
"useTabs": true,
5556
"singleQuote": true,
5657
"trailingComma": "all",
5758
"bracketSpacing": false,

scripts/bundle-data-dir.js

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -7,40 +7,40 @@ const natsort = require('string-natural-compare')
77

88
// run cli
99
if (process.mainModule === module) {
10-
const args = process.argv.slice(2)
11-
const fromDir = args[0]
12-
const toFile = args[1] || '-'
13-
if (!fromDir || fromDir === '-h' || fromDir === '--help') {
14-
console.error('usage: node bundle-data-dir.js <from-dir> [to-file]')
15-
process.exit(1)
16-
}
17-
console.log(process.mainModule)
18-
bundleDataDir({fromDir, toFile})
10+
const args = process.argv.slice(2)
11+
const fromDir = args[0]
12+
const toFile = args[1] || '-'
13+
if (!fromDir || fromDir === '-h' || fromDir === '--help') {
14+
console.error('usage: node bundle-data-dir.js <from-dir> [to-file]')
15+
process.exit(1)
16+
}
17+
console.log(process.mainModule)
18+
bundleDataDir({fromDir, toFile})
1919
}
2020

2121
// exported module
2222
module.exports = bundleDataDir
2323
function bundleDataDir({fromDir, toFile}) {
24-
const files = fs
25-
.readdirSync(fromDir)
26-
.filter(junk.not)
27-
.map(f => path.join(fromDir, f))
28-
if (!files.length) {
29-
return
30-
}
24+
const files = fs
25+
.readdirSync(fromDir)
26+
.filter(junk.not)
27+
.map(f => path.join(fromDir, f))
28+
if (!files.length) {
29+
return
30+
}
3131

32-
// sort the files so that 9 comes before 10
33-
files.sort(natsort)
32+
// sort the files so that 9 comes before 10
33+
files.sort(natsort)
3434

35-
const loaded = files.map(fpath => {
36-
console.log(fpath)
37-
let contents = fs.readFileSync(fpath, 'utf-8')
38-
return yaml.safeLoad(contents)
39-
})
40-
const dated = {data: loaded}
41-
const output = JSON.stringify(dated) + '\n'
35+
const loaded = files.map(fpath => {
36+
console.log(fpath)
37+
let contents = fs.readFileSync(fpath, 'utf-8')
38+
return yaml.safeLoad(contents)
39+
})
40+
const dated = {data: loaded}
41+
const output = JSON.stringify(dated) + '\n'
4242

43-
const outStream =
44-
toFile === '-' ? process.stdout : fs.createWriteStream(toFile)
45-
outStream.write(output)
43+
const outStream =
44+
toFile === '-' ? process.stdout : fs.createWriteStream(toFile)
45+
outStream.write(output)
4646
}

scripts/bundle-data.js

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -10,50 +10,50 @@ const isDir = pth => fs.statSync(pth).isDirectory()
1010
const isFile = pth => fs.statSync(pth).isFile()
1111

1212
const readDir = pth =>
13-
fs
14-
.readdirSync(pth)
15-
.filter(junk.not)
16-
.filter(entry => !entry.startsWith('_'))
13+
fs
14+
.readdirSync(pth)
15+
.filter(junk.not)
16+
.filter(entry => !entry.startsWith('_'))
1717

1818
const findDirsIn = pth =>
19-
readDir(pth).filter(entry => isDir(path.join(pth, entry)))
19+
readDir(pth).filter(entry => isDir(path.join(pth, entry)))
2020

2121
const findFilesIn = pth =>
22-
readDir(pth).filter(entry => isFile(path.join(pth, entry)))
22+
readDir(pth).filter(entry => isFile(path.join(pth, entry)))
2323

2424
const args = process.argv.slice(2)
2525
const fromDir = args[0]
2626
const toDir = args[1]
2727
if (!fromDir || !toDir || fromDir === '-h' || fromDir === '--help') {
28-
console.error('usage: node bundle-data.js <from-dir> <to-dir>')
29-
process.exit(1)
28+
console.error('usage: node bundle-data.js <from-dir> <to-dir>')
29+
process.exit(1)
3030
}
3131

3232
mkdirp.sync(toDir)
3333

3434
// Bundle each directory of yaml files into one big json file
3535
const dirs = findDirsIn(fromDir)
3636
dirs.forEach(dirname => {
37-
const input = path.join(fromDir, dirname)
38-
const output = path.join(toDir, dirname) + '.json'
39-
console.log(`bundle-data-dir ${input} ${output}`)
40-
console.time(`bundle-data-dir ${input} ${output}`)
41-
bundleDataDir({fromDir: input, toFile: output})
42-
console.timeEnd(`bundle-data-dir ${input} ${output}`)
37+
const input = path.join(fromDir, dirname)
38+
const output = path.join(toDir, dirname) + '.json'
39+
console.log(`bundle-data-dir ${input} ${output}`)
40+
console.time(`bundle-data-dir ${input} ${output}`)
41+
bundleDataDir({fromDir: input, toFile: output})
42+
console.timeEnd(`bundle-data-dir ${input} ${output}`)
4343
})
4444

4545
// Convert these files into JSON equivalents
4646
const files = findFilesIn(fromDir)
4747
files.forEach(file => {
48-
// Get the absolute paths to the input and output files
49-
const input = path.join(fromDir, file)
50-
const output = path.join(toDir, file).replace(/\.(.*)$/, '.json')
51-
console.log(`convert-data-file ${input} ${output}`)
52-
console.time(`convert-data-file ${input} ${output}`)
53-
convertDataFile({fromFile: input, toFile: output})
54-
if (file.endsWith('.css')) {
55-
const dest = output.replace(/\.json/, '.css')
56-
convertDataFile({fromFile: input, toFile: dest, toFileType: 'css'})
57-
}
58-
console.timeEnd(`convert-data-file ${input} ${output}`)
48+
// Get the absolute paths to the input and output files
49+
const input = path.join(fromDir, file)
50+
const output = path.join(toDir, file).replace(/\.(.*)$/, '.json')
51+
console.log(`convert-data-file ${input} ${output}`)
52+
console.time(`convert-data-file ${input} ${output}`)
53+
convertDataFile({fromFile: input, toFile: output})
54+
if (file.endsWith('.css')) {
55+
const dest = output.replace(/\.json/, '.css')
56+
convertDataFile({fromFile: input, toFile: dest, toFileType: 'css'})
57+
}
58+
console.timeEnd(`convert-data-file ${input} ${output}`)
5959
})

scripts/convert-data-file.js

Lines changed: 40 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -4,61 +4,61 @@ const yaml = require('js-yaml')
44

55
// run cli
66
if (process.mainModule === module) {
7-
const args = process.argv.slice(2)
8-
const fromFile = args[0]
9-
const toFile = args[1] || '-'
10-
if (!fromFile || fromFile === '-h' || fromFile === '--help') {
11-
console.error(
12-
'usage: node convert-data-file.js <from-file.{md,yaml,css}> [to-file]',
13-
)
14-
process.exit(1)
15-
}
16-
convertDataFile({fromFile, toFile})
7+
const args = process.argv.slice(2)
8+
const fromFile = args[0]
9+
const toFile = args[1] || '-'
10+
if (!fromFile || fromFile === '-h' || fromFile === '--help') {
11+
console.error(
12+
'usage: node convert-data-file.js <from-file.{md,yaml,css}> [to-file]',
13+
)
14+
process.exit(1)
15+
}
16+
convertDataFile({fromFile, toFile})
1717
}
1818

1919
// exported module
2020
module.exports = convertDataFile
2121
function convertDataFile({fromFile, toFile, toFileType = 'json'}) {
22-
const contents = fs.readFileSync(fromFile, 'utf-8')
23-
let output = contents
22+
const contents = fs.readFileSync(fromFile, 'utf-8')
23+
let output = contents
2424

25-
const fileType = fromFile.split('.').slice(-1)[0]
26-
switch (fileType) {
27-
case 'md':
28-
output = processMarkdown(contents)
29-
break
30-
case 'yaml':
31-
output = processYaml(contents)
32-
break
33-
case 'css':
34-
if (toFileType === 'css') {
35-
output = contents
36-
} else {
37-
output = processCSS(contents)
38-
}
39-
break
40-
default:
41-
throw new Error(
42-
`unexpected filetype "${fileType}; expected "md", "yaml", or "css"`,
43-
)
44-
}
25+
const fileType = fromFile.split('.').slice(-1)[0]
26+
switch (fileType) {
27+
case 'md':
28+
output = processMarkdown(contents)
29+
break
30+
case 'yaml':
31+
output = processYaml(contents)
32+
break
33+
case 'css':
34+
if (toFileType === 'css') {
35+
output = contents
36+
} else {
37+
output = processCSS(contents)
38+
}
39+
break
40+
default:
41+
throw new Error(
42+
`unexpected filetype "${fileType}; expected "md", "yaml", or "css"`,
43+
)
44+
}
4545

46-
output = output + '\n'
46+
output = output + '\n'
4747

48-
const outStream =
49-
toFile === '-' ? process.stdout : fs.createWriteStream(toFile)
50-
outStream.write(output)
48+
const outStream =
49+
toFile === '-' ? process.stdout : fs.createWriteStream(toFile)
50+
outStream.write(output)
5151
}
5252

5353
function processYaml(fileContents) {
54-
let loaded = yaml.safeLoad(fileContents)
55-
return JSON.stringify({data: loaded})
54+
let loaded = yaml.safeLoad(fileContents)
55+
return JSON.stringify({data: loaded})
5656
}
5757

5858
function processMarkdown(fileContents) {
59-
return JSON.stringify({text: fileContents})
59+
return JSON.stringify({text: fileContents})
6060
}
6161

6262
function processCSS(fileContents) {
63-
return JSON.stringify({css: fileContents})
63+
return JSON.stringify({css: fileContents})
6464
}

scripts/make-icons.js

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2,40 +2,40 @@ const childSpawn = require('child_process').spawnSync
22
const source = 'icon-source.png'
33

44
const spawn = (cmd, ...args) => {
5-
console.log(cmd, ...args)
6-
childSpawn(cmd, args)
5+
console.log(cmd, ...args)
6+
childSpawn(cmd, args)
77
}
88

99
const resize = (img, width, toFile) =>
10-
spawn('convert', img, '-resize', `${width}x${width}`, toFile)
10+
spawn('convert', img, '-resize', `${width}x${width}`, toFile)
1111

1212
// iOS app icons
1313
const iosSizes = [[29, 1], [29, 2], [29, 3], [40, 2], [40, 3], [60, 2], [60, 3]]
1414
for (const [width, density] of iosSizes) {
15-
resize(
16-
source,
17-
width * density,
18-
`icons/ios/AppIcon.appiconset/Icon-${width}@${density}x.png`,
19-
)
15+
resize(
16+
source,
17+
width * density,
18+
`icons/ios/AppIcon.appiconset/Icon-${width}@${density}x.png`,
19+
)
2020
}
2121

2222
// iTunes icons
2323
const itunes = [[512, 1], [1024, 2], [1536, 3]]
2424
for (const [width, density] of itunes) {
25-
resize(source, width, `icons/ios/iTunesArtwork@${density}x.png`)
25+
resize(source, width, `icons/ios/iTunesArtwork@${density}x.png`)
2626
}
2727

2828
// Android app icons
2929
const androidSizes = [
30-
['ldpi', 36],
31-
['mdpi', 48],
32-
['hdpi', 72],
33-
['xhdpi', 96],
34-
['xxhdpi', 144],
35-
['xxxhdpi', 192],
30+
['ldpi', 36],
31+
['mdpi', 48],
32+
['hdpi', 72],
33+
['xhdpi', 96],
34+
['xxhdpi', 144],
35+
['xxxhdpi', 192],
3636
]
3737
for (const [label, size] of androidSizes) {
38-
resize(source, size, `icons/android/mipmap-${label}/ic_launcher.png`)
38+
resize(source, size, `icons/android/mipmap-${label}/ic_launcher.png`)
3939
}
4040

4141
resize(source, '512', 'icons/android/playstore-icon.png')

0 commit comments

Comments
 (0)