Skip to content

Commit fde0183

Browse files
authored
Merge pull request webpack#6081 from webpack/formating/prettier
Formatting/prettier
2 parents 4c25bfb + b6396e7 commit fde0183

File tree

406 files changed

+19035
-12750
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

406 files changed

+19035
-12750
lines changed

.editorconfig

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@ max_line_length = 233
1212
indent_style = space
1313
indent_size = 2
1414

15+
[.prettierrc]
16+
indent_style = space
17+
indent_size = 2
18+
1519
[*.yml]
1620
indent_style = space
1721
indent_size = 2

.eslintrc.js

Lines changed: 5 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
module.exports = {
22
"root": true,
3-
"plugins": ["node"],
3+
"plugins": [
4+
"prettier",
5+
"node"
6+
],
47
"extends": ["eslint:recommended", "plugin:node/recommended"],
58
"env": {
69
"node": true,
@@ -9,7 +12,7 @@ module.exports = {
912
},
1013
"parserOptions": { "ecmaVersion": 2017 },
1114
"rules": {
12-
"quotes": ["error", "double"],
15+
"prettier/prettier": "error",
1316
"no-undef": "error",
1417
"no-extra-semi": "error",
1518
"semi": "error",
@@ -21,36 +24,12 @@ module.exports = {
2124
"brace-style": "error",
2225
"eol-last": "error",
2326
"no-extra-bind": "warn",
24-
"no-empty": "off",
25-
"no-multiple-empty-lines": "error",
26-
"no-multi-spaces": "error",
2727
"no-process-exit": "warn",
28-
"space-in-parens": "error",
29-
"no-trailing-spaces": "error",
3028
"no-use-before-define": "off",
3129
"no-unused-vars": ["error", { "args": "none" }],
32-
"key-spacing": "error",
33-
"space-infix-ops": "error",
3430
"no-unsafe-negation": "error",
3531
"no-loop-func": "warn",
36-
"space-before-function-paren": ["error", "never"],
37-
"space-before-blocks": "error",
38-
"object-curly-spacing": ["error", "always"],
3932
"indent": "off",
40-
"keyword-spacing": ["error", {
41-
"after": false,
42-
"overrides": {
43-
"const": { "after": true },
44-
"try": { "after": true },
45-
"else": { "after": true },
46-
"throw": { "after": true },
47-
"case": { "after": true },
48-
"return": { "after": true },
49-
"finally": { "after": true },
50-
"do": { "after": true },
51-
"of": { "after": true }
52-
}
53-
}],
5433
"no-console": "off",
5534
"valid-jsdoc": "error",
5635
"node/no-unsupported-features": "error",

.prettierrc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"tabWidth": 2,
3+
"useTabs": true
4+
}

bin/webpack.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,17 @@ let webpackCliInstalled = false;
44
try {
55
require.resolve("webpack-cli");
66
webpackCliInstalled = true;
7-
} catch(e) {
7+
} catch (e) {
88
webpackCliInstalled = false;
99
}
1010

11-
if(webpackCliInstalled) {
11+
if (webpackCliInstalled) {
1212
require("webpack-cli"); // eslint-disable-line node/no-missing-require, node/no-extraneous-require, node/no-unpublished-require
1313
} else {
1414
console.error("The CLI moved into a separate package: webpack-cli.");
15-
console.error("Please install 'webpack-cli' in addition to webpack itself to use the CLI.");
15+
console.error(
16+
"Please install 'webpack-cli' in addition to webpack itself to use the CLI."
17+
);
1618
console.error("-> When using npm: npm install webpack-cli -D");
1719
console.error("-> When using yarn: yarn add webpack-cli -D");
1820
process.exitCode = 1;

buildin/global.js

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,10 @@ g = (function() {
77

88
try {
99
// This works if eval is allowed (see CSP)
10-
g = g || Function("return this")() || (1,eval)("this");
11-
} catch(e) {
10+
g = g || Function("return this")() || (1, eval)("this");
11+
} catch (e) {
1212
// This works if the window reference is available
13-
if(typeof window === "object")
14-
g = window;
13+
if (typeof window === "object") g = window;
1514
}
1615

1716
// g can still be undefined, but nothing to do about it...

buildin/harmony-module.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
module.exports = function(originalModule) {
2-
if(!originalModule.webpackPolyfill) {
2+
if (!originalModule.webpackPolyfill) {
33
var module = Object.create(originalModule);
44
// module.parent = undefined by default
5-
if(!module.children) module.children = [];
5+
if (!module.children) module.children = [];
66
Object.defineProperty(module, "loaded", {
77
enumerable: true,
88
get: function() {
@@ -16,7 +16,7 @@ module.exports = function(originalModule) {
1616
}
1717
});
1818
Object.defineProperty(module, "exports", {
19-
enumerable: true,
19+
enumerable: true
2020
});
2121
module.webpackPolyfill = 1;
2222
}

buildin/module.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
module.exports = function(module) {
2-
if(!module.webpackPolyfill) {
2+
if (!module.webpackPolyfill) {
33
module.deprecate = function() {};
44
module.paths = [];
55
// module.parent = undefined by default
6-
if(!module.children) module.children = [];
6+
if (!module.children) module.children = [];
77
Object.defineProperty(module, "loaded", {
88
enumerable: true,
99
get: function() {

examples/coffee-script/webpack.config.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
module.exports = {
22
// mode: "development || "production",
33
module: {
4-
rules: [{
5-
test: /\.coffee$/,
6-
loader: "coffee-loader"
7-
}]
4+
rules: [
5+
{
6+
test: /\.coffee$/,
7+
loader: "coffee-loader"
8+
}
9+
]
810
},
911
resolve: {
1012
extensions: [".web.coffee", ".web.js", ".coffee", ".js"]

examples/dll-app-and-vendor/0-vendor/webpack.config.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,12 @@ module.exports = {
88
output: {
99
filename: "vendor.js", // best use [hash] here too
1010
path: path.resolve(__dirname, "dist"),
11-
library: "vendor_lib_[hash]",
11+
library: "vendor_lib_[hash]"
1212
},
1313
plugins: [
1414
new webpack.DllPlugin({
1515
name: "vendor_lib_[hash]",
16-
path: path.resolve(__dirname, "dist/vendor-manifest.json"),
17-
}),
18-
],
16+
path: path.resolve(__dirname, "dist/vendor-manifest.json")
17+
})
18+
]
1919
};

examples/dll-app-and-vendor/1-app/webpack.config.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,12 @@ module.exports = {
77
entry: "./example-app",
88
output: {
99
filename: "app.js",
10-
path: path.resolve(__dirname, "dist"),
10+
path: path.resolve(__dirname, "dist")
1111
},
1212
plugins: [
1313
new webpack.DllReferencePlugin({
1414
context: ".",
15-
manifest: require("../0-vendor/dist/vendor-manifest.json"), // eslint-disable-line
16-
}),
17-
],
15+
manifest: require("../0-vendor/dist/vendor-manifest.json") // eslint-disable-line
16+
})
17+
]
1818
};

0 commit comments

Comments
 (0)