Skip to content

Commit

Permalink
refactor: fix ts
Browse files Browse the repository at this point in the history
  • Loading branch information
alexander-akait committed Jan 6, 2021
1 parent 2a0edc1 commit 1ceb0cb
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions packages/configtest/src/index.ts
Expand Up @@ -17,17 +17,21 @@ class ConfigTestCommand {
const config = await cli.resolveConfig({ config: [configPath] });

try {
const error = webpack.validate(config.options);
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const error: any = webpack.validate(config.options);

// TODO remove this after drop webpack@4
if (error && error.length > 0) {
// eslint-disable-next-line @typescript-eslint/ban-ts-ignore
// @ts-ignore
throw new webpack.WebpackOptionsValidationError(error);
}
} catch (error) {
const isValidationError = (error) => {
// https://github.com/webpack/webpack/blob/master/lib/index.js#L267
// https://github.com/webpack/webpack/blob/v4.44.2/lib/webpack.js#L90
const ValidationError = webpack.ValidationError || webpack.WebpackOptionsValidationError;
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const ValidationError = (webpack.ValidationError || webpack.WebpackOptionsValidationError) as any;

return error instanceof ValidationError;
};
Expand Down

0 comments on commit 1ceb0cb

Please sign in to comment.