1
0
Fork 0
mirror of https://github.com/mozilla/pdf.js.git synced 2025-04-19 22:58:07 +02:00

Enable the import/no-commonjs ESLint plugin rule

Given the amount of work put into removing `require`-calls from the code-base, let's ensure that new ones aren't accidentally added in the future.

Note that we still have a couple of files where `require` is being used, in particular:
 - The Node.js examples, however those will be updated to use `import` in PR 17081.
 - The Webpack examples, and related support files, however I unfortunately don't know enough about Webpack to be able to update those. (Hopefully users of that code will help out here, once version `4` is released.)
 - The `statcmp`-tool, since *some* of those `require`-calls cannot be converted to `import` without other code changes (and that file is only used during benchmarking).

Please find additional details at https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/no-commonjs.md
This commit is contained in:
Jonas Jenwald 2023-10-14 12:38:17 +02:00
parent 57866cd31b
commit d53093045a
9 changed files with 15 additions and 5 deletions

View file

@ -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";

View file

@ -1,3 +1,5 @@
/* eslint-disable import/no-commonjs */
import { createRequire } from "module";
import fs from "fs";