diff --git a/.eslintrc b/.eslintrc index 8913ec9e4..3e5732b18 100644 --- a/.eslintrc +++ b/.eslintrc @@ -39,6 +39,7 @@ "import/named": "error", "import/no-cycle": "error", "import/no-empty-named-blocks": "error", + "import/no-commonjs": "error", "import/no-mutable-exports": "error", "import/no-self-import": "error", "import/no-unresolved": ["error", { diff --git a/examples/node/getinfo.js b/examples/node/getinfo.js index bf3c980ff..4723b4273 100644 --- a/examples/node/getinfo.js +++ b/examples/node/getinfo.js @@ -1,6 +1,8 @@ /* Any copyright is dedicated to the Public Domain. * http://creativecommons.org/publicdomain/zero/1.0/ */ +/* eslint-disable import/no-commonjs */ + // // Basic node example that prints document metadata and text content. // diff --git a/examples/node/pdf2png/pdf2png.js b/examples/node/pdf2png/pdf2png.js index f0d0608ed..f62e4358b 100644 --- a/examples/node/pdf2png/pdf2png.js +++ b/examples/node/pdf2png/pdf2png.js @@ -12,6 +12,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +/* eslint-disable import/no-commonjs */ const Canvas = require("canvas"); const assert = require("assert").strict; diff --git a/examples/webpack/main.js b/examples/webpack/main.js index cc1a8be3c..e23274452 100644 --- a/examples/webpack/main.js +++ b/examples/webpack/main.js @@ -1,6 +1,8 @@ // Any copyright is dedicated to the Public Domain. // http://creativecommons.org/licenses/publicdomain/ +/* eslint-disable import/no-commonjs */ + // Hello world example for webpack. const pdfjsLib = require("pdfjs-dist"); diff --git a/examples/webpack/webpack.config.js b/examples/webpack/webpack.config.js index 0dc1be1ae..6d421a512 100644 --- a/examples/webpack/webpack.config.js +++ b/examples/webpack/webpack.config.js @@ -1,3 +1,5 @@ +/* eslint-disable import/no-commonjs */ + const webpack = require("webpack"); // eslint-disable-line no-unused-vars const path = require("path"); diff --git a/external/dist/webpack.js b/external/dist/webpack.js index 9b9447208..ec6546cb0 100644 --- a/external/dist/webpack.js +++ b/external/dist/webpack.js @@ -12,6 +12,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +/* eslint-disable import/no-commonjs */ "use strict"; diff --git a/src/pdf.worker.entry.js b/src/pdf.worker.entry.js index 696c10819..e9709b4b5 100644 --- a/src/pdf.worker.entry.js +++ b/src/pdf.worker.entry.js @@ -12,6 +12,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +/* eslint-disable import/no-commonjs */ (typeof window !== "undefined" ? window diff --git a/test/chromium/test-telemetry.js b/test/chromium/test-telemetry.js index f03675a50..48f9d301d 100755 --- a/test/chromium/test-telemetry.js +++ b/test/chromium/test-telemetry.js @@ -15,11 +15,9 @@ */ /* eslint-disable no-var */ -"use strict"; - -var assert = require("assert"); -var fs = require("fs"); -var vm = require("vm"); +import assert from "assert"; +import fs from "fs"; +import vm from "vm"; var SRC_DIR = __dirname + "/../../"; var telemetryJsPath = "extensions/chromium/telemetry.js"; diff --git a/test/stats/statcmp.js b/test/stats/statcmp.js index bb5a2226d..e5ba75441 100644 --- a/test/stats/statcmp.js +++ b/test/stats/statcmp.js @@ -1,3 +1,5 @@ +/* eslint-disable import/no-commonjs */ + import { createRequire } from "module"; import fs from "fs";