1
0
mirror of https://github.com/BoostIo/Boostnote synced 2025-12-14 10:16:26 +00:00

fixed eslint error & integrated with prettier as well as formatted the whole codebase (#3450)

This commit is contained in:
Nguyen Viet Hung
2020-02-05 13:28:27 +13:00
committed by GitHub
parent 051ce9e208
commit 592aca1539
186 changed files with 9233 additions and 5565 deletions

View File

@@ -3,7 +3,7 @@ const path = require('path')
const CSON = require('@rokt33r/season')
const migrateFromV6Storage = require('./migrateFromV6Storage')
function resolveStorageData (storageCache) {
function resolveStorageData(storageCache) {
const storage = {
key: storageCache.key,
name: storageCache.name,
@@ -15,13 +15,14 @@ function resolveStorageData (storageCache) {
const boostnoteJSONPath = path.join(storageCache.path, 'boostnote.json')
try {
const jsonData = CSON.readFileSync(boostnoteJSONPath)
if (!_.isArray(jsonData.folders)) throw new Error('folders should be an array.')
if (!_.isArray(jsonData.folders))
throw new Error('folders should be an array.')
storage.folders = jsonData.folders
storage.version = jsonData.version
} catch (err) {
if (err.code === 'ENOENT') {
console.warn('boostnote.json file doesn\'t exist the given path')
CSON.writeFileSync(boostnoteJSONPath, {folders: [], version: '1.0'})
console.warn("boostnote.json file doesn't exist the given path")
CSON.writeFileSync(boostnoteJSONPath, { folders: [], version: '1.0' })
} else {
console.error(err)
}
@@ -34,8 +35,7 @@ function resolveStorageData (storageCache) {
return Promise.resolve(storage)
}
return migrateFromV6Storage(storage.path)
.then(() => storage)
return migrateFromV6Storage(storage.path).then(() => storage)
}
module.exports = resolveStorageData