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:
parent
57866cd31b
commit
d53093045a
@ -39,6 +39,7 @@
|
|||||||
"import/named": "error",
|
"import/named": "error",
|
||||||
"import/no-cycle": "error",
|
"import/no-cycle": "error",
|
||||||
"import/no-empty-named-blocks": "error",
|
"import/no-empty-named-blocks": "error",
|
||||||
|
"import/no-commonjs": "error",
|
||||||
"import/no-mutable-exports": "error",
|
"import/no-mutable-exports": "error",
|
||||||
"import/no-self-import": "error",
|
"import/no-self-import": "error",
|
||||||
"import/no-unresolved": ["error", {
|
"import/no-unresolved": ["error", {
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
/* Any copyright is dedicated to the Public Domain.
|
/* Any copyright is dedicated to the Public Domain.
|
||||||
* http://creativecommons.org/publicdomain/zero/1.0/ */
|
* http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||||
|
|
||||||
|
/* eslint-disable import/no-commonjs */
|
||||||
|
|
||||||
//
|
//
|
||||||
// Basic node example that prints document metadata and text content.
|
// Basic node example that prints document metadata and text content.
|
||||||
//
|
//
|
||||||
|
@ -12,6 +12,7 @@
|
|||||||
* 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.
|
||||||
*/
|
*/
|
||||||
|
/* eslint-disable import/no-commonjs */
|
||||||
|
|
||||||
const Canvas = require("canvas");
|
const Canvas = require("canvas");
|
||||||
const assert = require("assert").strict;
|
const assert = require("assert").strict;
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
// Any copyright is dedicated to the Public Domain.
|
// Any copyright is dedicated to the Public Domain.
|
||||||
// http://creativecommons.org/licenses/publicdomain/
|
// http://creativecommons.org/licenses/publicdomain/
|
||||||
|
|
||||||
|
/* eslint-disable import/no-commonjs */
|
||||||
|
|
||||||
// Hello world example for webpack.
|
// Hello world example for webpack.
|
||||||
|
|
||||||
const pdfjsLib = require("pdfjs-dist");
|
const pdfjsLib = require("pdfjs-dist");
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
/* eslint-disable import/no-commonjs */
|
||||||
|
|
||||||
const webpack = require("webpack"); // eslint-disable-line no-unused-vars
|
const webpack = require("webpack"); // eslint-disable-line no-unused-vars
|
||||||
const path = require("path");
|
const path = require("path");
|
||||||
|
|
||||||
|
1
external/dist/webpack.js
vendored
1
external/dist/webpack.js
vendored
@ -12,6 +12,7 @@
|
|||||||
* 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.
|
||||||
*/
|
*/
|
||||||
|
/* eslint-disable import/no-commonjs */
|
||||||
|
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
|
@ -12,6 +12,7 @@
|
|||||||
* 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.
|
||||||
*/
|
*/
|
||||||
|
/* eslint-disable import/no-commonjs */
|
||||||
|
|
||||||
(typeof window !== "undefined"
|
(typeof window !== "undefined"
|
||||||
? window
|
? window
|
||||||
|
@ -15,11 +15,9 @@
|
|||||||
*/
|
*/
|
||||||
/* eslint-disable no-var */
|
/* eslint-disable no-var */
|
||||||
|
|
||||||
"use strict";
|
import assert from "assert";
|
||||||
|
import fs from "fs";
|
||||||
var assert = require("assert");
|
import vm from "vm";
|
||||||
var fs = require("fs");
|
|
||||||
var vm = require("vm");
|
|
||||||
|
|
||||||
var SRC_DIR = __dirname + "/../../";
|
var SRC_DIR = __dirname + "/../../";
|
||||||
var telemetryJsPath = "extensions/chromium/telemetry.js";
|
var telemetryJsPath = "extensions/chromium/telemetry.js";
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
/* eslint-disable import/no-commonjs */
|
||||||
|
|
||||||
import { createRequire } from "module";
|
import { createRequire } from "module";
|
||||||
import fs from "fs";
|
import fs from "fs";
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user