Skip to content

Commit 2270596

Browse files
authored
Merge pull request webpack#6331 from webpack/lint/beauty-webpack-config
Enable beautify for webpack configs in tests and examples
2 parents a2eada1 + 32ebbfd commit 2270596

File tree

44 files changed

+327
-286
lines changed

Some content is hidden

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

44 files changed

+327
-286
lines changed

examples/coffee-script/webpack.config.js

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

examples/explicit-vendor-chunk/webpack.config.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
var path = require("path");
22
var webpack = require("../../");
33
module.exports = [
4+
45
{
56
name: "vendor",
67
// mode: "development || "production",
@@ -17,6 +18,7 @@ module.exports = [
1718
})
1819
]
1920
},
21+
2022
{
2123
name: "app",
2224
// mode: "development || "production",
@@ -36,4 +38,5 @@ module.exports = [
3638
})
3739
]
3840
}
41+
3942
];

examples/loader/webpack.config.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
module.exports = {
22
// mode: "development || "production",
33
module: {
4-
rules: [
5-
{ test: /\.css$/, loader: "css-loader" }
6-
]
4+
rules: [{
5+
test: /\.css$/,
6+
loader: "css-loader"
7+
}]
78
}
89
};

examples/multi-compiler/webpack.config.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
var path = require("path");
22
var webpack = require("../../");
33
module.exports = [
4+
45
{
56
name: "mobile",
67
// mode: "development || "production",
@@ -15,6 +16,7 @@ module.exports = [
1516
})
1617
]
1718
},
19+
1820
{
1921
name: "desktop",
2022
// mode: "development || "production",
@@ -29,4 +31,5 @@ module.exports = [
2931
})
3032
]
3133
}
34+
3235
];

examples/wasm-simple/webpack.config.js

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,10 @@ module.exports = {
55
publicPath: "js/"
66
},
77
module: {
8-
rules: [
9-
{
10-
test: /\.wasm$/,
11-
type: "webassembly/experimental"
12-
}
13-
]
8+
rules: [{
9+
test: /\.wasm$/,
10+
type: "webassembly/experimental"
11+
}]
1412
},
1513
optimization: {
1614
occurrenceOrder: true // To keep filename consistent between different modes (for example building only)

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@
103103
"lint-files": "npm run lint && npm run beautify-lint && npm run schema-lint",
104104
"lint": "eslint lib bin hot buildin \"test/*.js\" \"test/**/webpack.config.js\" \"examples/**/webpack.config.js\"",
105105
"fix": "npm run lint -- --fix",
106-
"beautify-lint": "beautify-lint \"lib/**/*.js\" \"hot/**/*.js\" \"bin/**/*.js\" \"benchmark/*.js\" \"test/*.js\"",
106+
"beautify-lint": "beautify-lint \"lib/**/*.js\" \"hot/**/*.js\" \"bin/**/*.js\" \"benchmark/*.js\" \"test/*.js\" \"test/**/webpack.config.js\" \"examples/**/webpack.config.js\"",
107107
"schema-lint": "mocha test/*.lint.js --opts test/lint-mocha.opts",
108108
"benchmark": "mocha --max-old-space-size=4096 --harmony --trace-deprecation test/*.benchmark.js -R spec",
109109
"cover": "npm run cover:init && npm run cover:all && npm run cover:report",
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+

test/configCases/context-replacement/d/webpack.config.js

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,12 @@ var webpack = require("../../../../");
33

44
module.exports = {
55
module: {
6-
rules: [
7-
{
8-
test: /a\.js$/,
9-
use: [
10-
"./queryloader?lions=roar"
11-
]
12-
}
13-
]
6+
rules: [{
7+
test: /a\.js$/,
8+
use: [
9+
"./queryloader?lions=roar"
10+
]
11+
}]
1412
},
1513
plugins: [
1614
new webpack.ContextReplacementPlugin(/context-replacement.d$/, path.resolve(__dirname, "modules?cats=meow"), {

test/configCases/delegated-hash/simple/webpack.config.js

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,18 +8,28 @@ module.exports = {
88
type: "require",
99
context: __dirname,
1010
content: {
11-
"./a.js": { id: 0 },
12-
"./loader.js!./b.js": { id: 1 },
13-
"./dir/c.js": { id: 2 }
11+
"./a.js": {
12+
id: 0
13+
},
14+
"./loader.js!./b.js": {
15+
id: 1
16+
},
17+
"./dir/c.js": {
18+
id: 2
19+
}
1420
}
1521
}),
1622
new DelegatedPlugin({
1723
source: "./bundle2",
1824
type: "object",
1925
context: __dirname,
2026
content: {
21-
"./d.js": { id: 3 },
22-
"./e.js": { id: 4 }
27+
"./d.js": {
28+
id: 3
29+
},
30+
"./e.js": {
31+
id: 4
32+
}
2333
}
2434
})
2535
]

test/configCases/delegated/simple/webpack.config.js

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,15 @@ module.exports = {
66
type: "require",
77
context: __dirname,
88
content: {
9-
"./a.js": { id: 0 },
10-
"./loader.js!./b.js": { id: 1 },
11-
"./dir/c.js": { id: 2 }
9+
"./a.js": {
10+
id: 0
11+
},
12+
"./loader.js!./b.js": {
13+
id: 1
14+
},
15+
"./dir/c.js": {
16+
id: 2
17+
}
1218
}
1319
})
1420
]

0 commit comments

Comments
 (0)