Skip to content

Commit 2bd495c

Browse files
authored
Merge pull request #6864 from webpack/bump_prettier
Update prettier toolchain
2 parents 0f70fcb + 8d8da4c commit 2bd495c

39 files changed

+202
-254
lines changed

.eslintrc.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
module.exports = {
22
root: true,
33
plugins: ["prettier", "node"],
4-
extends: ["eslint:recommended", "plugin:node/recommended"],
4+
extends: ["eslint:recommended", "plugin:node/recommended", "plugin:prettier/recommended"],
55
env: {
66
node: true,
77
es6: true
@@ -16,6 +16,7 @@ module.exports = {
1616
"semi": "error",
1717
"no-template-curly-in-string": "error",
1818
"no-caller": "error",
19+
"no-control-regex": "off",
1920
"yoda": "error",
2021
"eqeqeq": "error",
2122
"global-require": "off",

.prettierrc

Lines changed: 0 additions & 4 deletions
This file was deleted.

.prettierrc.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
module.exports = {
2+
printWidth: 80,
3+
useTabs: true,
4+
tabWidth: 2
5+
};

bin/webpack.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,7 @@ if (!webpackCliInstalled) {
4343

4444
const commandToBeRun = `${packageManager} ${options.join(" ")}`;
4545

46-
const question = `Would you like to install webpack-cli? (That will run ${
47-
commandToBeRun
48-
}) `;
46+
const question = `Would you like to install webpack-cli? (That will run ${commandToBeRun}) `;
4947

5048
console.error("The CLI moved into a separate package: webpack-cli");
5149
const questionInterface = readLine.createInterface({

lib/APIPlugin.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,11 +52,11 @@ class APIPlugin {
5252
? ParserHelpers.toConstantDependency(
5353
parser,
5454
REPLACEMENTS[key]
55-
)
55+
)
5656
: ParserHelpers.toConstantDependencyWithWebpackRequire(
5757
parser,
5858
REPLACEMENTS[key]
59-
)
59+
)
6060
);
6161
parser.hooks.evaluateTypeof
6262
.for(key)

lib/AmdMainTemplatePlugin.js

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36,17 +36,15 @@ class AmdMainTemplatePlugin {
3636
});
3737

3838
return new ConcatSource(
39-
`define(${JSON.stringify(name)}, ${externalsDepsArray}, function(${
40-
externalsArguments
41-
}) { return `,
39+
`define(${JSON.stringify(
40+
name
41+
)}, ${externalsDepsArray}, function(${externalsArguments}) { return `,
4242
source,
4343
"});"
4444
);
4545
} else if (externalsArguments) {
4646
return new ConcatSource(
47-
`define(${externalsDepsArray}, function(${
48-
externalsArguments
49-
}) { return `,
47+
`define(${externalsDepsArray}, function(${externalsArguments}) { return `,
5048
source,
5149
"});"
5250
);

lib/AsyncDependencyToInitialChunkError.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,7 @@ module.exports = class AsyncDependencyToInitialChunkError extends WebpackError {
1111
super();
1212

1313
this.name = "AsyncDependencyToInitialChunkError";
14-
this.message = `It's not allowed to load an initial chunk on demand. The chunk name "${
15-
chunkName
16-
}" is already used by an entrypoint.`;
14+
this.message = `It's not allowed to load an initial chunk on demand. The chunk name "${chunkName}" is already used by an entrypoint.`;
1715
this.module = module;
1816
this.origin = module;
1917
this.originLoc = loc;

lib/Compilation.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -628,12 +628,12 @@ class Compilation extends Tapable {
628628
const errorAndCallback = this.bail
629629
? err => {
630630
callback(err);
631-
}
631+
}
632632
: err => {
633633
err.dependencies = [dependency];
634634
this.errors.push(err);
635635
callback();
636-
};
636+
};
637637

638638
if (
639639
typeof dependency !== "object" ||

lib/ContextModule.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -293,9 +293,11 @@ class ContextModule extends Module {
293293
getReturnModuleObjectSource(fakeMap, fakeMapDataExpression = "fakeMap[id]") {
294294
if (typeof fakeMap === "number")
295295
return `return ${this.getReturn(fakeMap)};`;
296-
return `return ${fakeMapDataExpression} === 1 ? ${this.getReturn(1)} : ${
297-
fakeMapDataExpression
298-
} ? ${this.getReturn(2)} : ${this.getReturn(0)};`;
296+
return `return ${fakeMapDataExpression} === 1 ? ${this.getReturn(
297+
1
298+
)} : ${fakeMapDataExpression} ? ${this.getReturn(2)} : ${this.getReturn(
299+
0
300+
)};`;
299301
}
300302

301303
getSyncSource(dependencies, id) {
@@ -512,9 +514,7 @@ module.exports = webpackAsyncContext;`;
512514

513515
const chunksStartPosition = typeof fakeMap === "object" ? 2 : 1;
514516
const requestPrefix = hasMultipleOrNoChunks
515-
? `Promise.all(ids.slice(${
516-
chunksStartPosition
517-
}).map(__webpack_require__.e))`
517+
? `Promise.all(ids.slice(${chunksStartPosition}).map(__webpack_require__.e))`
518518
: `__webpack_require__.e(ids[${chunksStartPosition}])`;
519519
const returnModuleObject = this.getReturnModuleObjectSource(
520520
fakeMap,

lib/DefinePlugin.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ class DefinePlugin {
112112
? ParserHelpers.toConstantDependencyWithWebpackRequire(
113113
parser,
114114
code
115-
)
115+
)
116116
: ParserHelpers.toConstantDependency(parser, code)
117117
);
118118
}
@@ -164,7 +164,7 @@ class DefinePlugin {
164164
? ParserHelpers.toConstantDependencyWithWebpackRequire(
165165
parser,
166166
code
167-
)
167+
)
168168
: ParserHelpers.toConstantDependency(parser, code)
169169
);
170170
parser.hooks.typeof

0 commit comments

Comments
 (0)