Skip to content

Commit

Permalink
Fix and prevent inconsistent indentation with ESLint
Browse files Browse the repository at this point in the history
  • Loading branch information
Siilwyn committed Feb 5, 2019
1 parent aef4191 commit e3e92bd
Show file tree
Hide file tree
Showing 4 changed files with 53 additions and 55 deletions.
13 changes: 5 additions & 8 deletions docs/.vuepress/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,11 @@ const {
} = require('sanctuary');

const getDocumentLocation = pipe([
match(/paper\.dropbox\.com\/doc\/.+--\S{26}-(\w{21})/),
chain(match => match.groups[0]),
chain(urlId => find
(doc => doc.id === urlId)
(documentsMetaData)
),
map(compose (path.parse) (prop('location'))),
]);
match(/paper\.dropbox\.com\/doc\/.+--\S{26}-(\w{21})/),
chain(match => match.groups[0]),
chain(urlId => find (doc => doc.id === urlId) (documentsMetaData)),
map(compose (path.parse) (prop('location'))),
]);

module.exports = {
title: 'Playbook',
Expand Down
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,9 @@
"ecmaVersion": 2018
},
"rules": {
"semi": 1,
"no-unexpected-multiline": 0
"indent": ["warn", 2],
"no-unexpected-multiline": "off",
"semi": "warn"
}
},
"repository": {
Expand Down
80 changes: 40 additions & 40 deletions src/fetch-papers.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,44 +48,44 @@ const {
} = main(dropboxPaperApi);

fetchAllDocIds()
.then(docIds => docIds.reduce((docs, id) => ({
...docs,
[id]: fetchDocFolders(id),
}), {}))
.then(promiseAllProps)
.then(justs)
.then(filter (pipe([
map(prop('id')),
elem(process.env.DROPBOX_PAPER_DIRECTORY_ID),
])))
.then(Object.entries)
.then(docs => docs.map(([ id, folders ]) => promiseAllProps({
id,
folders,
directory: path.join('docs', foldersToPath(folders.slice(1))),
metaData: fetchDocMetaData(id),
})))
.then(Promise.all.bind(Promise))
.then(reject(isDeletedDoc))
.then(docs => docs.map(doc =>
promiseAllProps({
.then(docIds => docIds.reduce((docs, id) => ({
...docs,
[id]: fetchDocFolders(id),
}), {}))
.then(promiseAllProps)
.then(justs)
.then(filter (pipe([
map(prop('id')),
elem(process.env.DROPBOX_PAPER_DIRECTORY_ID),
])))
.then(Object.entries)
.then(docs => docs.map(([ id, folders ]) => promiseAllProps({
id,
folders,
directory: path.join('docs', foldersToPath(folders.slice(1))),
metaData: fetchDocMetaData(id),
})))
.then(Promise.all.bind(Promise))
.then(reject(isDeletedDoc))
.then(docs => docs.map(doc =>
promiseAllProps({
...doc,
content: fetchDocContent(doc.id),
})
.then(doc => ({
...doc,
content: fetchDocContent(doc.id),
})
.then(doc => ({
...doc,
location: path.join(
doc.directory,
`${kebabCaseIt(doc.content.metaData.title)}.md`
),
}))
))
.then(Promise.all.bind(Promise))
.then(docs => docs.forEach(doc => {
mkdir(doc.directory, { recursive: true })
.then(() => writeFile(
doc.location,
`${jsonToFrontmatter(doc.metaData)}${doc.content.body}`
));
writeFile('docs/dump.json', JSON.stringify(docs));
}));
location: path.join(
doc.directory,
`${kebabCaseIt(doc.content.metaData.title)}.md`
),
}))
))
.then(Promise.all.bind(Promise))
.then(docs => docs.forEach(doc => {
mkdir(doc.directory, { recursive: true })
.then(() => writeFile(
doc.location,
`${jsonToFrontmatter(doc.metaData)}${doc.content.body}`
));
writeFile('docs/dump.json', JSON.stringify(docs));
}));
10 changes: 5 additions & 5 deletions src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ const fetchPaginatedDocIds = apiFetch => previousDocIds => ({
}) =>
hasMore
? apiFetch('/docs/list/continue', {
body: { cursor },
})
body: { cursor },
})
.then(fetchPaginatedDocIds (apiFetch) (previousDocIds.concat(docIds)))
: previousDocIds.concat(docIds);

Expand Down Expand Up @@ -66,9 +66,9 @@ const fetchDocContent = apiFetch => docId => apiFetch(
}));

const fetchDocMetaData = apiFetch => docId => apiFetch(
'/docs/get_metadata',
{ body: { doc_id: docId } }
)
'/docs/get_metadata',
{ body: { doc_id: docId } }
)
.then(({ body }) => body);

module.exports = apiFetch => ({
Expand Down

0 comments on commit e3e92bd

Please sign in to comment.