Skip to content

Commit f1092ad

Browse files
committed
Update prettier toolchain
1 parent fc2feaf commit f1092ad

38 files changed

+203
-253
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+
};

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
@@ -624,12 +624,12 @@ class Compilation extends Tapable {
624624
const errorAndCallback = this.bail
625625
? err => {
626626
callback(err);
627-
}
627+
}
628628
: err => {
629629
err.dependencies = [dependency];
630630
this.errors.push(err);
631631
callback();
632-
};
632+
};
633633

634634
if (
635635
typeof dependency !== "object" ||

lib/ContextModule.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -281,9 +281,11 @@ class ContextModule extends Module {
281281
getReturnModuleObjectSource(fakeMap, fakeMapDataExpression = "fakeMap[id]") {
282282
if (typeof fakeMap === "number")
283283
return `return ${this.getReturn(fakeMap)};`;
284-
return `return ${fakeMapDataExpression} === 1 ? ${this.getReturn(1)} : ${
285-
fakeMapDataExpression
286-
} ? ${this.getReturn(2)} : ${this.getReturn(0)};`;
284+
return `return ${fakeMapDataExpression} === 1 ? ${this.getReturn(
285+
1
286+
)} : ${fakeMapDataExpression} ? ${this.getReturn(2)} : ${this.getReturn(
287+
0
288+
)};`;
287289
}
288290

289291
getSyncSource(dependencies, id) {
@@ -500,9 +502,7 @@ module.exports = webpackAsyncContext;`;
500502

501503
const chunksStartPosition = typeof fakeMap === "object" ? 2 : 1;
502504
const requestPrefix = hasMultipleOrNoChunks
503-
? `Promise.all(ids.slice(${
504-
chunksStartPosition
505-
}).map(__webpack_require__.e))`
505+
? `Promise.all(ids.slice(${chunksStartPosition}).map(__webpack_require__.e))`
506506
: `__webpack_require__.e(ids[${chunksStartPosition}])`;
507507
const returnModuleObject = this.getReturnModuleObjectSource(
508508
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

lib/EnvironmentPlugin.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,7 @@ class EnvironmentPlugin {
4242
if (value === undefined) {
4343
compiler.hooks.thisCompilation.tap("EnvironmentPlugin", compilation => {
4444
const error = new Error(
45-
`EnvironmentPlugin - ${
46-
key
47-
} environment variable is undefined.\n\n` +
45+
`EnvironmentPlugin - ${key} environment variable is undefined.\n\n` +
4846
"You can pass an object with default values to suppress this warning.\n" +
4947
"See https://webpack.js.org/plugins/environment-plugin for example."
5048
);

0 commit comments

Comments
 (0)