Skip to content

Commit

Permalink
Merge pull request #16517 from Snuffleupagus/eslint-import-more
Browse files Browse the repository at this point in the history
Enable more `import` ESLint plugin rules
  • Loading branch information
timvandermeij authored Jun 4, 2023
2 parents bb5d38a + 5fad931 commit 605d9f4
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 18 deletions.
6 changes: 6 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,14 @@

"rules": {
// Plugins
"import/export": "error",
"import/exports-last": "error",
"import/extensions": ["error", "always", { "ignorePackages": true, }],
"import/first": "error",
"import/named": "error",
"import/no-empty-named-blocks": "error",
"import/no-mutable-exports": "error",
"import/no-self-import": "error",
"import/no-unresolved": ["error", {
"ignore": ["pdfjs", "pdfjs-lib", "pdfjs-web", "web"]
}],
Expand Down
34 changes: 16 additions & 18 deletions src/display/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,24 +69,22 @@ const DEFAULT_RANGE_CHUNK_SIZE = 65536; // 2^16 = 65536
const RENDERING_CANCELLED_TIMEOUT = 100; // ms
const DELAYED_CLEANUP_TIMEOUT = 5000; // ms

let DefaultCanvasFactory = DOMCanvasFactory;
let DefaultCMapReaderFactory = DOMCMapReaderFactory;
let DefaultFilterFactory = DOMFilterFactory;
let DefaultStandardFontDataFactory = DOMStandardFontDataFactory;

if (typeof PDFJSDev !== "undefined" && PDFJSDev.test("GENERIC") && isNodeJS) {
const {
NodeCanvasFactory,
NodeCMapReaderFactory,
NodeFilterFactory,
NodeStandardFontDataFactory,
} = require("./node_utils.js");

DefaultCanvasFactory = NodeCanvasFactory;
DefaultCMapReaderFactory = NodeCMapReaderFactory;
DefaultFilterFactory = NodeFilterFactory;
DefaultStandardFontDataFactory = NodeStandardFontDataFactory;
}
const DefaultCanvasFactory =
typeof PDFJSDev !== "undefined" && PDFJSDev.test("GENERIC") && isNodeJS
? require("./node_utils.js").NodeCanvasFactory
: DOMCanvasFactory;
const DefaultCMapReaderFactory =
typeof PDFJSDev !== "undefined" && PDFJSDev.test("GENERIC") && isNodeJS
? require("./node_utils.js").NodeCMapReaderFactory
: DOMCMapReaderFactory;
const DefaultFilterFactory =
typeof PDFJSDev !== "undefined" && PDFJSDev.test("GENERIC") && isNodeJS
? require("./node_utils.js").NodeFilterFactory
: DOMFilterFactory;
const DefaultStandardFontDataFactory =
typeof PDFJSDev !== "undefined" && PDFJSDev.test("GENERIC") && isNodeJS
? require("./node_utils.js").NodeStandardFontDataFactory
: DOMStandardFontDataFactory;

let createPDFNetworkStream;
if (typeof PDFJSDev === "undefined") {
Expand Down
1 change: 1 addition & 0 deletions src/display/svg.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ import {
import { isNodeJS } from "../shared/is_node.js";

/** @type {any} */
// eslint-disable-next-line import/no-mutable-exports
let SVGGraphics = class {
constructor() {
unreachable("Not implemented: SVGGraphics");
Expand Down

0 comments on commit 605d9f4

Please sign in to comment.