Skip to content

Commit 1406a5a

Browse files
style: fix stylistics problems
1 parent 5abe1ad commit 1406a5a

File tree

7 files changed

+16
-39
lines changed

7 files changed

+16
-39
lines changed

src/utils.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -662,9 +662,7 @@ function getExportCode(exports, replacements, options) {
662662

663663
async function resolveRequests(resolve, context, possibleRequests) {
664664
return resolve(context, possibleRequests[0])
665-
.then((result) => {
666-
return result;
667-
})
665+
.then((result) => result)
668666
.catch((error) => {
669667
const [, ...tailPossibleRequests] = possibleRequests;
670668

test/helpers/compile.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
export default (compiler) => {
2-
return new Promise((resolve, reject) => {
1+
export default (compiler) =>
2+
new Promise((resolve, reject) => {
33
compiler.run((error, stats) => {
44
if (error) {
55
return reject(error);
@@ -8,4 +8,3 @@ export default (compiler) => {
88
return resolve(stats);
99
});
1010
});
11-
};

test/helpers/getErrors.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import normalizeErrors from "./normalizeErrors";
22

3-
export default (stats, shortError, type) => {
4-
return normalizeErrors(stats.compilation.errors, shortError, type).sort();
5-
};
3+
export default (stats, shortError, type) =>
4+
normalizeErrors(stats.compilation.errors, shortError, type).sort();

test/helpers/getWarnings.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
11
import normalizeErrors from "./normalizeErrors";
22

3-
export default (stats) => {
4-
return normalizeErrors(stats.compilation.warnings).sort();
5-
};
3+
export default (stats) => normalizeErrors(stats.compilation.warnings).sort();

test/helpers/normalizeErrors.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@ function removeCWD(str) {
2727
.replace(new RegExp(cwd, "g"), "");
2828
}
2929

30-
export default (errors, shortError, type) => {
31-
return errors.map((error) => {
30+
export default (errors, shortError, type) =>
31+
errors.map((error) => {
3232
let errorMessage = error.toString();
3333

3434
if (shortError) {
@@ -50,4 +50,3 @@ export default (errors, shortError, type) => {
5050

5151
return removeCWD(errorMessage.split("\n").slice(0, 12).join("\n"));
5252
});
53-
};

test/modules-option.test.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -676,9 +676,7 @@ describe('"modules" option', () => {
676676
it("issue #1063 throw error", async () => {
677677
const compiler = getCompiler("./modules/issue-1063/issue-1063.js", {
678678
modules: {
679-
mode: () => {
680-
return "not local, global or pure";
681-
},
679+
mode: () => "not local, global or pure",
682680
},
683681
});
684682
const stats = await compile(compiler);

test/runtime/api.test.js

Lines changed: 7 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -27,19 +27,15 @@ describe("api", () => {
2727
});
2828

2929
it("should toString a single module", () => {
30-
const m = api(function (i) {
31-
return i[1];
32-
});
30+
const m = api((i) => i[1]);
3331

3432
m.push([1, "body { a: 1; }", ""]);
3533

3634
expect(m.toString()).toMatchSnapshot();
3735
});
3836

3937
it("should toString multiple modules", () => {
40-
const m = api(function (i) {
41-
return i[1];
42-
});
38+
const m = api((i) => i[1]);
4339

4440
m.push([2, "body { b: 2; }", ""]);
4541
m.push([1, "body { a: 1; }", ""]);
@@ -48,9 +44,7 @@ describe("api", () => {
4844
});
4945

5046
it("should toString with media query", () => {
51-
const m = api(function (i) {
52-
return i[1];
53-
});
47+
const m = api((i) => i[1]);
5448

5549
const m1 = [1, "body { a: 1; }", "screen"];
5650
const m2 = [2, "body { b: 2; }", ""];
@@ -66,9 +60,7 @@ describe("api", () => {
6660
});
6761

6862
it("should import modules", () => {
69-
const m = api(function (i) {
70-
return i[1];
71-
});
63+
const m = api((i) => i[1]);
7264
const m1 = [1, "body { a: 1; }", "(orientation:landscape)"];
7365
const m2 = [2, "body { b: 2; }", ""];
7466
const m3 = [3, "body { c: 3; }", ""];
@@ -84,9 +76,7 @@ describe("api", () => {
8476
});
8577

8678
it("should import named modules", () => {
87-
const m = api(function (i) {
88-
return i[1];
89-
});
79+
const m = api((i) => i[1]);
9080
const m1 = ["./module1", "body { a: 1; }", "screen"];
9181
const m2 = ["./module2", "body { b: 2; }", ""];
9282
const m3 = ["./module3", "body { c: 3; }", ""];
@@ -156,9 +146,7 @@ describe("api", () => {
156146
});
157147

158148
it("should import modules with dedupe", () => {
159-
const m = api(function (i) {
160-
return i[1];
161-
});
149+
const m = api((i) => i[1]);
162150

163151
const m1 = [null, "body { b: 1; }", ""];
164152
const m2 = ["./module2", "body { b: 2; }", ""];
@@ -175,9 +163,7 @@ describe("api", () => {
175163
});
176164

177165
it("should import modules when module string", () => {
178-
const m = api(function (i) {
179-
return i[1];
180-
});
166+
const m = api((i) => i[1]);
181167

182168
m.i(".button { b: 2; }");
183169
m.i("");

0 commit comments

Comments
 (0)