Skip to content

Commit 144de04

Browse files
test: fix (#1155)
1 parent 4e4a95d commit 144de04

File tree

28 files changed

+4432
-1447
lines changed

28 files changed

+4432
-1447
lines changed

package-lock.json

Lines changed: 4340 additions & 1224 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,12 +77,12 @@
7777
"eslint-config-webpack": "^4.4.2",
7878
"eslint-plugin-import": "^2.32.0",
7979
"eslint-plugin-jest": "^29.0.1",
80-
"eslint-plugin-jsdoc": "^52.0.0",
80+
"eslint-plugin-jsdoc": "^62.0.0",
8181
"eslint-plugin-n": "^17.21.0",
8282
"eslint-plugin-prettier": "^5.5.3",
83-
"eslint-plugin-unicorn": "^60.0.0",
83+
"eslint-plugin-unicorn": "^62.0.0",
8484
"file-loader": "^6.2.0",
85-
"globals": "^16.3.0",
85+
"globals": "^17.0.0",
8686
"husky": "^7.0.0",
8787
"jest": "^28.1.3",
8888
"jest-environment-jsdom": "^28.1.3",

src/hmr/hotModuleReplacement.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ const noDocument = typeof document === "undefined";
1313

1414
const { forEach } = Array.prototype;
1515

16-
// eslint-disable-next-line jsdoc/no-restricted-syntax
16+
/* eslint-disable jsdoc/reject-function-type */
1717
/**
1818
* @param {Function} fn any function
1919
* @param {number} time time
@@ -38,6 +38,7 @@ function debounce(fn, time) {
3838
timeout = setTimeout(functionCall, time);
3939
};
4040
}
41+
/* eslint-enable jsdoc/reject-function-type */
4142

4243
/**
4344
* @returns {void}

src/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ const CODE_GENERATION_RESULT = {
8989
runtimeRequirements: new Set(),
9090
};
9191

92-
// eslint-disable-next-line jsdoc/no-restricted-syntax
92+
// eslint-disable-next-line jsdoc/reject-any-type
9393
/** @typedef {{ context: string | null, identifier: string, identifierIndex: number, content: Buffer, sourceMap?: Buffer, media?: string, supports?: string, layer?: any, assetsInfo?: Map<string, AssetInfo>, assets?: { [key: string]: Source }}} CssModuleDependency */
9494
/** @typedef {Module & { content: Buffer, media?: string, sourceMap?: Buffer, supports?: string, layer?: string, assets?: { [key: string]: Source }, assetsInfo?: Map<string, AssetInfo> }} CssModule */
9595
/** @typedef {{ new(dependency: CssModuleDependency): CssModule }} CssModuleConstructor */
@@ -795,7 +795,7 @@ class MiniCssExtractPlugin {
795795
compilation.runtimeTemplate.requestShortener,
796796
);
797797

798-
if (modules.size > 0) {
798+
if (modules && modules.size > 0) {
799799
const { hashFunction, hashDigest, hashDigestLength } = outputOptions;
800800
const { createHash } = compiler.webpack.util;
801801
const hash = createHash(/** @type {string} */ (hashFunction));

src/loader.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,10 @@ const MiniCssExtractPlugin = require("./index");
2424
/** @typedef {import("webpack").NormalModule} NormalModule */
2525
/** @typedef {import("./index.js").LoaderOptions} LoaderOptions */
2626

27-
// eslint-disable-next-line jsdoc/no-restricted-syntax
27+
// eslint-disable-next-line jsdoc/reject-function-type
2828
/** @typedef {{[key: string]: string | Function }} Locals */
2929

30-
// eslint-disable-next-line jsdoc/no-restricted-syntax
30+
// eslint-disable-next-line jsdoc/reject-any-type
3131
/** @typedef {any} EXPECTED_ANY */
3232

3333
/**

src/utils.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ const path = require("path");
44
/** @typedef {import("webpack").Compilation} Compilation */
55
/** @typedef {import("webpack").Module} Module */
66

7-
// eslint-disable-next-line jsdoc/no-restricted-syntax
7+
// eslint-disable-next-line jsdoc/reject-any-type
88
/** @typedef {import("webpack").LoaderContext<any>} LoaderContext */
99

1010
/**
@@ -36,7 +36,7 @@ function findModuleById(compilation, id) {
3636
return null;
3737
}
3838

39-
// eslint-disable-next-line jsdoc/no-restricted-syntax
39+
/* eslint-disable jsdoc/reject-any-type */
4040
/**
4141
* @param {LoaderContext} loaderContext loader context
4242
* @param {string | Buffer} code code
@@ -54,6 +54,7 @@ function evalModuleCode(loaderContext, code, filename) {
5454

5555
return module.exports;
5656
}
57+
/* eslint-enable jsdoc/reject-any-type */
5758

5859
/**
5960
* @param {string} a a
@@ -203,14 +204,15 @@ function getUndoPath(filename, outputPath, enforceRelative) {
203204
: append;
204205
}
205206

206-
// eslint-disable-next-line jsdoc/no-restricted-syntax
207+
/* eslint-disable jsdoc/reject-function-type */
207208
/**
208209
* @param {string | Function} value local
209210
* @returns {string} stringified local
210211
*/
211212
function stringifyLocal(value) {
212213
return typeof value === "function" ? value.toString() : JSON.stringify(value);
213214
}
215+
/* eslint-enable jsdoc/reject-function-type */
214216

215217
/**
216218
* @param {string} str string

test/HMR.test.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
* @jest-environment jsdom
33
*/
44
/* global document */
5-
/* eslint-env browser */
65

76
import hotModuleReplacement from "../src/hmr/hotModuleReplacement";
87
import { hotLoader } from "../src/loader";

test/__snapshots__/emit-option.test.js.snap

Lines changed: 0 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,5 @@
11
// Jest Snapshot v1, https://goo.gl/fbAQLP
22

3-
exports[`emit option should invalidate the cache with disabled "emit" option: assets 1`] = `
4-
Array [
5-
"main.js",
6-
"static/react.svg",
7-
]
8-
`;
9-
10-
exports[`emit option should invalidate the cache with disabled "emit" option: assets 2`] = `
11-
Array [
12-
"main.js",
13-
]
14-
`;
15-
16-
exports[`emit option should invalidate the cache with disabled "emit" option: emittedAssets 1`] = `
17-
Array [
18-
"main.js",
19-
"static/react.svg",
20-
]
21-
`;
22-
23-
exports[`emit option should invalidate the cache with disabled "emit" option: emittedAssets 2`] = `Array []`;
24-
25-
exports[`emit option should invalidate the cache with disabled "emit" option: errors 1`] = `Array []`;
26-
27-
exports[`emit option should invalidate the cache with disabled "emit" option: errors 2`] = `Array []`;
28-
29-
exports[`emit option should invalidate the cache with disabled "emit" option: warnings 1`] = `Array []`;
30-
31-
exports[`emit option should invalidate the cache with disabled "emit" option: warnings 2`] = `Array []`;
32-
333
exports[`emit option should work when emit option is "false": assets 1`] = `
344
Array [
355
"main.js",
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
"use strict";
22
(self["webpackChunk"] = self["webpackChunk"] || []).push([[0],{
33

4-
/***/ 2:
5-
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
4+
/***/ 2
5+
(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
66

77
__webpack_require__.r(__webpack_exports__);
88
// extracted by mini-css-extract-plugin
99

1010

11-
/***/ })
11+
/***/ }
1212

1313
}]);
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
"use strict";
22
(self["webpackChunk"] = self["webpackChunk"] || []).push([[0],{
33

4-
/***/ 2:
5-
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
4+
/***/ 2
5+
(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
66

77
__webpack_require__.r(__webpack_exports__);
88
// extracted by mini-css-extract-plugin
99

1010

11-
/***/ })
11+
/***/ }
1212

1313
}]);

0 commit comments

Comments
 (0)