Permalink
Browse files

code linting

  • Loading branch information...
1 parent 330ca07 commit 8e69a808476aec661208437299edafd8554a5c12 @sokra sokra committed Jan 11, 2017
Showing with 262 additions and 258 deletions.
  1. +7 −0 .eslintrc
  2. +5 −5 bin/convert-argv.js
  3. +1 −1 buildin/module.js
  4. +1 −1 examples/agressive-merging/webpack.config.js
  5. +1 −1 examples/chunkhash/webpack.config.js
  6. +1 −1 examples/code-splitted-css-bundle/webpack.config.js
  7. +1 −1 examples/coffee-script/webpack.config.js
  8. +1 −1 examples/css-bundle/webpack.config.js
  9. +2 −2 examples/dll-user/webpack.config.js
  10. +1 −1 examples/dll/webpack.config.js
  11. +1 −1 examples/externals/webpack.config.js
  12. +2 −2 examples/extra-async-chunk-advanced/webpack.config.js
  13. +2 −2 examples/extra-async-chunk/webpack.config.js
  14. +2 −2 examples/hybrid-routing/webpack.config.js
  15. +1 −1 examples/i18n/webpack.config.js
  16. +1 −1 examples/move-to-parent/webpack.config.js
  17. +1 −1 examples/multi-compiler/webpack.config.js
  18. +1 −1 examples/multi-part-library/webpack.config.js
  19. +1 −1 examples/multiple-commons-chunks/webpack.config.js
  20. +1 −1 examples/multiple-entry-points-commons-chunk-css-bundle/webpack.config.js
  21. +1 −1 examples/multiple-entry-points/webpack.config.js
  22. +1 −1 examples/two-explicit-vendor-chunks/webpack.config.js
  23. +1 −1 examples/web-worker/webpack.config.js
  24. +1 −1 hot/log-apply-result.js
  25. +1 −1 hot/poll.js
  26. +1 −1 hot/signal.js
  27. +1 −1 lib/CaseSensitiveModulesWarning.js
  28. +2 −2 lib/Chunk.js
  29. +1 −1 lib/Compiler.js
  30. +1 −1 lib/ConstPlugin.js
  31. +1 −1 lib/ContextModule.js
  32. +2 −2 lib/ContextModuleFactory.js
  33. +2 −2 lib/ContextReplacementPlugin.js
  34. +1 −1 lib/DelegatedModule.js
  35. +2 −2 lib/DynamicEntryPlugin.js
  36. +1 −1 lib/EntryOptionPlugin.js
  37. +1 −1 lib/ExternalModuleFactoryPlugin.js
  38. +1 −1 lib/FlagDependencyUsagePlugin.js
  39. +4 −4 lib/HotModuleReplacement.runtime.js
  40. +1 −1 lib/ModuleDependencyError.js
  41. +1 −1 lib/ModuleDependencyWarning.js
  42. +1 −1 lib/ModuleReason.js
  43. +3 −3 lib/ModuleTemplate.js
  44. +1 −1 lib/MovedToPluginWarningPlugin.js
  45. +1 −1 lib/MultiCompiler.js
  46. +1 −1 lib/MultiEntryPlugin.js
  47. +2 −2 lib/NormalModule.js
  48. +3 −3 lib/NormalModuleFactory.js
  49. +1 −1 lib/OptionsDefaulter.js
  50. +6 −6 lib/Parser.js
  51. +3 −3 lib/ProgressPlugin.js
  52. +2 −2 lib/RawModule.js
  53. +2 −2 lib/RequireJsStuffPlugin.js
  54. +8 −8 lib/RuleSet.js
  55. +1 −1 lib/SingleEntryPlugin.js
  56. +1 −1 lib/SizeFormatHelpers.js
  57. +9 −9 lib/Stats.js
  58. +4 −4 lib/TemplatedPathPlugin.js
  59. +3 −3 lib/UseStrictPlugin.js
  60. +1 −1 lib/WatchIgnorePlugin.js
  61. +2 −2 lib/WebpackOptionsDefaulter.js
  62. +5 −5 lib/WebpackOptionsValidationError.js
  63. +1 −1 lib/dependencies/AMDDefineDependency.js
  64. +1 −1 lib/dependencies/AMDRequireArrayDependency.js
  65. +1 −1 lib/dependencies/AMDRequireDependenciesBlock.js
  66. +1 −1 lib/dependencies/AMDRequireDependency.js
  67. +1 −1 lib/dependencies/CommonJsInHarmonyDependency.js
  68. +1 −1 lib/dependencies/CommonJsInHarmonyWarning.js
  69. +1 −1 lib/dependencies/ConstDependency.js
  70. +1 −1 lib/dependencies/ContextDependencyHelpers.js
  71. +1 −1 lib/dependencies/ContextDependencyTemplateAsId.js
  72. +1 −1 lib/dependencies/ContextDependencyTemplateAsRequireCall.js
  73. +1 −1 lib/dependencies/HarmonyAcceptDependency.js
  74. +1 −1 lib/dependencies/HarmonyAcceptImportDependency.js
  75. +1 −1 lib/dependencies/HarmonyCompatiblilityDependency.js
  76. +1 −1 lib/dependencies/HarmonyExportExpressionDependency.js
  77. +1 −1 lib/dependencies/HarmonyExportHeaderDependency.js
  78. +8 −8 lib/dependencies/HarmonyExportImportedSpecifierDependency.js
  79. +1 −1 lib/dependencies/HarmonyExportSpecifierDependency.js
  80. +2 −2 lib/dependencies/HarmonyImportDependency.js
  81. +2 −2 lib/dependencies/HarmonyImportSpecifierDependency.js
  82. +1 −1 lib/dependencies/HarmonyModulesHelpers.js
  83. +1 −1 lib/dependencies/ImportDependenciesBlock.js
  84. +1 −1 lib/dependencies/ImportDependency.js
  85. +1 −1 lib/dependencies/LocalModuleDependency.js
  86. +1 −1 lib/dependencies/ModuleDependency.js
  87. +1 −1 lib/dependencies/NullDependency.js
  88. +1 −1 lib/dependencies/RequireEnsureDependenciesBlock.js
  89. +1 −1 lib/dependencies/RequireEnsureDependency.js
  90. +1 −1 lib/dependencies/RequireHeaderDependency.js
  91. +1 −1 lib/dependencies/RequireIncludeDependency.js
  92. +1 −1 lib/dependencies/RequireIncludeDependencyParserPlugin.js
  93. +1 −1 lib/dependencies/RequireResolveHeaderDependency.js
  94. +1 −1 lib/dependencies/UnsupportedDependency.js
  95. +5 −5 lib/optimize/AggressiveSplittingPlugin.js
  96. +1 −1 lib/optimize/ChunkModuleIdRangePlugin.js
  97. +1 −1 lib/optimize/CommonsChunkPlugin.js
  98. +1 −1 lib/webpack.js
  99. +1 −1 lib/webworker/WebWorkerMainTemplate.runtime.js
  100. +1 −1 package.json
  101. +1 −1 test/binCases/help/help-output/test.js
  102. +1 −1 test/binCases/stats/single-config/test.js
  103. +1 −1 test/binCases/stats/single-config/webpack.config.js
  104. +1 −1 test/browsertest/webpack.config.js
  105. +1 −1 test/configCases/commons-chunk-plugin/hot/webpack.config.js
  106. +1 −1 test/configCases/commons-chunk-plugin/library/webpack.config.js
  107. +1 −1 test/configCases/commons-chunk-plugin/simple/webpack.config.js
  108. +1 −2 test/configCases/context-replacement/a/webpack.config.js
  109. +1 −2 test/configCases/context-replacement/b/webpack.config.js
  110. +1 −1 test/configCases/dll-plugin/0-create-dll/webpack.config.js
  111. +2 −3 test/configCases/dll-plugin/1-use-dll/webpack.config.js
  112. +1 −1 test/configCases/dll-plugin/2-use-dll-without-scope/webpack.config.js
  113. +1 −1 test/configCases/entry/function-promise/webpack.config.js
  114. +1 −1 test/configCases/entry/function/webpack.config.js
  115. +1 −1 test/configCases/externals/externals-in-chunk/webpack.config.js
  116. +1 −1 test/configCases/externals/externals-in-commons-chunk/webpack.config.js
  117. +1 −1 test/configCases/externals/optional-externals-cjs/webpack.config.js
  118. +1 −1 test/configCases/externals/optional-externals-root/webpack.config.js
  119. +1 −1 test/configCases/externals/optional-externals-umd/webpack.config.js
  120. +1 −1 test/configCases/extract-text/issue-14/webpack.config.js
  121. +2 −2 test/configCases/issues/issue-3596/webpack.config.js
  122. +1 −1 test/configCases/library/0-create-library/webpack.config.js
  123. +1 −1 test/configCases/library/1-use-library/webpack.config.js
  124. +1 −1 test/configCases/library/a/webpack.config.js
  125. +1 −1 test/configCases/library/b/webpack.config.js
  126. +5 −5 test/configCases/loaders/issue-3320/webpack.config.js
  127. +1 −1 test/configCases/loaders/remaining-request/webpack.config.js
  128. +1 −1 test/configCases/no-parse/module.exports/webpack.config.js
  129. +1 −1 test/configCases/parsing/context/webpack.config.js
  130. +1 −1 test/configCases/parsing/extended-api/webpack.config.js
  131. +1 −1 test/configCases/parsing/issue-336/webpack.config.js
  132. +1 −1 test/configCases/parsing/relative-filedirname/webpack.config.js
  133. +1 −1 test/configCases/parsing/require.main/webpack.config.js
  134. +7 −3 test/configCases/plugins/define-plugin/webpack.config.js
  135. +2 −3 test/configCases/plugins/lib-manifest-plugin/webpack.config.js
  136. +1 −1 test/configCases/records/issue-295/webpack.config.js
  137. +1 −1 test/configCases/rule-set/chaining/webpack.config.js
  138. +2 −2 test/configCases/rule-set/custom/webpack.config.js
  139. +1 −1 test/configCases/rule-set/query/webpack.config.js
  140. +5 −3 test/configCases/rule-set/simple-use-fn-array/webpack.config.js
  141. +5 −3 test/configCases/rule-set/simple/webpack.config.js
  142. +1 −1 test/configCases/runtime/opt-in-finally/webpack.config.js
  143. +1 −1 test/configCases/simple/empty-config/webpack.config.js
  144. +2 −5 test/configCases/simple/multi-compiler/webpack.config.js
  145. +1 −1 test/configCases/source-map/line-to-line/webpack.config.js
  146. +0 −1 test/configCases/source-map/nosources/webpack.config.js
  147. +1 −1 test/configCases/source-map/relative-source-map-path/webpack.config.js
  148. +1 −1 test/configCases/source-map/sources-array-production-cheap-map/webpack.config.js
  149. +1 −1 test/configCases/source-map/sources-array-production/webpack.config.js
  150. +1 −1 test/hotPlayground/webpack.config.js
  151. +1 −1 test/statsCases/aggressive-splitting-entry/webpack.config.js
  152. +1 −1 test/statsCases/aggressive-splitting-on-demand/webpack.config.js
  153. +1 −1 test/statsCases/chunks/webpack.config.js
  154. +2 −2 test/statsCases/color-enabled-custom/webpack.config.js
  155. +0 −1 test/statsCases/max-modules-default/webpack.config.js
  156. +0 −1 test/statsCases/max-modules/webpack.config.js
  157. +1 −1 test/statsCases/optimize-chunks/webpack.config.js
  158. +1 −1 test/statsCases/preset-errors-only-error/webpack.config.js
  159. +1 −1 test/statsCases/preset-errors-only/webpack.config.js
  160. +1 −1 test/statsCases/preset-minimal-simple/webpack.config.js
  161. +1 −1 test/statsCases/preset-minimal/webpack.config.js
  162. +1 −1 test/statsCases/preset-none-error/webpack.config.js
  163. +1 −1 test/statsCases/preset-none/webpack.config.js
  164. +1 −1 test/statsCases/preset-normal/webpack.config.js
  165. +1 −1 test/statsCases/preset-verbose/webpack.config.js
  166. +1 −1 test/statsCases/separate-css-bundle/webpack.config.js
  167. +1 −1 test/statsCases/simple-more-info/webpack.config.js
  168. +1 −1 test/statsCases/tree-shaking/webpack.config.js
  169. +0 −1 test/watchCases/plugins/watch-ignore-plugin/webpack.config.js
