add eslint config and missing semicolons

This commit is contained in:
octocorvus 2023-06-09 06:10:21 +00:00 committed by Daniel Micay
parent f6dd0b2a87
commit 6f40b25b31
4 changed files with 1680 additions and 35 deletions

40
.eslintrc.json Normal file
View File

@ -0,0 +1,40 @@
{
"env": {
"browser": true,
"es2022": true
},
"extends": "eslint:recommended",
"parserOptions": {
"ecmaVersion": 2022,
"sourceType": "module"
},
"rules": {
"indent": [
"error",
4
],
"linebreak-style": [
"error",
"unix"
],
"quotes": [
"error",
"double"
],
"semi": [
"error",
"always"
],
"no-var": [
"error"
]
},
"globals": {
"pdfjsLib": "readonly",
"channel": "readonly"
},
"ignorePatterns": [
"pdf.js",
"pdf.worker.js"
]
}

View File

@ -181,7 +181,7 @@ function renderPage(pageNumber, zoom, prerender, prerenderTrigger=0) {
}
if (cache.length === maxCached) {
cache.shift()
cache.shift();
}
cache.push({
pageNumber: pageNumber,
@ -244,7 +244,7 @@ function loadDocument() {
} else if (error === pdfjsLib.PasswordResponses.INCORRECT_PASSWORD) {
channel.invalidPassword();
}
}
};
loadingTask.promise.then(function (newDoc) {
channel.onLoaded();
@ -263,4 +263,4 @@ function loadDocument() {
window.onresize = () => {
setLayerTransform(canvas.clientWidth, canvas.clientHeight, textLayerDiv);
}
};

1666
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -1,5 +1,8 @@
{
"dependencies": {
"pdfjs-dist": "3.7.107"
},
"devDependencies": {
"eslint": "^8.42.0"
}
}