Skip to content

Commit

Permalink
fix linting
Browse files Browse the repository at this point in the history
  • Loading branch information
sokra committed Feb 25, 2018
1 parent 5238159 commit f32bd41
Show file tree
Hide file tree
Showing 18 changed files with 40 additions and 36 deletions.
2 changes: 1 addition & 1 deletion lib/Chunk.js
Expand Up @@ -162,8 +162,8 @@ class Chunk {
if (this._modules.size < otherChunk._modules.size) return 1;
const a = this._modules[Symbol.iterator]();
const b = otherChunk._modules[Symbol.iterator]();
// eslint-disable-next-line
while (true) {
// eslint-disable-line
const aItem = a.next();
const bItem = b.next();
if (aItem.done) return 0;
Expand Down
6 changes: 3 additions & 3 deletions lib/HotModuleReplacement.runtime.js
Expand Up @@ -12,8 +12,8 @@ module.exports = function() {
var hotCurrentParents = []; // eslint-disable-line no-unused-vars
var hotCurrentParentsTemp = []; // eslint-disable-line no-unused-vars

// eslint-disable-next-line no-unused-vars
function hotCreateRequire(moduleId) {
// eslint-disable-line no-unused-vars
var me = installedModules[moduleId];
if (!me) return $require$;
var fn = function(request) {
Expand Down Expand Up @@ -80,8 +80,8 @@ module.exports = function() {
return fn;
}

// eslint-disable-next-line no-unused-vars
function hotCreateModule(moduleId) {
// eslint-disable-line no-unused-vars
var hot = {
// private stuff
_acceptedDependencies: {},
Expand Down Expand Up @@ -206,8 +206,8 @@ module.exports = function() {
});
}

// eslint-disable-next-line no-unused-vars
function hotAddUpdateChunk(chunkId, moreModules) {
// eslint-disable-line no-unused-vars
if (!hotAvailableFilesMap[chunkId] || !hotRequestedFilesMap[chunkId])
return;
hotRequestedFilesMap[chunkId] = false;
Expand Down
2 changes: 1 addition & 1 deletion lib/Module.js
Expand Up @@ -163,8 +163,8 @@ class Module extends DependenciesBlock {
otherModule._chunks.sortWith(sortByDebugId);
const a = this._chunks[Symbol.iterator]();
const b = otherModule._chunks[Symbol.iterator]();
// eslint-disable-next-line no-constant-condition
while (true) {
// eslint-disable-line
const aItem = a.next();
const bItem = b.next();
if (aItem.done) return true;
Expand Down
4 changes: 2 additions & 2 deletions lib/MultiCompiler.js
Expand Up @@ -34,8 +34,8 @@ module.exports = class MultiCompiler extends Tapable {
for (const compiler of this.compilers) {
let compilerDone = false;
const compilerIndex = index++;
// eslint-disable-next-line no-loop-func
compiler.hooks.done.tap("MultiCompiler", stats => {
// eslint-disable-line no-loop-func
if (!compilerDone) {
compilerDone = true;
doneCompilers++;
Expand All @@ -45,8 +45,8 @@ module.exports = class MultiCompiler extends Tapable {
this.hooks.done.call(new MultiStats(compilerStats));
}
});
// eslint-disable-next-line no-loop-func
compiler.hooks.invalid.tap("MultiCompiler", () => {
// eslint-disable-line no-loop-func
if (compilerDone) {
compilerDone = false;
doneCompilers--;
Expand Down
4 changes: 3 additions & 1 deletion lib/Parser.js
Expand Up @@ -2055,7 +2055,9 @@ class Parser extends Tapable {
try {
ast = acorn.parse(code, parserOptions);
threw = false;
} catch (e) {}
} catch (e) {
threw = true;
}
}

if (threw) {
Expand Down
2 changes: 1 addition & 1 deletion lib/Stats.js
Expand Up @@ -97,7 +97,7 @@ class Stats {
if (typeof item === "string") {
const regExp = new RegExp(
`[\\\\/]${item.replace(
/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,
/[-[\]{}()*+?.\\^$|]/g,
"\\$&"
)}([\\\\/]|$|!|\\?)`
); // eslint-disable-line no-useless-escape
Expand Down
6 changes: 3 additions & 3 deletions lib/node/NodeMainTemplate.runtime.js
Expand Up @@ -4,14 +4,14 @@
*/
/*global installedChunks $hotChunkFilename$ hotAddUpdateChunk $hotMainFilename$ */
module.exports = function() {
// eslint-disable-next-line no-unused-vars
function hotDownloadUpdateChunk(chunkId) {
// eslint-disable-line no-unused-vars
var chunk = require("./" + $hotChunkFilename$);
hotAddUpdateChunk(chunk.id, chunk.modules);
}

// eslint-disable-next-line no-unused-vars
function hotDownloadManifest() {
// eslint-disable-line no-unused-vars
try {
var update = require("./" + $hotMainFilename$);
} catch (e) {
Expand All @@ -20,8 +20,8 @@ module.exports = function() {
return Promise.resolve(update);
}

//eslint-disable-next-line no-unused-vars
function hotDisposeChunk(chunkId) {
//eslint-disable-line no-unused-vars
delete installedChunks[chunkId];
}
};
6 changes: 3 additions & 3 deletions lib/node/NodeMainTemplateAsync.runtime.js
Expand Up @@ -4,8 +4,8 @@
*/
/*global installedChunks $hotChunkFilename$ $require$ hotAddUpdateChunk $hotMainFilename$ */
module.exports = function() {
// eslint-disable-next-line no-unused-vars
function hotDownloadUpdateChunk(chunkId) {
// eslint-disable-line no-unused-vars
var filename = require("path").join(__dirname, $hotChunkFilename$);
require("fs").readFile(filename, "utf-8", function(err, content) {
if (err) {
Expand All @@ -21,8 +21,8 @@ module.exports = function() {
});
}

// eslint-disable-next-line no-unused-vars
function hotDownloadManifest() {
// eslint-disable-line no-unused-vars
var filename = require("path").join(__dirname, $hotMainFilename$);
return new Promise(function(resolve, reject) {
require("fs").readFile(filename, "utf-8", function(err, content) {
Expand All @@ -37,8 +37,8 @@ module.exports = function() {
});
}

//eslint-disable-next-line no-unused-vars
function hotDisposeChunk(chunkId) {
//eslint-disable-line no-unused-vars
delete installedChunks[chunkId];
}
};
2 changes: 1 addition & 1 deletion lib/optimize/AggressiveSplittingPlugin.js
Expand Up @@ -158,8 +158,8 @@ class AggressiveSplittingPlugin {
modulesB.sort();
const aI = modulesA[Symbol.iterator]();
const bI = modulesB[Symbol.iterator]();
// eslint-disable-next-line no-constant-condition
while (true) {
// eslint-disable-line
const aItem = aI.next();
const bItem = bI.next();
if (aItem.done) return 0;
Expand Down
2 changes: 1 addition & 1 deletion lib/optimize/SplitChunksPlugin.js
Expand Up @@ -66,8 +66,8 @@ const compareEntries = (a, b) => {
modulesB.sort();
const aI = modulesA[Symbol.iterator]();
const bI = modulesB[Symbol.iterator]();
// eslint-disable-next-line no-constant-condition
while (true) {
// eslint-disable-line
const aItem = aI.next();
const bItem = bI.next();
if (aItem.done) return 0;
Expand Down
6 changes: 3 additions & 3 deletions lib/web/JsonpMainTemplate.runtime.js
Expand Up @@ -4,14 +4,14 @@
*/
/*globals hotAddUpdateChunk parentHotUpdateCallback document XMLHttpRequest $require$ $hotChunkFilename$ $hotMainFilename$ $crossOriginLoading$ */
module.exports = function() {
// eslint-disable-next-line no-unused-vars
function webpackHotUpdateCallback(chunkId, moreModules) {
// eslint-disable-line no-unused-vars
hotAddUpdateChunk(chunkId, moreModules);
if (parentHotUpdateCallback) parentHotUpdateCallback(chunkId, moreModules);
} //$semicolon

// eslint-disable-next-line no-unused-vars
function hotDownloadUpdateChunk(chunkId) {
// eslint-disable-line no-unused-vars
var head = document.getElementsByTagName("head")[0];
var script = document.createElement("script");
script.charset = "utf-8";
Expand All @@ -20,8 +20,8 @@ module.exports = function() {
head.appendChild(script);
}

// eslint-disable-next-line no-unused-vars
function hotDownloadManifest(requestTimeout) {
// eslint-disable-line no-unused-vars
requestTimeout = requestTimeout || 10000;
return new Promise(function(resolve, reject) {
if (typeof XMLHttpRequest === "undefined")
Expand Down
8 changes: 4 additions & 4 deletions lib/webworker/WebWorkerMainTemplate.runtime.js
Expand Up @@ -4,19 +4,19 @@
*/
/*globals installedChunks hotAddUpdateChunk parentHotUpdateCallback importScripts XMLHttpRequest $require$ $hotChunkFilename$ $hotMainFilename$ */
module.exports = function() {
// eslint-disable-next-line no-unused-vars
function webpackHotUpdateCallback(chunkId, moreModules) {
// eslint-disable-line no-unused-vars
hotAddUpdateChunk(chunkId, moreModules);
if (parentHotUpdateCallback) parentHotUpdateCallback(chunkId, moreModules);
} //$semicolon

// eslint-disable-next-line no-unused-vars
function hotDownloadUpdateChunk(chunkId) {
// eslint-disable-line no-unused-vars
importScripts($require$.p + $hotChunkFilename$);
}

// eslint-disable-next-line no-unused-vars
function hotDownloadManifest(requestTimeout) {
// eslint-disable-line no-unused-vars
requestTimeout = requestTimeout || 10000;
return new Promise(function(resolve, reject) {
if (typeof XMLHttpRequest === "undefined")
Expand Down Expand Up @@ -57,8 +57,8 @@ module.exports = function() {
});
}

//eslint-disable-next-line no-unused-vars
function hotDisposeChunk(chunkId) {
//eslint-disable-line no-unused-vars
delete installedChunks[chunkId];
}
};
6 changes: 3 additions & 3 deletions test/BenchmarkTestCases.benchmark.js
Expand Up @@ -22,10 +22,10 @@ describe("BenchmarkTestCases", function() {

try {
fs.mkdirSync(path.join(__dirname, "js"));
} catch (e) {}
} catch (e) {} // eslint-disable-line no-empty
try {
fs.mkdirSync(baselinesPath);
} catch (e) {}
} catch (e) {} // eslint-disable-line no-empty

before(function(done) {
this.timeout(270000);
Expand All @@ -43,7 +43,7 @@ describe("BenchmarkTestCases", function() {
} else {
try {
fs.mkdirSync(baselinePath);
} catch (e) {}
} catch (e) {} // eslint-disable-line no-empty
const gitIndex = path.resolve(rootPath, ".git/index");
const index = fs.readFileSync(gitIndex);
git(rootPath).raw(
Expand Down
2 changes: 1 addition & 1 deletion test/ConfigTestCases.test.js
Expand Up @@ -87,7 +87,7 @@ describe("ConfigTestCases", () => {
testConfig,
require(path.join(testDirectory, "test.config.js"))
);
} catch (e) {}
} catch (e) {} // eslint-disable-line no-empty

this.timeout(testConfig.timeout);

Expand Down
4 changes: 2 additions & 2 deletions test/HotModuleReplacementPlugin.test.js
Expand Up @@ -23,10 +23,10 @@ describe("HotModuleReplacementPlugin", function() {
const recordsFile = path.join(__dirname, "js", "records.json");
try {
fs.mkdirSync(path.join(__dirname, "js"));
} catch (e) {}
} catch (e) {} // eslint-disable-line no-empty
try {
fs.unlinkSync(recordsFile);
} catch (e) {}
} catch (e) {} // eslint-disable-line no-empty
const compiler = webpack({
cache: false,
entry: entryFile,
Expand Down
4 changes: 3 additions & 1 deletion test/Parser.unittest.js
Expand Up @@ -475,8 +475,10 @@ describe("Parser", () => {
"wrapped=['str' string=str]+['four' string=four]",
"'str'.concat(obj, 'one', 'two').concat('three', obj, 'four', 'five')":
"wrapped=['str' string=str]+['four', 'five' string=fourfive]",
// eslint-disable-next-line no-template-curly-in-string
"`start${obj}mid${obj2}end`":
"template=[start string=start],[mid string=mid],[end string=end]", // eslint-disable-line no-template-curly-in-string
"template=[start string=start],[mid string=mid],[end string=end]",
// eslint-disable-next-line no-template-curly-in-string
"`start${'str'}mid${obj2}end`":
"template=[start${'str'}mid string=startstrmid],[end string=end]", // eslint-disable-line no-template-curly-in-string
"'abc'.substr(1)": "string=bc",
Expand Down
8 changes: 4 additions & 4 deletions test/WatchDetection.test.js
Expand Up @@ -35,21 +35,21 @@ describe("WatchDetection", () => {
before(() => {
try {
fs.mkdirSync(fixturePath);
} catch (e) {}
} catch (e) {} // eslint-disable-line no-empty
fs.writeFileSync(filePath, "require('./file2')", "utf-8");
fs.writeFileSync(file2Path, "original", "utf-8");
});
after(done => {
setTimeout(() => {
try {
fs.unlinkSync(filePath);
} catch (e) {}
} catch (e) {} // eslint-disable-line no-empty
try {
fs.unlinkSync(file2Path);
} catch (e) {}
} catch (e) {} // eslint-disable-line no-empty
try {
fs.rmdirSync(fixturePath);
} catch (e) {}
} catch (e) {} // eslint-disable-line no-empty
done();
}, 100); // cool down a bit
});
Expand Down
2 changes: 1 addition & 1 deletion test/WatchTestCases.test.js
Expand Up @@ -285,7 +285,7 @@ describe("WatchTestCases", () => {
testDirectory,
"test.config.js"
));
} catch (e) {}
} catch (e) {} // eslint-disable-line no-empty

if (testConfig.noTests) return process.nextTick(done);
_require(
Expand Down

0 comments on commit f32bd41

Please sign in to comment.