View
@@ -8,6 +8,13 @@
"rules": {
"quotes": ["error", "double"],
"no-undef": "error",
+ "no-extra-semi": "error",
+ "semi": "error",
+ "no-template-curly-in-string": "error",
+ "no-caller": "error",
+ "yoda": "error",
+ "eqeqeq": "error",
+ "global-require": "off",
"brace-style": "error",
"eol-last": "error",
"indent": ["error", "tab", { "SwitchCase": 1 }],
View
@@ -46,7 +46,7 @@ module.exports = function(yargs, argv, convertOptions) {
}
}
return path.extname(configPath);
- }
+ };
var mapConfigArg = function mapConfigArg(configArg) {
var resolvedPath = path.resolve(configArg);
@@ -55,7 +55,7 @@ module.exports = function(yargs, argv, convertOptions) {
path: resolvedPath,
ext: extension
};
- }
+ };
var configArgList = Array.isArray(argv.config) ? argv.config : [argv.config];
configFiles = configArgList.map(mapConfigArg);
@@ -90,7 +90,7 @@ module.exports = function(yargs, argv, convertOptions) {
}
}
}
- }
+ };
var requireConfig = function requireConfig(configPath) {
var options = require(configPath);
@@ -102,7 +102,7 @@ module.exports = function(yargs, argv, convertOptions) {
options = options(argv.env, argv);
}
return options;
- }
+ };
configFiles.forEach(function(file) {
registerCompiler(interpret.extensions[file.ext]);
@@ -511,7 +511,7 @@ module.exports = function(yargs, argv, convertOptions) {
} else {
options.entry[name] = entry;
}
- }
+ };
argv._.forEach(function(content) {
var i = content.indexOf("=");
var j = content.indexOf("?");
View
@@ -21,4 +21,4 @@ module.exports = function(module) {
module.webpackPolyfill = 1;
}
return module;
-}
+};
@@ -17,4 +17,4 @@ module.exports = {
moveToParents: true
})
]
-}
+};
@@ -20,4 +20,4 @@ module.exports = {
})
*/
]
-};
+};
@@ -17,4 +17,4 @@ module.exports = {
filename: "style.css"
})
]
-};
+};
@@ -7,4 +7,4 @@ module.exports = {
resolve: {
extensions: [".web.coffee", ".web.js", ".coffee", ".js"]
}
-}
+};
@@ -17,4 +17,4 @@ module.exports = {
allChunks: true
})
]
-};
+};
@@ -4,11 +4,11 @@ module.exports = {
plugins: [
new webpack.DllReferencePlugin({
context: path.join(__dirname, "..", "dll"),
- manifest: require("../dll/js/alpha-manifest.json")
+ manifest: require("../dll/js/alpha-manifest.json") // eslint-disable-line
}),
new webpack.DllReferencePlugin({
scope: "beta",
- manifest: require("../dll/js/beta-manifest.json"),
+ manifest: require("../dll/js/beta-manifest.json"), // eslint-disable-line
extensions: [".js", ".jsx"]
})
]
@@ -2,7 +2,7 @@ var path = require("path");
var webpack = require("../../");
module.exports = {
resolve: {
- extensions: ['.js', '.jsx']
+ extensions: [".js", ".jsx"]
},
entry: {
alpha: ["./alpha", "./a", "module"],
@@ -13,4 +13,4 @@ module.exports = {
}
}
]
-}
+};
@@ -1,5 +1,5 @@
-var path = require("path");
var CommonsChunkPlugin = require("../../lib/optimize/CommonsChunkPlugin");
+
module.exports = {
plugins: [
new CommonsChunkPlugin({
@@ -15,4 +15,4 @@ module.exports = {
async: true
}),
]
-}
+};
@@ -1,5 +1,5 @@
-var path = require("path");
var CommonsChunkPlugin = require("../../lib/optimize/CommonsChunkPlugin");
+
module.exports = {
plugins: [
new CommonsChunkPlugin({
@@ -11,4 +11,4 @@ module.exports = {
async: true
})
]
-}
+};
@@ -11,7 +11,7 @@ module.exports = {
},
output: {
path: path.join(__dirname, "js"),
- publicPath: 'js/',
+ publicPath: "js/",
filename: "[name].bundle.js",
chunkFilename: "[id].chunk.js"
},
@@ -24,4 +24,4 @@ module.exports = {
})
// The pages cannot run without the commons.js file now.
]
-}
+};
@@ -18,4 +18,4 @@ module.exports = Object.keys(languages).map(function(language) {
)
]
};
-});
+});
@@ -36,4 +36,4 @@ module.exports = {
}
})
]
-}
+};
@@ -27,4 +27,4 @@ module.exports = [
})
]
}
-];
+];
@@ -10,4 +10,4 @@ module.exports = {
library: ["MyLibrary", "[name]"],
libraryTarget: "umd"
}
-}
+};
@@ -28,4 +28,4 @@ module.exports = {
chunks: ["pageC", "adminPageC"]
}),
]
-}
+};
@@ -33,4 +33,4 @@ module.exports = {
filename: "[name].css"
}),
]
-};
+};
@@ -16,4 +16,4 @@ module.exports = {
name: "commons"
})
]
-}
+};
@@ -18,4 +18,4 @@ module.exports = {
minChunks: Infinity
})
]
-}
+};
@@ -12,4 +12,4 @@ module.exports = {
}
})
]
-}
+};
@@ -25,6 +25,6 @@ module.exports = function(updatedModules, renewedModules) {
return typeof moduleId === "number";
});
if(numberIds)
- console.log("[HMR] Consider using the NamedModulesPlugin for module names.")
+ console.log("[HMR] Consider using the NamedModulesPlugin for module names.");
}
};
View
@@ -26,7 +26,7 @@ if(module.hot) {
}
});
}
- }
+ };
setInterval(checkForUpdate, hotPollInterval);
} else {
throw new Error("[HMR] Hot Module Replacement is disabled.");
View
@@ -34,7 +34,7 @@ if(module.hot) {
console.warn("[HMR] Update failed: " + err.stack || err.message);
}
});
- }
+ };
process.on(__resourceQuery.substr(1) || "SIGUSR2", function() {
if(module.hot.status() !== "idle") {
@@ -40,4 +40,4 @@ module.exports = class CaseSensitiveModulesWarning extends Error {
return message;
}).join("\n");
}
-}
+};
View
@@ -12,7 +12,7 @@ const byId = (a, b) => {
if(a.id < b.id) return -1;
if(b.id < a.id) return 1;
return 0;
-}
+};
class Chunk {
@@ -183,7 +183,7 @@ class Chunk {
}
onChunk(c);
});
- }
+ };
moveChunks(other.parents, "chunks", c => {
if(c !== this && this.addParent(c)) {
c.addChunk(this);
View
@@ -187,7 +187,7 @@ function Compiler() {
});
});
}.bind(this)
- }
+ };
this.options = {};
}
View
@@ -11,7 +11,7 @@ const NullFactory = require("./NullFactory");
const getQuery = (request) => {
const i = request.indexOf("?");
return request.indexOf("?") < 0 ? "" : request.substr(i);
-}
+};
class ConstPlugin {
apply(compiler) {
@@ -77,7 +77,7 @@ ContextModule.prototype.libIdent = function(options) {
if(this.addon)
identifier += contextify(options, this.addon);
if(this.regExp)
- identifier += prettyRegExp(this.regExp + "")
+ identifier += prettyRegExp(this.regExp + "");
return identifier.replace(/ $/, "");
};
@@ -73,8 +73,8 @@ ContextModuleFactory.prototype.create = function(data, callback) {
resolvers.loader.resolve({}, context, loader, function(err, result) {
if(err) return callback(err);
callback(null, result);
- })
- }, callback)
+ });
+ }, callback);
}
], function(err, result) {
if(err) return callback(err);
@@ -12,7 +12,7 @@ function ContextReplacementPlugin(resourceRegExp, newContentResource, newContent
} else if(typeof newContentResource === "string" && typeof newContentRecursive === "object") {
this.newContentResource = newContentResource;
this.newContentCreateContextMap = function(fs, callback) {
- callback(null, newContentRecursive)
+ callback(null, newContentRecursive);
};
} else if(typeof newContentResource === "string" && typeof newContentRecursive === "function") {
this.newContentResource = newContentResource;
@@ -99,5 +99,5 @@ function createResolveDependenciesFromContextMap(createContextMap) {
});
callback(null, dependencies);
});
- }
+ };
}
@@ -50,7 +50,7 @@ DelegatedModule.prototype.build = function(options, compilation, resolver, fs, c
DelegatedModule.prototype.unbuild = function() {
this.built = false;
Module.prototype.unbuild.call(this);
-}
+};
DelegatedModule.prototype.source = function() {
var sourceModule = this.dependencies[0].module;
@@ -33,7 +33,7 @@ class DynamicEntryPlugin {
if(err) return reject(err);
resolve();
});
- })
+ });
};
Promise.resolve(this.entry()).then((entry) => {
@@ -44,7 +44,7 @@ class DynamicEntryPlugin {
return addEntry(entry[name], name);
})).then(() => callback(), callback);
}
- })
+ });
});
}
}
@@ -28,4 +28,4 @@ module.exports = class EntryOptionPlugin {
return true;
});
}
-}
+};
@@ -50,7 +50,7 @@ ExternalModuleFactoryPlugin.prototype.apply = function(normalModuleFactory) {
return next();
}
callback(null, module);
- }
+ };
do {
var async = true;
@@ -13,7 +13,7 @@ FlagDependencyUsagePlugin.prototype.apply = function(compiler) {
modules.forEach(function(module) {
module.used = false;
- })
+ });
var queue = [];
compilation.chunks.forEach(function(chunk) {
Oops, something went wrong.

0 comments on commit 8e69a80

Please sign in to comment.