Skip to content

Commit 794f0fb

Browse files
committed
remove duplication of default params
1 parent 8464614 commit 794f0fb

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

index.js

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,17 @@ class HTMLValidatePlugin {
77
{
88
// default values
99
path: 'src/**/*',
10-
extensions: 'html',
11-
config: '.htmlvalidate',
10+
extensions: ['html'],
11+
config: false,
1212
global: false,
1313
},
14-
// destructure params
1514
({
15+
// destructure params
1616
path: this.path,
1717
extensions: this.extensions,
1818
config: this.config,
1919
global: this.global,
20+
// user provided params override defaults
2021
} = options)
2122
);
2223
}
@@ -44,12 +45,10 @@ class HTMLValidatePlugin {
4445
apply(compiler) {
4546
// initiate script when webpack compilation is completed
4647
compiler.hooks.done.tap('HTMLValidatePlugin', () => {
47-
const path = `${this.path || 'src/**/*'}`;
48-
const extension = `${this.convertExtensionArrayToRegex()}`;
49-
const config = `${'--config ' + this.config + '.json'}`;
50-
5148
// set up cli payload
52-
const userParams = `${path}.${extension} ${config}`;
49+
const userParams = `${this.path}.${this.convertExtensionArrayToRegex()} ${
50+
this.config ? '--config ' + this.config + '.json' : this.config
51+
}`;
5352
const spawnParams = {
5453
shell: true,
5554
/*inherit color output */ stdio: 'inherit',

0 commit comments

Comments
 (0)