Skip to content

Commit

Permalink
fix useless-escape linting issues
Browse files Browse the repository at this point in the history
  • Loading branch information
sokra committed Jul 24, 2017
1 parent 742b23d commit 991b360
Show file tree
Hide file tree
Showing 10 changed files with 13 additions and 13 deletions.
2 changes: 1 addition & 1 deletion bin/convert-argv.js
Expand Up @@ -300,7 +300,7 @@ module.exports = function(yargs, argv, convertOptions) {
binding += "-loader";
}
var rule = {
test: new RegExp("\\." + name.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, "\\$&") + "$"),
test: new RegExp("\\." + name.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, "\\$&") + "$"), // eslint-disable-line no-useless-escape
loader: binding
};
if(arg === "module-bind-pre") {
Expand Down
4 changes: 2 additions & 2 deletions lib/MultiCompiler.js
Expand Up @@ -46,8 +46,8 @@ module.exports = class MultiCompiler extends Tapable {
get outputPath() {
let commonPath = this.compilers[0].outputPath;
for(const compiler of this.compilers) {
while(compiler.outputPath.indexOf(commonPath) !== 0 && /[\/\\]/.test(commonPath)) {
commonPath = commonPath.replace(/[\/\\][^\/\\]*$/, "");
while(compiler.outputPath.indexOf(commonPath) !== 0 && /[/\\]/.test(commonPath)) {
commonPath = commonPath.replace(/[/\\][^/\\]*$/, "");
}
}

Expand Down
2 changes: 1 addition & 1 deletion lib/Parser.js
Expand Up @@ -1102,7 +1102,7 @@ class Parser extends Tapable {
result = this.applyPluginsBailResult1("call " + callee.identifier, expression);
if(result === true)
return;
let identifier = callee.identifier.replace(/\.[^\.]+$/, ".*");
let identifier = callee.identifier.replace(/\.[^.]+$/, ".*");
if(identifier !== callee.identifier) {
result = this.applyPluginsBailResult1("call " + identifier, expression);
if(result === true)
Expand Down
2 changes: 1 addition & 1 deletion lib/Stats.js
Expand Up @@ -108,7 +108,7 @@ class Stats {
const showPublicPath = optionOrLocalFallback(options.publicPath, !forToString);
const excludeModules = [].concat(optionOrFallback(options.exclude, [])).map(item => {
if(typeof item === "string") {
const regExp = new RegExp(`[\\\\/]${item.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, "\\$&")}([\\\\/]|$|!|\\?)`);
const regExp = new RegExp(`[\\\\/]${item.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, "\\$&")}([\\\\/]|$|!|\\?)`); // eslint-disable-line no-useless-escape
return ident => regExp.test(ident);
}
if(item && typeof item === "object" && typeof item.test === "function")
Expand Down
2 changes: 1 addition & 1 deletion lib/Template.js
Expand Up @@ -28,7 +28,7 @@ module.exports = class Template extends Tapable {

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

// map number to a single character a-z, A-Z or <_ + number> if number is too big
Expand Down
2 changes: 1 addition & 1 deletion lib/dependencies/HarmonyCompatibilityDependency.js
Expand Up @@ -21,7 +21,7 @@ HarmonyCompatibilityDependency.Template = class HarmonyExportDependencyTemplate
const usedExports = dep.originModule.usedExports;
if(usedExports && !Array.isArray(usedExports)) {
const exportName = dep.originModule.exportsArgument || "exports";
const content = `Object.defineProperty(${exportName}, \"__esModule\", { value: true });\n`;
const content = `Object.defineProperty(${exportName}, "__esModule", { value: true });\n`;
source.insert(-10, content);
}
}
Expand Down
4 changes: 2 additions & 2 deletions lib/optimize/CommonsChunkPlugin.js
Expand Up @@ -60,8 +60,8 @@ The available options are:
* that webpack will take care of loading this file.
*/
if(options.async && options.filename) {
throw new Error(`You can not specify a filename if you use the \"async\" option.
You can however specify the name of the async chunk by passing the desired string as the \"async\" option.`);
throw new Error(`You can not specify a filename if you use the "async" option.
You can however specify the name of the async chunk by passing the desired string as the "async" option.`);
}

/**
Expand Down
2 changes: 1 addition & 1 deletion test/binCases/config-name/not-found/test.js
Expand Up @@ -3,6 +3,6 @@
module.exports = function testAssertions(code, stdout, stderr) {
code.should.not.eql(0);
stdout.should.be.empty();
stderr[0].should.containEql("Configuration with name \'foo\' was not found.");
stderr[0].should.containEql("Configuration with name 'foo' was not found.");
};

4 changes: 2 additions & 2 deletions test/configCases/rule-set/custom/webpack.config.js
Expand Up @@ -7,9 +7,9 @@ module.exports = {
return {
loader: "./loader",
options: {
resource: data.resource.replace(/^.*[\\\/]/g, ""),
resource: data.resource.replace(/^.*[\\/]/g, ""),
resourceQuery: data.resourceQuery,
issuer: data.issuer.replace(/^.*[\\\/]/g, ""),
issuer: data.issuer.replace(/^.*[\\/]/g, ""),
}
};
}
Expand Down
Expand Up @@ -14,7 +14,7 @@ module.exports = {
}
const chunkModulesToName = (chunk) => chunk.mapModules((mod) => {
const rs = new RequestShortener(mod.context);
return rs.shorten(mod.request).replace(/[.\/\\]/g, "_");
return rs.shorten(mod.request).replace(/[./\\]/g, "_");
}).join("-");

if(chunk.getNumberOfModules() > 0) {
Expand Down

0 comments on commit 991b360

Please sign in to comment.