Migrate to ESLint 9 and fix linting issues

This commit is contained in:
John Factotum
2024-04-23 12:59:31 +08:00
parent 04b8789267
commit 5600b6c0dc
5 changed files with 61 additions and 31 deletions
-24
View File
@@ -1,24 +0,0 @@
{
"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
}
+22
View File
@@ -0,0 +1,22 @@
import js from '@eslint/js'
import globals from 'globals'
export default [js.configs.recommended, { ignores: ['vendor'] }, {
languageOptions: {
globals: globals.browser,
},
linterOptions: {
reportUnusedDisableDirectives: true,
},
rules: {
semi: ['error', 'never'],
indent: ['warn', 4, { flatTernaryExpressions: true, SwitchCase: 1 }],
quotes: ['warn', 'single', { avoidEscape: true }],
'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 }],
},
}]
+2 -2
View File
@@ -785,7 +785,7 @@ class MOBI6 {
const recindex = img.getAttribute('recindex')
try {
img.src = await this.loadRecindex(recindex)
} catch (e) {
} catch {
console.warn(`Failed to load image ${recindex}`)
}
}
@@ -795,7 +795,7 @@ class MOBI6 {
try {
media.src = await this.loadRecindex(mediarecindex)
if (recindex) media.poster = await this.loadRecindex(recindex)
} catch (e) {
} catch {
console.warn(`Failed to load media ${mediarecindex}`)
}
}
+37
View File
@@ -0,0 +1,37 @@
{
"name": "foliate",
"version": "0.0.0",
"description": "Render e-books in the browser",
"repository": {
"type": "git",
"url": "git+https://github.com/johnfactotum/foliate-js.git"
},
"bugs": {
"url": "https://github.com/johnfactotum/foliate-js/issues"
},
"homepage": "https://github.com/johnfactotum/foliate-js#readme",
"author": "John Factotum",
"license": "MIT",
"type": "module",
"exports": {
"./*.js": "./*.js"
},
"devDependencies": {
"@eslint/js": "^9.1.0",
"globals": "^15.0.0"
},
"keywords": [
"ebook",
"reader",
"epub",
"cfi",
"mobi",
"azw",
"azw3",
"fb2",
"cbz",
"dictd",
"stardict",
"opds"
]
}
-5
View File
@@ -67,11 +67,6 @@ export class View extends HTMLElement {
#tocProgress
#pageProgress
#searchResults = new Map()
#ssml
#speechDoc
#speechRanges
#speechGranularity
#lastSpeechMark
isFixedLayout = false
lastLocation
history = new History()