Skip to content

Commit

Permalink
Merge pull request #6081 from webpack/formating/prettier
Browse files Browse the repository at this point in the history
Formatting/prettier
  • Loading branch information
sokra committed Feb 25, 2018
2 parents 4c25bfb + b6396e7 commit fde0183
Show file tree
Hide file tree
Showing 406 changed files with 19,035 additions and 12,750 deletions.
4 changes: 4 additions & 0 deletions .editorconfig
Expand Up @@ -12,6 +12,10 @@ max_line_length = 233
indent_style = space
indent_size = 2

[.prettierrc]
indent_style = space
indent_size = 2

[*.yml]
indent_style = space
indent_size = 2
Expand Down
31 changes: 5 additions & 26 deletions .eslintrc.js
@@ -1,6 +1,9 @@
module.exports = {
"root": true,
"plugins": ["node"],
"plugins": [
"prettier",
"node"
],
"extends": ["eslint:recommended", "plugin:node/recommended"],
"env": {
"node": true,
Expand All @@ -9,7 +12,7 @@ module.exports = {
},
"parserOptions": { "ecmaVersion": 2017 },
"rules": {
"quotes": ["error", "double"],
"prettier/prettier": "error",
"no-undef": "error",
"no-extra-semi": "error",
"semi": "error",
Expand All @@ -21,36 +24,12 @@ module.exports = {
"brace-style": "error",
"eol-last": "error",
"no-extra-bind": "warn",
"no-empty": "off",
"no-multiple-empty-lines": "error",
"no-multi-spaces": "error",
"no-process-exit": "warn",
"space-in-parens": "error",
"no-trailing-spaces": "error",
"no-use-before-define": "off",
"no-unused-vars": ["error", { "args": "none" }],
"key-spacing": "error",
"space-infix-ops": "error",
"no-unsafe-negation": "error",
"no-loop-func": "warn",
"space-before-function-paren": ["error", "never"],
"space-before-blocks": "error",
"object-curly-spacing": ["error", "always"],
"indent": "off",
"keyword-spacing": ["error", {
"after": false,
"overrides": {
"const": { "after": true },
"try": { "after": true },
"else": { "after": true },
"throw": { "after": true },
"case": { "after": true },
"return": { "after": true },
"finally": { "after": true },
"do": { "after": true },
"of": { "after": true }
}
}],
"no-console": "off",
"valid-jsdoc": "error",
"node/no-unsupported-features": "error",
Expand Down
4 changes: 4 additions & 0 deletions .prettierrc
@@ -0,0 +1,4 @@
{
"tabWidth": 2,
"useTabs": true
}
8 changes: 5 additions & 3 deletions bin/webpack.js
Expand Up @@ -4,15 +4,17 @@ let webpackCliInstalled = false;
try {
require.resolve("webpack-cli");
webpackCliInstalled = true;
} catch(e) {
} catch (e) {
webpackCliInstalled = false;
}

if(webpackCliInstalled) {
if (webpackCliInstalled) {
require("webpack-cli"); // eslint-disable-line node/no-missing-require, node/no-extraneous-require, node/no-unpublished-require
} else {
console.error("The CLI moved into a separate package: webpack-cli.");
console.error("Please install 'webpack-cli' in addition to webpack itself to use the CLI.");
console.error(
"Please install 'webpack-cli' in addition to webpack itself to use the CLI."
);
console.error("-> When using npm: npm install webpack-cli -D");
console.error("-> When using yarn: yarn add webpack-cli -D");
process.exitCode = 1;
Expand Down
7 changes: 3 additions & 4 deletions buildin/global.js
Expand Up @@ -7,11 +7,10 @@ g = (function() {

try {
// This works if eval is allowed (see CSP)
g = g || Function("return this")() || (1,eval)("this");
} catch(e) {
g = g || Function("return this")() || (1, eval)("this");
} catch (e) {
// This works if the window reference is available
if(typeof window === "object")
g = window;
if (typeof window === "object") g = window;
}

// g can still be undefined, but nothing to do about it...
Expand Down
6 changes: 3 additions & 3 deletions buildin/harmony-module.js
@@ -1,8 +1,8 @@
module.exports = function(originalModule) {
if(!originalModule.webpackPolyfill) {
if (!originalModule.webpackPolyfill) {
var module = Object.create(originalModule);
// module.parent = undefined by default
if(!module.children) module.children = [];
if (!module.children) module.children = [];
Object.defineProperty(module, "loaded", {
enumerable: true,
get: function() {
Expand All @@ -16,7 +16,7 @@ module.exports = function(originalModule) {
}
});
Object.defineProperty(module, "exports", {
enumerable: true,
enumerable: true
});
module.webpackPolyfill = 1;
}
Expand Down
4 changes: 2 additions & 2 deletions buildin/module.js
@@ -1,9 +1,9 @@
module.exports = function(module) {
if(!module.webpackPolyfill) {
if (!module.webpackPolyfill) {
module.deprecate = function() {};
module.paths = [];
// module.parent = undefined by default
if(!module.children) module.children = [];
if (!module.children) module.children = [];
Object.defineProperty(module, "loaded", {
enumerable: true,
get: function() {
Expand Down
10 changes: 6 additions & 4 deletions examples/coffee-script/webpack.config.js
@@ -1,10 +1,12 @@
module.exports = {
// mode: "development || "production",
module: {
rules: [{
test: /\.coffee$/,
loader: "coffee-loader"
}]
rules: [
{
test: /\.coffee$/,
loader: "coffee-loader"
}
]
},
resolve: {
extensions: [".web.coffee", ".web.js", ".coffee", ".js"]
Expand Down
8 changes: 4 additions & 4 deletions examples/dll-app-and-vendor/0-vendor/webpack.config.js
Expand Up @@ -8,12 +8,12 @@ module.exports = {
output: {
filename: "vendor.js", // best use [hash] here too
path: path.resolve(__dirname, "dist"),
library: "vendor_lib_[hash]",
library: "vendor_lib_[hash]"
},
plugins: [
new webpack.DllPlugin({
name: "vendor_lib_[hash]",
path: path.resolve(__dirname, "dist/vendor-manifest.json"),
}),
],
path: path.resolve(__dirname, "dist/vendor-manifest.json")
})
]
};
8 changes: 4 additions & 4 deletions examples/dll-app-and-vendor/1-app/webpack.config.js
Expand Up @@ -7,12 +7,12 @@ module.exports = {
entry: "./example-app",
output: {
filename: "app.js",
path: path.resolve(__dirname, "dist"),
path: path.resolve(__dirname, "dist")
},
plugins: [
new webpack.DllReferencePlugin({
context: ".",
manifest: require("../0-vendor/dist/vendor-manifest.json"), // eslint-disable-line
}),
],
manifest: require("../0-vendor/dist/vendor-manifest.json") // eslint-disable-line
})
]
};
2 changes: 0 additions & 2 deletions examples/explicit-vendor-chunk/webpack.config.js
@@ -1,7 +1,6 @@
var path = require("path");
var webpack = require("../../");
module.exports = [

{
name: "vendor",
// mode: "development || "production",
Expand Down Expand Up @@ -38,5 +37,4 @@ module.exports = [
})
]
}

];
2 changes: 1 addition & 1 deletion examples/externals/webpack.config.js
Expand Up @@ -6,7 +6,7 @@ module.exports = {
externals: [
"add",
{
"subtract": {
subtract: {
root: "subtract",
commonjs2: "./subtract",
commonjs: ["./math", "subtract"],
Expand Down
2 changes: 1 addition & 1 deletion examples/hybrid-routing/webpack.config.js
Expand Up @@ -5,7 +5,7 @@ module.exports = {
// The entry points for the pages
// They also contains router
pageA: ["./aEntry", "./router"],
pageB: ["./bEntry", "./router"],
pageB: ["./bEntry", "./router"]
},
output: {
path: path.join(__dirname, "dist"),
Expand Down
10 changes: 3 additions & 7 deletions examples/i18n/webpack.config.js
@@ -1,8 +1,8 @@
var path = require("path");
var I18nPlugin = require("i18n-webpack-plugin");
var languages = {
"en": null,
"de": require("./de.json")
en: null,
de: require("./de.json")
};
module.exports = Object.keys(languages).map(function(language) {
return {
Expand All @@ -13,10 +13,6 @@ module.exports = Object.keys(languages).map(function(language) {
path: path.join(__dirname, "dist"),
filename: language + ".output.js"
},
plugins: [
new I18nPlugin(
languages[language]
)
]
plugins: [new I18nPlugin(languages[language])]
};
});
10 changes: 6 additions & 4 deletions examples/loader/webpack.config.js
@@ -1,9 +1,11 @@
module.exports = {
// mode: "development || "production",
module: {
rules: [{
test: /\.css$/,
loader: "css-loader"
}]
rules: [
{
test: /\.css$/,
loader: "css-loader"
}
]
}
};
2 changes: 0 additions & 2 deletions examples/multi-compiler/webpack.config.js
@@ -1,7 +1,6 @@
var path = require("path");
var webpack = require("../../");
module.exports = [

{
name: "mobile",
// mode: "development || "production",
Expand Down Expand Up @@ -31,5 +30,4 @@ module.exports = [
})
]
}

];
6 changes: 3 additions & 3 deletions examples/source-map/webpack.config.js
Expand Up @@ -10,15 +10,15 @@ module.exports = [
"hidden-source-map",
"inline-source-map",
"nosources-source-map",
"source-map",
"source-map"
].map(devtool => ({
mode: "development",
entry: {
bundle: "coffee-loader!./example.coffee",
bundle: "coffee-loader!./example.coffee"
},
output: {
path: path.join(__dirname, "dist"),
filename: `./[name]-${devtool}.js`,
filename: `./[name]-${devtool}.js`
},
devtool,
optimization: {
Expand Down
10 changes: 6 additions & 4 deletions examples/wasm-simple/webpack.config.js
Expand Up @@ -5,10 +5,12 @@ module.exports = {
publicPath: "js/"
},
module: {
rules: [{
test: /\.wasm$/,
type: "webassembly/experimental"
}]
rules: [
{
test: /\.wasm$/,
type: "webassembly/experimental"
}
]
},
optimization: {
occurrenceOrder: true // To keep filename consistent between different modes (for example building only)
Expand Down
1 change: 0 additions & 1 deletion hot/.eslintrc
Expand Up @@ -5,5 +5,4 @@
"rules": {
"node/exports-style": ["off"]
}

}

0 comments on commit fde0183

Please sign in to comment.