chore: no `object-shorthand` for tests

This commit is contained in:
alexander-akait 2025-04-22 14:09:25 +03:00
parent e333fe9adf
commit 9e6984056b
175 changed files with 189 additions and 187 deletions

View File

@ -415,7 +415,6 @@ export default defineConfig([
"jest/expect-expect": "off",
"jest/no-conditional-expect": "off",
"no-console": "off",
"object-shorthand": "off",
camelcase: "off",
"jsdoc/require-jsdoc": "off",
"n/no-unsupported-features/es-syntax": [

View File

@ -59,7 +59,7 @@ it("can place banner as footer", done => {
const compiler = webpack({
mode: "development",
entry: {
footerFile: footerFile
footerFile
},
output: {
path: outputDir

View File

@ -125,7 +125,7 @@ function runBenchmark(webpack, config, callback) {
maxTime: 30,
defer: true,
initCount: 1,
onComplete: function () {
onComplete() {
const stats = bench.stats;
const n = stats.sample.length;
const nSqrt = Math.sqrt(n);

View File

@ -116,8 +116,8 @@ describe("Compiler (caching)", () => {
fixtureCount++;
return {
rootPath: fixturePath,
aFilepath: aFilepath,
cFilepath: cFilepath
aFilepath,
cFilepath
};
}

View File

@ -194,8 +194,8 @@ describe("Compiler (filesystem caching)", () => {
fixtureCount++;
return {
rootPath: fixturePath,
usesAssetFilepath: usesAssetFilepath,
svgFilepath: svgFilepath
usesAssetFilepath,
svgFilepath
};
}

View File

@ -138,7 +138,7 @@ const describeCases = config => {
}
}
testConfig = {
findBundle: function (i, options) {
findBundle(i, options) {
const ext = path.extname(
parseResource(options.output.filename).path
);
@ -422,10 +422,10 @@ const describeCases = config => {
filesCount++;
const document = new FakeDocument(outputDirectory);
const globalContext = {
console: console,
expect: expect,
setTimeout: setTimeout,
clearTimeout: clearTimeout,
console,
expect,
setTimeout,
clearTimeout,
document,
getComputedStyle:
document.getComputedStyle.bind(document),
@ -442,7 +442,7 @@ const describeCases = config => {
const esmCache = new Map();
const esmIdentifier = `${category.name}-${testName}-${i}`;
const baseModuleScope = {
console: console,
console,
it: _it,
beforeEach: _beforeEach,
afterEach: _afterEach,

View File

@ -7,7 +7,7 @@ describe("Profiling Plugin", () => {
it("should persist the passed output path", () => {
const outputPath = path.join(__dirname, "invest_in_doge_coin");
const plugin = new ProfilingPlugin({
outputPath: outputPath
outputPath
});
expect(plugin.outputPath).toBe(outputPath);
});

View File

@ -421,7 +421,7 @@ const describeCases = config => {
Buffer,
setTimeout,
setImmediate,
nsObj: function (m) {
nsObj(m) {
Object.defineProperty(m, Symbol.toStringTag, {
value: "Module"
});

View File

@ -261,8 +261,8 @@ const describeCases = config => {
return;
const globalContext = {
console: console,
expect: expect,
console,
expect,
setTimeout,
clearTimeout,
document: new FakeDocument()

View File

@ -1,5 +1,5 @@
module.exports = {
findBundle: function (i, options) {
findBundle(i, options) {
const ext = options.output.module ? "mjs" : "js";
switch (i % 4) {

View File

@ -1,5 +1,5 @@
module.exports = {
findBundle: function (i, options) {
findBundle(i, options) {
return ["test.js"];
}
};

View File

@ -1,5 +1,5 @@
module.exports = {
findBundle: function () {
findBundle() {
return ["entryA.js"];
}
};

View File

@ -1,5 +1,5 @@
module.exports = {
findBundle: function (i, options) {
findBundle(i, options) {
return ["a.js", "b.js"];
}
};

View File

@ -1,5 +1,5 @@
module.exports = {
findBundle: function (i, options) {
findBundle(i, options) {
return ["a.js", "b.js"];
}
};

View File

@ -1,5 +1,5 @@
module.exports = {
findBundle: function (i, options) {
findBundle(i, options) {
return ["main.js"];
}
};

View File

@ -1,5 +1,5 @@
module.exports = {
findBundle: function (i, options) {
findBundle(i, options) {
return ["main.js", "A.js", "shared.js", "B.js", "B-2.js"];
}
};

View File

@ -1,5 +1,5 @@
module.exports = {
findBundle: function (i, options) {
findBundle(i, options) {
return ["entry1.js", "entry2.js"];
}
};

View File

@ -1,5 +1,5 @@
module.exports = {
findBundle: function (i, options) {
findBundle(i, options) {
return ["entry1.js", "entry2.js"];
}
};

View File

@ -1,5 +1,5 @@
module.exports = {
findBundle: function (i, options) {
findBundle(i, options) {
return ["runtime.js", "common-index_js.js", "main.js"];
}
};

View File

@ -1,5 +1,5 @@
module.exports = {
findBundle: function (i, options) {
findBundle(i, options) {
return i === 0 ? "./main.js" : "./module/main.mjs";
}
};

View File

@ -1,5 +1,5 @@
module.exports = {
findBundle: function (i, options) {
findBundle(i, options) {
return i === 0 ? "./main.js" : "./module/main.mjs";
}
};

View File

@ -1,5 +1,5 @@
module.exports = {
findBundle: function (i, options) {
findBundle(i, options) {
return i === 0 ? "./main.js" : "./module/main.mjs";
}
};

View File

@ -1,5 +1,5 @@
module.exports = {
findBundle: function (i, options) {
findBundle(i, options) {
return i === 0 ? "./main.js" : "./module/main.mjs";
}
};

View File

@ -1,5 +1,5 @@
module.exports = {
findBundle: function (i, options) {
findBundle(i, options) {
return i === 0 ? "./main.js" : "./module/main.mjs";
}
};

View File

@ -4,7 +4,7 @@ const allAssets = new Set();
const allBundles = new Set();
module.exports = {
findBundle: function (i, options) {
findBundle(i, options) {
const bundle = findOutputFiles(options, new RegExp(`^bundle${i}`))[0];
allBundles.add(/\.([^.]+)\./.exec(bundle)[1]);

View File

@ -4,7 +4,7 @@ const allCss = new Set();
const allBundles = new Set();
module.exports = {
findBundle: function (i, options) {
findBundle(i, options) {
const bundle = findOutputFiles(options, new RegExp(`^bundle${i}`))[0];
const async = findOutputFiles(options, /\.js/, `css${i}`);
allBundles.add(/\.([^.]+)\./.exec(bundle)[1]);

View File

@ -4,7 +4,7 @@ const allFilenameHashes = new Set();
const allChunkHashes = new Set();
module.exports = {
findBundle: function (i, options) {
findBundle(i, options) {
const filename = findOutputFiles(options, new RegExp(`^bundle${i}`))[0];
const filenameHash = /\.([a-f0-9]+)\.js$/.exec(filename)[1];
allFilenameHashes.add(filenameHash);

View File

@ -4,7 +4,7 @@ const allAssets = new Set();
const allBundles = new Set();
module.exports = {
findBundle: function (i, options) {
findBundle(i, options) {
const bundle = findOutputFiles(options, new RegExp(`^bundle${i}`))[0];
allBundles.add(/\.([^.]+)\./.exec(bundle)[1]);

View File

@ -4,7 +4,7 @@ const allAssets = new Set();
const allBundles = new Set();
module.exports = {
findBundle: function (i, options) {
findBundle(i, options) {
const bundle = findOutputFiles(options, new RegExp(`^bundle${i}`))[0];
allBundles.add(/\.([^.]+)\./.exec(bundle)[1]);

View File

@ -1,5 +1,5 @@
module.exports = {
findBundle: function (i, options) {
findBundle(i, options) {
return ["style_css.bundle0.js", "bundle0.js"];
}
};

View File

@ -1,5 +1,5 @@
module.exports = {
findBundle: function (i, options) {
findBundle(i, options) {
return ["style2_css.bundle0.js", "bundle0.js"];
},
moduleScope(scope) {

View File

@ -1,5 +1,5 @@
module.exports = {
findBundle: function (i, options) {
findBundle(i, options) {
return ["style2_css.bundle0.js", "bundle0.js"];
},
moduleScope(scope) {

View File

@ -1,5 +1,5 @@
module.exports = {
findBundle: function (i, options) {
findBundle(i, options) {
return ["css.bundle0.js", "lazy4_js.bundle0.js", "bundle0.js"];
}
};

View File

@ -1,7 +1,7 @@
const findOutputFiles = require("../../../helpers/findOutputFiles");
module.exports = {
findBundle: function (i, options) {
findBundle(i, options) {
const async1 = findOutputFiles(options, /^async.async_js.+.js/)[0];
const async2 = findOutputFiles(options, /^async.async_css.+.js/)[0];
const bundle = findOutputFiles(options, /^bundle.+.js/)[0];

View File

@ -1,5 +1,5 @@
module.exports = {
findBundle: function (i, options) {
findBundle(i, options) {
return i === 0
? ["./use-style_js.bundle0.js", "./bundle0.js"]
: ["./142.bundle1.js", "./bundle1.js"];

View File

@ -1,5 +1,5 @@
module.exports = {
findBundle: function (i, options) {
findBundle(i, options) {
return ["bundle0.js"];
},
moduleScope(scope) {

View File

@ -1,5 +1,5 @@
module.exports = {
findBundle: function (i, options) {
findBundle(i, options) {
return [
`style_module_css_as-is.bundle${i}.js`,
`style_module_css_camel-case.bundle${i}.js`,

View File

@ -1,5 +1,5 @@
module.exports = {
findBundle: function (i, options) {
findBundle(i, options) {
return [
"pseudo-export_style_module_css.bundle0.js",
"pseudo-export_style_module_css_module.bundle0.js",

View File

@ -1,5 +1,5 @@
module.exports = {
findBundle: function (i, options) {
findBundle(i, options) {
return ["125.bundle0.js", "bundle0.js"];
}
};

View File

@ -1,5 +1,5 @@
module.exports = {
findBundle: function (i, options) {
findBundle(i, options) {
return [
`style_module_css.bundle${i}.js`,
`style_module_css_hash.bundle${i}.js`,

View File

@ -1,5 +1,5 @@
module.exports = {
findBundle: function (i) {
findBundle(i) {
switch (i) {
case 0:
return ["test.js"];

View File

@ -8,7 +8,7 @@ module.exports = {
link.href = "bundle0.css";
scope.window.document.head.appendChild(link);
},
findBundle: function (i, options) {
findBundle(i, options) {
const source = fs.readFileSync(
path.resolve(options.output.path, "bundle0.css"),
"utf-8"

View File

@ -1,5 +1,5 @@
module.exports = {
findBundle: function (i, options) {
findBundle(i, options) {
return ["reexport_modules_css.bundle0.js", "bundle0.js"];
},
moduleScope(scope) {

View File

@ -9,7 +9,7 @@ module.exports = {
link2.href = "asyncChunk2_js.css";
scope.window.document.head.appendChild(link2);
},
findBundle: function (i, options) {
findBundle(i, options) {
return [
"./common-share_js-img_png.js",
"./asyncChunk_js.js",

View File

@ -1,5 +1,5 @@
module.exports = {
findBundle: function (i, options) {
findBundle(i, options) {
return [`index_css.bundle${i}.js`, `bundle${i}.js`];
}
};

View File

@ -1,5 +1,5 @@
module.exports = {
findBundle: function () {
findBundle() {
return ["./runtime~main.js", "./main.js"];
}
};

View File

@ -1,5 +1,5 @@
module.exports = {
findBundle: function () {
findBundle() {
return [
"./app.js",
"./runtime.js",

View File

@ -1,5 +1,5 @@
module.exports = {
findBundle: function () {
findBundle() {
return ["./other-vendors.js", "./page1.js", "./app.js"];
}
};

View File

@ -1,5 +1,5 @@
module.exports = {
findBundle: function () {
findBundle() {
return ["./runtime.js", "./a.js", "./b.js"];
}
};

View File

@ -1,5 +1,5 @@
module.exports = {
findBundle: function () {
findBundle() {
return ["./app.js", "./react-vendors.js"];
}
};

View File

@ -1,5 +1,5 @@
module.exports = {
findBundle: function () {
findBundle() {
return ["./a.js", "./b.js"];
}
};

View File

@ -1,5 +1,5 @@
module.exports = {
findBundle: function () {
findBundle() {
return ["./a.js", "./b.js"];
}
};

View File

@ -1,5 +1,5 @@
module.exports = {
findBundle: function () {
findBundle() {
return ["./a.js", "./b.js"];
}
};

View File

@ -1,5 +1,5 @@
module.exports = {
findBundle: function () {
findBundle() {
return ["./runtime.js", "./app.js", "./home.js"];
}
};

View File

@ -10,7 +10,7 @@ module.exports = {
afterExecute: () => {
System.execute("(anonym)");
},
findBundle: function () {
findBundle() {
return ["./main.system.js", "./main.umd.js"];
}
};

View File

@ -1,5 +1,5 @@
module.exports = {
findBundle: function (i, options) {
findBundle(i, options) {
return ["./a.js", "./b.js", "./c.js", "./runtime.js", "./d.js"];
}
};

View File

@ -1,5 +1,5 @@
module.exports = {
findBundle: function (i, options) {
findBundle(i, options) {
return [
`./${options.target}/folder/entry/-x/file.js`,
`./${options.target}/folder/x-/-x/file.js`,

View File

@ -1,5 +1,5 @@
module.exports = {
findBundle: function (i, options) {
findBundle(i, options) {
return [
`../weird-names2-out/entry/entry-${options.target}.js`,
`../weird-names2-out/entry-${options.target}.js`

View File

@ -1,7 +1,7 @@
const findOutputFiles = require("../../../helpers/findOutputFiles");
module.exports = {
findBundle: function (i, options) {
findBundle(i, options) {
const files = findOutputFiles(options, new RegExp(/\.js$/));
return files.sort((a, b) => (a.startsWith("main") ? 1 : 0));

View File

@ -1,5 +1,5 @@
module.exports = {
findBundle: function () {
findBundle() {
return ["./a.js", "./b.js", "./bundle0.js"];
}
};

View File

@ -1,5 +1,5 @@
module.exports = {
findBundle: function (i, options) {
findBundle(i, options) {
return ["./common.js", "./main.js"];
}
};

View File

@ -1,5 +1,5 @@
module.exports = {
findBundle: function (i, options) {
findBundle(i, options) {
return ["11.js", "22.js", "aa.js", "bbb.js"];
}
};

View File

@ -2,7 +2,7 @@
module.exports = {
mode: "development",
output: {
devtoolModuleFilenameTemplate: function (info) {
devtoolModuleFilenameTemplate(info) {
return `dummy:///${info.resourcePath}`;
}
},

View File

@ -1,5 +1,5 @@
module.exports = {
findBundle: function (i, options) {
findBundle(i, options) {
return [
"shared.js",
"a.js",

View File

@ -1,5 +1,5 @@
module.exports = {
findBundle: function (i, options) {
findBundle(i, options) {
return ["shared.js", "a.js", "b.js"];
}
};

View File

@ -1,5 +1,5 @@
module.exports = {
findBundle: function (i, options) {
findBundle(i, options) {
return [
"shared.js",
"a.js",

View File

@ -14,7 +14,7 @@ const verifyFilenameLength = (filename, expectedNameLength) => {
};
module.exports = {
findBundle: function (i, options) {
findBundle(i, options) {
const files = fs.readdirSync(options.output.path);
const bundleDetects = [
options.amd.expectedChunkFilenameLength && {

View File

@ -2,7 +2,7 @@ const fs = require("fs");
module.exports = {
noTests: true,
findBundle: function (i, options) {
findBundle(i, options) {
const regex = new RegExp(`^bundle.${options.name}`, "i");
const files = fs.readdirSync(options.output.path);
const bundle = files.find(function (file) {

View File

@ -9,7 +9,7 @@ module.exports = {
dark.href = "dark.css";
scope.window.document.head.appendChild(dark);
},
findBundle: function () {
findBundle() {
return ["./runtime.js", "./light.js", "./dark.js"];
}
};

View File

@ -1,5 +1,5 @@
module.exports = {
findBundle: function () {
findBundle() {
return ["./light.js", "./dark.js"];
}
};

View File

@ -1,5 +1,5 @@
module.exports = {
findBundle: function () {
findBundle() {
return ["./common.js", "./free.js", "./paid.js"];
}
};

View File

@ -1,5 +1,5 @@
module.exports = {
findBundle: function () {
findBundle() {
return ["./free.js", "./paid.js"];
}
};

View File

@ -1,5 +1,5 @@
module.exports = {
findBundle: function (i, options) {
findBundle(i, options) {
return ["main.mjs"];
}
};

View File

@ -1,5 +1,5 @@
module.exports = {
findBundle: function () {
findBundle() {
return ["./runtime~main.js", "./main.js"];
}
};

View File

@ -9,7 +9,7 @@ module.exports = {
{
loader: "./loader2",
options: {
f: function () {
f() {
return "ok";
}
}
@ -25,7 +25,7 @@ module.exports = {
use: {
loader: "./loader2",
options: {
f: function () {
f() {
return "maybe";
}
}
@ -36,7 +36,7 @@ module.exports = {
use: {
loader: "./loader2",
options: {
f: function () {
f() {
return "yes";
}
}
@ -51,7 +51,7 @@ module.exports = {
{
loader: "./loader2",
options: {
f: function () {
f() {
return "ok";
}
}

View File

@ -10,7 +10,7 @@ module.exports = {
loader: "./loader2",
ident: "loader2",
options: {
f: function () {
f() {
return "ok";
}
}
@ -24,7 +24,7 @@ module.exports = {
{
loader: "./loader2",
options: {
f: function () {
f() {
return "ok";
}
}
@ -39,7 +39,7 @@ module.exports = {
test: /c\.js$/,
loader: "./loader2",
options: {
f: function () {
f() {
return "ok";
}
}

View File

@ -1,5 +1,5 @@
module.exports = {
findBundle: function () {
findBundle() {
return ["./deterministic.js", "./size.js"];
}
};

View File

@ -1,5 +1,5 @@
module.exports = {
findBundle: function () {
findBundle() {
return "./main.mjs";
}
};

View File

@ -1,5 +1,5 @@
module.exports = {
findBundle: function () {
findBundle() {
return ["./runtime.mjs", "./main.mjs"];
}
};

View File

@ -1,5 +1,5 @@
module.exports = {
findBundle: function () {
findBundle() {
return ["./runtime.mjs", "./separate.mjs", "./main.mjs"];
}
};

View File

@ -1,7 +1,7 @@
/** @type {import("../../../../").Configuration} */
module.exports = {
module: {
noParse: function (content) {
noParse(content) {
return /not-parsed/.test(content);
}
}

View File

@ -1,5 +1,5 @@
module.exports = {
findBundle: function () {
findBundle() {
return ["./a.js", "./b.js", "./runtime-c.js", "./c.js"];
}
};

View File

@ -1,5 +1,5 @@
module.exports = {
findBundle: function () {
findBundle() {
return ["./a.js", "./b.js"];
}
};

View File

@ -1,5 +1,5 @@
module.exports = {
findBundle: function () {
findBundle() {
return ["./a.js", "./b.js", "./c.js"];
}
};

View File

@ -1,5 +1,5 @@
module.exports = {
findBundle: function (i, options) {
findBundle(i, options) {
return [
"module-avoidEntryIife-false.mjs",
"module-avoidEntryIife-true.mjs",

View File

@ -1,5 +1,5 @@
module.exports = {
findBundle: function (i, options) {
findBundle(i, options) {
return ["test.js"];
}
};

View File

@ -1,5 +1,5 @@
module.exports = {
findBundle: function (i, options) {
findBundle(i, options) {
return ["bundle0.mjs", "test.js"];
}
};

View File

@ -1,5 +1,5 @@
module.exports = {
findBundle: function (i, options) {
findBundle(i, options) {
return ["main.mjs", "vendor.mjs", "runtime.mjs"];
}
};

View File

@ -1,5 +1,5 @@
module.exports = {
findBundle: function (i, options) {
findBundle(i, options) {
switch (i) {
case 2:
case 6:

View File

@ -1,5 +1,5 @@
module.exports = {
findBundle: function () {
findBundle() {
return ["runtime.mjs", "main.mjs"];
}
};

View File

@ -1,5 +1,5 @@
module.exports = {
findBundle: function () {
findBundle() {
return ["./a.js", "./b.js"];
}
};

View File

@ -1,5 +1,5 @@
module.exports = {
findBundle: function () {
findBundle() {
return ["./a.js", "./inner-dir/b.js", "./inner-dir/deep/deep/c.js"];
}
};

View File

@ -1,5 +1,5 @@
module.exports = {
findBundle: function () {
findBundle() {
return ["./index.mjs"];
},
moduleScope(scope) {

View File

@ -1,5 +1,5 @@
module.exports = {
findBundle: function () {
findBundle() {
return ["./inner1/inner2/a.js", "./b.js"];
}
};

View File

@ -1,5 +1,5 @@
module.exports = {
findBundle: function () {
findBundle() {
return ["./a.js"];
}
};

View File

@ -1,5 +1,5 @@
module.exports = {
findBundle: function () {
findBundle() {
return ["./main.js"];
}
};

View File

@ -1,5 +1,5 @@
module.exports = {
moduleScope: function (scope) {
moduleScope(scope) {
delete scope.__dirname;
delete scope.__filename;
}

View File

@ -1,5 +1,5 @@
module.exports = {
moduleScope: function (scope) {
moduleScope(scope) {
delete scope.__dirname;
delete scope.__filename;
}

View File

@ -1,5 +1,5 @@
module.exports = {
findBundle: function (i, options) {
findBundle(i, options) {
return "./dist/banner.js";
}
};

View File

@ -20,6 +20,7 @@ module.exports = {
NEGATIVE_ZER0: -0,
NEGATIVE_NUMBER: -100.25,
POSITIVE_NUMBER: +100.25,
// eslint-disable-next-line object-shorthand
FUNCTION: /* istanbul ignore next */ function (a) {
return a + 1;
},
@ -28,6 +29,7 @@ module.exports = {
OBJECT: {
SUB: {
UNDEFINED: undefined,
// eslint-disable-next-line object-shorthand
FUNCTION: /* istanbul ignore next */ function (a) {
return a + 1;
},

Some files were not shown because too many files have changed in this diff Show More