Update the ESLint globals
list (PR 17055 follow-up)
Given that we only use standard `import`/`export` statements now, after recent PRs, the "exports" global is unused. Instead we add "__non_webpack_import__" to the `globals` to avoid having to sprinkle disable statements throughout the code. Finally, the way that `globals` are defined has changed in ESLint and we should thus explicitly specify them as "readonly"; please find additional details at https://eslint.org/docs/latest/use/configure/language-options#specifying-globals
This commit is contained in:
parent
5c45dfa0ae
commit
d5acbbccd3
@ -26,8 +26,8 @@
|
|||||||
},
|
},
|
||||||
|
|
||||||
"globals": {
|
"globals": {
|
||||||
"PDFJSDev": false,
|
"PDFJSDev": "readonly",
|
||||||
"exports": false,
|
"__non_webpack_import__": "readonly",
|
||||||
},
|
},
|
||||||
|
|
||||||
"rules": {
|
"rules": {
|
||||||
|
@ -2306,7 +2306,7 @@ class PDFWorker {
|
|||||||
const worker =
|
const worker =
|
||||||
typeof PDFJSDev === "undefined"
|
typeof PDFJSDev === "undefined"
|
||||||
? await import("pdfjs/pdf.worker.js")
|
? await import("pdfjs/pdf.worker.js")
|
||||||
: await __non_webpack_import__(this.workerSrc); // eslint-disable-line no-undef
|
: await __non_webpack_import__(this.workerSrc);
|
||||||
return worker.WorkerMessageHandler;
|
return worker.WorkerMessageHandler;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -12,7 +12,6 @@
|
|||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
/* globals __non_webpack_import__ */
|
|
||||||
|
|
||||||
import {
|
import {
|
||||||
AbortException,
|
AbortException,
|
||||||
|
@ -12,7 +12,6 @@
|
|||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
/* globals __non_webpack_import__ */
|
|
||||||
|
|
||||||
import {
|
import {
|
||||||
BaseCanvasFactory,
|
BaseCanvasFactory,
|
||||||
|
@ -12,7 +12,6 @@
|
|||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
/* globals __non_webpack_import__ */
|
|
||||||
|
|
||||||
import { AbortException, isNodeJS } from "../../src/shared/util.js";
|
import { AbortException, isNodeJS } from "../../src/shared/util.js";
|
||||||
import { PDFNodeStream } from "../../src/display/node_stream.js";
|
import { PDFNodeStream } from "../../src/display/node_stream.js";
|
||||||
|
@ -12,7 +12,6 @@
|
|||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
/* globals __non_webpack_import__ */
|
|
||||||
|
|
||||||
import { NullStream, StringStream } from "../../src/core/stream.js";
|
import { NullStream, StringStream } from "../../src/core/stream.js";
|
||||||
import { Page, PDFDocument } from "../../src/core/document.js";
|
import { Page, PDFDocument } from "../../src/core/document.js";
|
||||||
|
@ -2268,7 +2268,7 @@ async function loadFakeWorker() {
|
|||||||
globalThis.pdfjsWorker = await import("pdfjs/pdf.worker.js");
|
globalThis.pdfjsWorker = await import("pdfjs/pdf.worker.js");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
await __non_webpack_import__(PDFWorker.workerSrc); // eslint-disable-line no-undef
|
await __non_webpack_import__(PDFWorker.workerSrc);
|
||||||
}
|
}
|
||||||
|
|
||||||
async function loadPDFBug(self) {
|
async function loadPDFBug(self) {
|
||||||
@ -2276,7 +2276,7 @@ async function loadPDFBug(self) {
|
|||||||
const { PDFBug } =
|
const { PDFBug } =
|
||||||
typeof PDFJSDev === "undefined"
|
typeof PDFJSDev === "undefined"
|
||||||
? await import(debuggerScriptPath) // eslint-disable-line no-unsanitized/method
|
? await import(debuggerScriptPath) // eslint-disable-line no-unsanitized/method
|
||||||
: await __non_webpack_import__(debuggerScriptPath); // eslint-disable-line no-undef
|
: await __non_webpack_import__(debuggerScriptPath);
|
||||||
|
|
||||||
self._PDFBug = PDFBug;
|
self._PDFBug = PDFBug;
|
||||||
}
|
}
|
||||||
|
@ -45,7 +45,7 @@ class GenericScripting {
|
|||||||
const sandbox =
|
const sandbox =
|
||||||
typeof PDFJSDev === "undefined"
|
typeof PDFJSDev === "undefined"
|
||||||
? import(sandboxBundleSrc) // eslint-disable-line no-unsanitized/method
|
? import(sandboxBundleSrc) // eslint-disable-line no-unsanitized/method
|
||||||
: __non_webpack_import__(sandboxBundleSrc); // eslint-disable-line no-undef
|
: __non_webpack_import__(sandboxBundleSrc);
|
||||||
sandbox
|
sandbox
|
||||||
.then(pdfjsSandbox => {
|
.then(pdfjsSandbox => {
|
||||||
resolve(pdfjsSandbox.QuickJSSandbox());
|
resolve(pdfjsSandbox.QuickJSSandbox());
|
||||||
|
Loading…
Reference in New Issue
Block a user