Skip to content

Commit 991b360

Browse files
committed
fix useless-escape linting issues
1 parent 742b23d commit 991b360

File tree

10 files changed

+13
-13
lines changed

10 files changed

+13
-13
lines changed

bin/convert-argv.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -300,7 +300,7 @@ module.exports = function(yargs, argv, convertOptions) {
300300
binding += "-loader";
301301
}
302302
var rule = {
303-
test: new RegExp("\\." + name.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, "\\$&") + "$"),
303+
test: new RegExp("\\." + name.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, "\\$&") + "$"), // eslint-disable-line no-useless-escape
304304
loader: binding
305305
};
306306
if(arg === "module-bind-pre") {

lib/MultiCompiler.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,8 @@ module.exports = class MultiCompiler extends Tapable {
4646
get outputPath() {
4747
let commonPath = this.compilers[0].outputPath;
4848
for(const compiler of this.compilers) {
49-
while(compiler.outputPath.indexOf(commonPath) !== 0 && /[\/\\]/.test(commonPath)) {
50-
commonPath = commonPath.replace(/[\/\\][^\/\\]*$/, "");
49+
while(compiler.outputPath.indexOf(commonPath) !== 0 && /[/\\]/.test(commonPath)) {
50+
commonPath = commonPath.replace(/[/\\][^/\\]*$/, "");
5151
}
5252
}
5353

lib/Parser.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1102,7 +1102,7 @@ class Parser extends Tapable {
11021102
result = this.applyPluginsBailResult1("call " + callee.identifier, expression);
11031103
if(result === true)
11041104
return;
1105-
let identifier = callee.identifier.replace(/\.[^\.]+$/, ".*");
1105+
let identifier = callee.identifier.replace(/\.[^.]+$/, ".*");
11061106
if(identifier !== callee.identifier) {
11071107
result = this.applyPluginsBailResult1("call " + identifier, expression);
11081108
if(result === true)

lib/Stats.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ class Stats {
108108
const showPublicPath = optionOrLocalFallback(options.publicPath, !forToString);
109109
const excludeModules = [].concat(optionOrFallback(options.exclude, [])).map(item => {
110110
if(typeof item === "string") {
111-
const regExp = new RegExp(`[\\\\/]${item.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, "\\$&")}([\\\\/]|$|!|\\?)`);
111+
const regExp = new RegExp(`[\\\\/]${item.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, "\\$&")}([\\\\/]|$|!|\\?)`); // eslint-disable-line no-useless-escape
112112
return ident => regExp.test(ident);
113113
}
114114
if(item && typeof item === "object" && typeof item.test === "function")

lib/Template.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ module.exports = class Template extends Tapable {
2828

2929
static toPath(str) {
3030
if(typeof str !== "string") return "";
31-
return str.replace(/[^a-zA-Z0-9_!§$()=\-\^°]+/g, "-").replace(/^-|-$/, "");
31+
return str.replace(/[^a-zA-Z0-9_!§$()=\-^°]+/g, "-").replace(/^-|-$/, "");
3232
}
3333

3434
// map number to a single character a-z, A-Z or <_ + number> if number is too big

lib/dependencies/HarmonyCompatibilityDependency.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ HarmonyCompatibilityDependency.Template = class HarmonyExportDependencyTemplate
2121
const usedExports = dep.originModule.usedExports;
2222
if(usedExports && !Array.isArray(usedExports)) {
2323
const exportName = dep.originModule.exportsArgument || "exports";
24-
const content = `Object.defineProperty(${exportName}, \"__esModule\", { value: true });\n`;
24+
const content = `Object.defineProperty(${exportName}, "__esModule", { value: true });\n`;
2525
source.insert(-10, content);
2626
}
2727
}

lib/optimize/CommonsChunkPlugin.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,8 @@ The available options are:
6060
* that webpack will take care of loading this file.
6161
*/
6262
if(options.async && options.filename) {
63-
throw new Error(`You can not specify a filename if you use the \"async\" option.
64-
You can however specify the name of the async chunk by passing the desired string as the \"async\" option.`);
63+
throw new Error(`You can not specify a filename if you use the "async" option.
64+
You can however specify the name of the async chunk by passing the desired string as the "async" option.`);
6565
}
6666

6767
/**

test/binCases/config-name/not-found/test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@
33
module.exports = function testAssertions(code, stdout, stderr) {
44
code.should.not.eql(0);
55
stdout.should.be.empty();
6-
stderr[0].should.containEql("Configuration with name \'foo\' was not found.");
6+
stderr[0].should.containEql("Configuration with name 'foo' was not found.");
77
};
88

test/configCases/rule-set/custom/webpack.config.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@ module.exports = {
77
return {
88
loader: "./loader",
99
options: {
10-
resource: data.resource.replace(/^.*[\\\/]/g, ""),
10+
resource: data.resource.replace(/^.*[\\/]/g, ""),
1111
resourceQuery: data.resourceQuery,
12-
issuer: data.issuer.replace(/^.*[\\\/]/g, ""),
12+
issuer: data.issuer.replace(/^.*[\\/]/g, ""),
1313
}
1414
};
1515
}

test/statsCases/named-chunks-plugin-async/webpack.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ module.exports = {
1414
}
1515
const chunkModulesToName = (chunk) => chunk.mapModules((mod) => {
1616
const rs = new RequestShortener(mod.context);
17-
return rs.shorten(mod.request).replace(/[.\/\\]/g, "_");
17+
return rs.shorten(mod.request).replace(/[./\\]/g, "_");
1818
}).join("-");
1919

2020
if(chunk.getNumberOfModules() > 0) {

0 commit comments

Comments
 (0)