diff --git a/.eslintrc.json b/.eslintrc.json new file mode 100644 index 0000000..fa2a1b1 --- /dev/null +++ b/.eslintrc.json @@ -0,0 +1,24 @@ +{ + "root": true, + "env": { + "es2022": true, + "browser": true + }, + "parserOptions": { + "ecmaVersion": 2022, + "sourceType": "module" + }, + "extends": "eslint:recommended", + "rules": { + "semi": ["error", "never"], + "indent": ["warn", 4, { "flatTernaryExpressions": true, "SwitchCase": 1 }], + "quotes": ["warn", "single"], + "comma-dangle": ["warn", "always-multiline"], + "no-trailing-spaces": "warn", + "no-unused-vars": "warn", + "no-console": ["warn", { "allow": ["debug", "warn", "error", "assert"] }], + "no-constant-condition": ["error", { "checkLoops": false }], + "no-empty": ["error", { "allowEmptyCatch": true }] + }, + "reportUnusedDisableDirectives": true +} diff --git a/fb2.js b/fb2.js index a08b42b..323e37a 100644 --- a/fb2.js +++ b/fb2.js @@ -248,7 +248,7 @@ export const makeFB2 = async blob => { modified: getDate($('document-info date')), description: annotation ? converter.convert(annotation, { annotation: ['div', SECTION] }).innerHTML : null, - subject: $$('title-info genre').map(getElementText) + subject: $$('title-info genre').map(getElementText), } book.getCover = () => fetch(getImageSrc($('coverpage image'))) .then(res => res.blob()) diff --git a/paginator.js b/paginator.js index 9b29e3e..9ff9b63 100644 --- a/paginator.js +++ b/paginator.js @@ -124,8 +124,8 @@ const getBackground = doc => { const bodyStyle = doc.defaultView.getComputedStyle(doc.body) return bodyStyle.backgroundColor === 'rgba(0, 0, 0, 0)' && bodyStyle.backgroundImage === 'none' - ? doc.defaultView.getComputedStyle(doc.documentElement).background - : bodyStyle.background + ? doc.defaultView.getComputedStyle(doc.documentElement).background + : bodyStyle.background } class View { diff --git a/reader.js b/reader.js index 2688ef4..7d389f7 100644 --- a/reader.js +++ b/reader.js @@ -35,7 +35,7 @@ const makeDirectoryLoader = async entry => { const files = await Promise.all( entries.map(entry => new Promise((resolve, reject) => entry.file(file => resolve([file, entry.fullPath]), - error => reject(error))))) + error => reject(error))))) const map = new Map(files.map(([file, path]) => [path.replace(entry.fullPath + '/', ''), file])) const decoder = new TextDecoder() @@ -176,7 +176,7 @@ class Reader { this.layout.flow = value this.setAppearance() }, - } + }, ]) menu.element.classList.add('menu')