Skip to content

Commit 389980f

Browse files
chore(deps): update
1 parent 3be8153 commit 389980f

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

59 files changed

+2437
-2471
lines changed

.eslintrc.js

+20-5
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
module.exports = {
22
root: true,
33
reportUnusedDisableDirectives: true,
4-
extends: ["eslint:recommended", "plugin:node/recommended", "prettier"],
4+
extends: ["eslint:recommended", "plugin:n/recommended", "prettier"],
55
parserOptions: { ecmaVersion: 2018, sourceType: "script" },
6-
plugins: ["node"],
6+
plugins: ["n"],
77
settings: {
8-
node: {
8+
n: {
99
allowModules: ["@webpack-cli/generators"],
1010
},
1111
},
@@ -16,6 +16,7 @@ module.exports = {
1616
},
1717
rules: {
1818
"no-process-exit": "off",
19+
"n/no-process-exit": "off",
1920
"no-template-curly-in-string": "error",
2021
"no-caller": "error",
2122
"no-extra-bind": "error",
@@ -26,7 +27,7 @@ module.exports = {
2627
overrides: [
2728
{
2829
settings: {
29-
node: {
30+
n: {
3031
tryExtensions: [".ts", ".tsx", ".js", ".jsx", ".json"],
3132
},
3233
},
@@ -39,7 +40,21 @@ module.exports = {
3940
parser: "@typescript-eslint/parser",
4041
plugins: ["@typescript-eslint"],
4142
rules: {
42-
"node/no-unsupported-features/es-syntax": "off",
43+
"@typescript-eslint/no-unused-vars": [
44+
"error",
45+
{
46+
args: "all",
47+
argsIgnorePattern: "^_",
48+
caughtErrors: "all",
49+
caughtErrorsIgnorePattern: "^_",
50+
destructuredArrayIgnorePattern: "^_",
51+
varsIgnorePattern: "^_",
52+
ignoreRestSiblings: true,
53+
},
54+
],
55+
"n/no-unsupported-features/es-syntax": "off",
56+
"n/no-process-exit": "off",
57+
"@typescript-eslint/no-require-imports": "off",
4358
},
4459
},
4560
],

.github/CONTRIBUTING.md

+1-2
Original file line numberDiff line numberDiff line change
@@ -69,10 +69,9 @@ In case you are suggesting a new feature, we will match your idea with our curre
6969
yarn install
7070
```
7171

72-
- Bootstrap all the submodules before building for the first time
72+
- Build all the submodules before building for the first time
7373

7474
```bash
75-
yarn lerna bootstrap
7675
yarn build
7776
```
7877

.github/workflows/dependency-review.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,4 @@ jobs:
1111
- name: "Checkout Repository"
1212
uses: actions/checkout@v4
1313
- name: "Dependency Review"
14-
uses: actions/dependency-review-action@v3
14+
uses: actions/dependency-review-action@v4

.github/workflows/nodejs.yml

+2-5
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,6 @@ jobs:
4545
- name: Install dependencies
4646
run: yarn --frozen-lockfile
4747

48-
- name: Bootstrap
49-
run: yarn lerna bootstrap
50-
5148
- name: Build
5249
run: yarn build
5350

@@ -101,11 +98,11 @@ jobs:
10198
version: 7
10299

103100
- name: Install dependencies
104-
run: yarn --frozen-lockfile --ignore-engines
101+
run: yarn --frozen-lockfile --ignore-engines --ignore-scripts
105102

106103
- name: Install webpack-dev-server ${{ matrix.dev-server-version }}
107104
if: matrix.dev-server-version == '4'
108-
run: yarn add -W -D webpack-dev-server@${{ matrix.dev-server-version }} --ignore-engines
105+
run: yarn add -W -D webpack-dev-server@${{ matrix.dev-server-version }} --ignore-engines --ignore-scripts
109106

110107
- name: Prepare environment for tests
111108
run: yarn build:ci

.github/workflows/update-docs.yml

-3
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,6 @@ jobs:
3939
- name: Install latest webpack and webpack-dev-server version
4040
run: yarn add -W webpack-dev-server@latest webpack@latest
4141

42-
- name: Bootstrap
43-
run: yarn lerna bootstrap
44-
4542
- name: Build
4643
run: yarn build
4744

.husky/commit-msg

+1-4
Original file line numberDiff line numberDiff line change
@@ -1,4 +1 @@
1-
#!/bin/sh
2-
. "$(dirname "$0")/_/husky.sh"
3-
4-
npx --no-install commitlint --edit $1
1+
commitlint --edit $1

.husky/pre-commit

+1-4
Original file line numberDiff line numberDiff line change
@@ -1,4 +1 @@
1-
#!/bin/sh
2-
. "$(dirname "$0")/_/husky.sh"
3-
4-
npx lint-staged
1+
lint-staged

package.json

+12-12
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@
4747
"test:watch": "jest test/ packages/ --watch",
4848
"publish:monorepo": "yarn build && lerna version && lerna publish from-git",
4949
"update:docs": "node ./scripts/update-docs",
50-
"prepare": "husky install"
50+
"prepare": "husky"
5151
},
5252
"peerDependencies": {
5353
"webpack": "5.x.x"
@@ -56,33 +56,33 @@
5656
"@babel/core": "^7.22.1",
5757
"@babel/preset-env": "^7.22.4",
5858
"@babel/register": "^7.15.8",
59-
"@commitlint/cli": "^17.1.2",
60-
"@commitlint/config-conventional": "^17.1.0",
59+
"@commitlint/cli": "^19.4.0",
60+
"@commitlint/config-conventional": "^19.2.2",
6161
"@types/jest": "^29.4.0",
62-
"@types/node": "^20.11.5",
62+
"@types/node": "^22.2.0",
6363
"@types/rechoir": "^0.6.1",
64-
"@typescript-eslint/eslint-plugin": "^5.49.0",
65-
"@typescript-eslint/parser": "^5.49.0",
64+
"@typescript-eslint/eslint-plugin": "^8.1.0",
65+
"@typescript-eslint/parser": "^8.1.0",
6666
"coffeescript": "^2.7.0",
6767
"colorette": "^2.0.16",
6868
"concat-stream": "^2.0.0",
6969
"cspell": "^8.3.2",
7070
"css-loader": "^6.10.0",
7171
"del-cli": "^5.0.0",
7272
"eslint": "^8.33.0",
73-
"eslint-config-prettier": "^8.5.0",
74-
"eslint-plugin-node": "^11.1.0",
73+
"eslint-config-prettier": "^9.1.0",
74+
"eslint-plugin-n": "^17.10.2",
7575
"execa": "^5.0.0",
7676
"get-port": "^5.1.1",
77-
"husky": "^8.0.1",
77+
"husky": "^9.1.4",
7878
"internal-ip": "^6.2.0",
7979
"jest": "^29.4.1",
8080
"jest-watch-typeahead": "^2.2.2",
81-
"lerna": "^6.0.1",
82-
"lint-staged": "^13.0.3",
81+
"lerna": "^8.1.8",
82+
"lint-staged": "^15.2.9",
8383
"mini-css-extract-plugin": "^2.6.1",
8484
"nyc": "^15.1.0",
85-
"prettier": "^2.7.0",
85+
"prettier": "^3.3.3",
8686
"readable-stream": "^4.5.2",
8787
"rimraf": "^3.0.2",
8888
"sass": "^1.54.9",

packages/generators/src/addon-generator.ts

+1-3
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,9 @@ import path from "path";
33
import Generator from "yeoman-generator";
44

55
import { CustomGenerator } from "./custom-generator";
6-
import type { CustomGeneratorOptions, BaseCustomGeneratorOptions } from "./types";
6+
import type { CustomGeneratorOptions, BaseCustomGeneratorOptions } from "./types/index";
77
import { getInstaller, getTemplate } from "./utils/helpers";
88

9-
// eslint-disable-next-line @typescript-eslint/no-var-requires
109
Object.assign(Generator.prototype, require("yeoman-generator/lib/actions/install"));
1110

1211
// Helper to get the template-directory content
@@ -90,7 +89,6 @@ const addonGenerator = <
9089

9190
this.fs.extendJSON(
9291
this.destinationPath("package.json"),
93-
// eslint-disable-next-line @typescript-eslint/no-var-requires
9492
require(packageJsonTemplatePath)(name),
9593
);
9694

packages/generators/src/custom-generator.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import Generator from "yeoman-generator";
22
import { type IWebpackCLI } from "webpack-cli";
33
import path from "path";
4-
import { BaseCustomGeneratorOptions, CustomGeneratorOptions } from "./types";
4+
import { BaseCustomGeneratorOptions, CustomGeneratorOptions } from "./types/index";
55

66
export class CustomGenerator<
77
T extends BaseCustomGeneratorOptions = BaseCustomGeneratorOptions,

packages/generators/src/handlers/default.ts

-2
Original file line numberDiff line numberDiff line change
@@ -176,12 +176,10 @@ export async function questions(
176176
* @param self Generator values
177177
*/
178178
export function generate(self: CustomGenerator): void {
179-
// eslint-disable-next-line @typescript-eslint/no-var-requires
180179
const destPkgJson = require(resolveFile("package.json.js"))(self.answers.devServer);
181180
const sourcePkgJsonPath = self.destinationPath("package.json");
182181

183182
try {
184-
// eslint-disable-next-line @typescript-eslint/no-var-requires
185183
const sourcePkgJson = require(sourcePkgJsonPath);
186184

187185
// Make sure that we do not override set metadata

packages/generators/src/index.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import loaderGenerator from "./loader-generator";
33
import pluginGenerator from "./plugin-generator";
44
import addonGenerator from "./addon-generator";
55
import initGenerator from "./init-generator";
6-
import type { InitOptions, LoaderOptions, PluginOptions } from "./types";
6+
import type { InitOptions, LoaderOptions, PluginOptions } from "./types/index";
77
import type { IWebpackCLI } from "webpack-cli";
88

99
class GeneratorsCommand {

packages/generators/src/init-generator.ts

+7-7
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { getInstaller, getTemplate } from "./utils/helpers";
55
import * as Question from "./utils/scaffold-utils";
66
import handlers from "./handlers";
77

8-
import { type InitGeneratorOptions, type CustomGeneratorOptions } from "./types";
8+
import { type InitGeneratorOptions, type CustomGeneratorOptions } from "./types/index";
99

1010
export default class InitGenerator<
1111
T extends InitGeneratorOptions = InitGeneratorOptions,
@@ -27,9 +27,9 @@ export default class InitGenerator<
2727

2828
// Handle installation of prettier
2929
try {
30-
// eslint-disable-next-line node/no-extraneous-require
30+
// eslint-disable-next-line n/no-extraneous-require
3131
require.resolve("prettier");
32-
} catch (err) {
32+
} catch (_err) {
3333
const { installPrettier } = await Question.Confirm(
3434
this,
3535
"installPrettier",
@@ -64,16 +64,16 @@ export default class InitGenerator<
6464
handlers[this.template as keyof typeof handlers].generate(this);
6565
}
6666

67-
public end(): void {
67+
public async end(): Promise<void> {
6868
// Prettify configuration file if possible
6969
try {
70-
// eslint-disable-next-line node/no-extraneous-require, @typescript-eslint/no-var-requires
70+
// eslint-disable-next-line n/no-extraneous-require
7171
const prettier = require("prettier");
7272
const source = readFileSync(this.configurationPath as string, { encoding: "utf8" });
73-
const formattedSource = prettier.format(source, { parser: "babel" });
73+
const formattedSource = await prettier.format(source, { parser: "babel" });
7474

7575
writeFileSync(this.configurationPath as string, formattedSource);
76-
} catch (err) {
76+
} catch (_err) {
7777
this.cli.logger.log(
7878
`${this.cli.colors.yellow(
7979
`⚠ Generated configuration may not be properly formatted as prettier is not installed.`,

packages/generators/src/loader-generator.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import path from "path";
22
import addonGenerator from "./addon-generator";
33
import { toKebabCase } from "./utils/helpers";
44

5-
import type { LoaderGeneratorOptions } from "./types";
5+
import type { LoaderGeneratorOptions } from "./types/index";
66
import type Generator from "yeoman-generator";
77

88
/**

packages/generators/src/plugin-generator.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import path from "path";
22
import addonGenerator from "./addon-generator";
33
import { toKebabCase, toUpperCamelCase } from "./utils/helpers";
4-
import type { PluginGeneratorOptions } from "./types";
4+
import type { PluginGeneratorOptions } from "./types/index";
55
import type Generator from "yeoman-generator";
66

77
export const PluginGenerator = addonGenerator<PluginGeneratorOptions>(

packages/serve/src/index.ts

+2-4
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ type Problem = NonNullable<ReturnType<(typeof cli)["processArguments"]>>[0];
99
class ServeCommand {
1010
async apply(cli: IWebpackCLI): Promise<void> {
1111
const loadDevServerOptions = () => {
12-
// eslint-disable-next-line @typescript-eslint/no-var-requires
1312
const devServer = require(WEBPACK_DEV_SERVER_PACKAGE);
1413
// eslint-disable-next-line @typescript-eslint/no-explicit-any
1514
const options: Record<string, any> = cli.webpack.cli.getArguments(devServer.schema);
@@ -56,7 +55,7 @@ class ServeCommand {
5655

5756
try {
5857
devServerFlags = loadDevServerOptions();
59-
} catch (error) {
58+
} catch (_err) {
6059
// Nothing, to prevent future updates
6160
}
6261

@@ -124,11 +123,10 @@ class ServeCommand {
124123
process.stdin.resume();
125124
}
126125

127-
// eslint-disable-next-line @typescript-eslint/no-var-requires
128126
const DevServer = require(WEBPACK_DEV_SERVER_PACKAGE);
129127

130128
try {
131-
// eslint-disable-next-line @typescript-eslint/no-var-requires
129+
// eslint-disable-next-line @typescript-eslint/no-unused-expressions
132130
require(`${WEBPACK_DEV_SERVER_PACKAGE}/package.json`).version;
133131
} catch (err) {
134132
cli.logger.error(

packages/webpack-cli/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
"!**/*__tests__"
3535
],
3636
"dependencies": {
37-
"@discoveryjs/json-ext": "^0.5.0",
37+
"@discoveryjs/json-ext": "^0.6.1",
3838
"@webpack-cli/configtest": "^2.1.1",
3939
"@webpack-cli/info": "^2.0.2",
4040
"@webpack-cli/serve": "^2.0.5",

packages/webpack-cli/src/bootstrap.ts

-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import { type IWebpackCLI } from "./types";
22

3-
// eslint-disable-next-line @typescript-eslint/no-var-requires
43
const WebpackCLI = require("./webpack-cli");
54

65
const runCLI = async (args: Parameters<IWebpackCLI["run"]>[0]) => {

packages/webpack-cli/src/index.ts

-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import { type IWebpackCLI } from "./types";
22
export type * from "./types";
33

4-
// eslint-disable-next-line @typescript-eslint/no-var-requires
54
const CLI: IWebpackCLI = require("./webpack-cli");
65

76
module.exports = CLI;

packages/webpack-cli/src/plugins/cli-plugin.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ export class CLIPlugin {
1010
}
1111

1212
async setupBundleAnalyzerPlugin(compiler: Compiler) {
13-
// eslint-disable-next-line node/no-extraneous-require,@typescript-eslint/no-var-requires
13+
// eslint-disable-next-line n/no-extraneous-require
1414
const { BundleAnalyzerPlugin } = require("webpack-bundle-analyzer");
1515
const bundleAnalyzerPlugin = Boolean(
1616
compiler.options.plugins.find((plugin) => plugin instanceof BundleAnalyzerPlugin),

packages/webpack-cli/src/types.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,13 @@ import type webpack from "webpack";
1616

1717
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
1818
// @ts-ignore extraneous import is intended
19-
// eslint-disable-next-line node/no-extraneous-import
19+
// eslint-disable-next-line n/no-extraneous-import
2020
import type { ClientConfiguration, Configuration as DevServerConfig } from "webpack-dev-server";
2121

2222
import { type Colorette } from "colorette";
2323
import { type Command, type CommandOptions, type Option, type ParseOptions } from "commander";
2424
import { type prepare } from "rechoir";
25-
import { type stringifyStream } from "@discoveryjs/json-ext";
25+
import { type stringifyChunked } from "@discoveryjs/json-ext";
2626

2727
/**
2828
* Webpack CLI
@@ -289,7 +289,7 @@ interface Rechoir {
289289
}
290290

291291
interface JsonExt {
292-
stringifyStream: typeof stringifyStream;
292+
stringifyChunked: typeof stringifyChunked;
293293
}
294294

295295
interface RechoirError extends Error {

packages/webpack-cli/src/utils/dynamic-import-loader.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ function dynamicImportLoader<T>(): DynamicImport<T> | null {
55

66
try {
77
importESM = new Function("id", "return import(id);");
8-
} catch (e) {
8+
} catch (_err) {
99
importESM = null;
1010
}
1111

0 commit comments

Comments
 (0)