Skip to content

Commit d2c3caa

Browse files
committed
chore(style): Format whole codebase with prettier and enforce it on CI (#520)
1 parent 709da89 commit d2c3caa

26 files changed

+335
-240
lines changed

.circleci/config.yml

+2-3
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,7 @@ jobs:
88
- checkout
99
- attach_workspace:
1010
at: ~/
11-
- cypress/install:
12-
install-browsers: true
13-
install-command: yarn install --frozen-lockfile
11+
- run: yarn install --frozen-lockfile
1412
- persist_to_workspace:
1513
root: ~/
1614
paths: .
@@ -23,6 +21,7 @@ jobs:
2321
at: ~/
2422
- run: yarn lint
2523
- run: yarn build
24+
- run: yarn format-check
2625
- run: node scripts/release.js
2726
- persist_to_workspace:
2827
root: ~/

cypress/e2e/click.cy.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -124,10 +124,10 @@ describe("cy.realClick", () => {
124124
const screenCenter = screenTop + (screenBottom - screenTop) / 2;
125125

126126
expect($elTop).to.eq(
127-
Math.floor(screenCenter - $canvas.outerHeight() / 2)
127+
Math.floor(screenCenter - $canvas.outerHeight() / 2),
128128
);
129129
expect($elBottom).to.equal(
130-
Math.floor(screenCenter + $canvas.outerHeight() / 2)
130+
Math.floor(screenCenter + $canvas.outerHeight() / 2),
131131
);
132132
});
133133
});
@@ -214,4 +214,4 @@ describe("iframe behavior", { retries: 10 }, () => {
214214
cy.get("#target").realClick().contains("clicked").should("exist");
215215
});
216216
});
217-
});
217+
});

cypress/e2e/hover.cy.ts

+5-5
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ describe("cy.realHover", () => {
1313
cy.get(".action-btn").should(
1414
"have.css",
1515
"background-color",
16-
"rgb(217, 83, 79)"
16+
"rgb(217, 83, 79)",
1717
);
1818
});
1919

@@ -66,10 +66,10 @@ describe("cy.realHover", () => {
6666
const screenCenter = screenTop + (screenBottom - screenTop) / 2;
6767

6868
expect($elTop).to.equal(
69-
Math.floor(screenCenter) - $canvas.outerHeight() / 2
69+
Math.floor(screenCenter) - $canvas.outerHeight() / 2,
7070
);
7171
expect($elBottom).to.equal(
72-
Math.floor(screenCenter) + $canvas.outerHeight() / 2
72+
Math.floor(screenCenter) + $canvas.outerHeight() / 2,
7373
);
7474
});
7575
});
@@ -144,7 +144,7 @@ describe("iframe behavior", { retries: 10 }, () => {
144144
.realHover()
145145
.then(($target) => {
146146
expect($target.css("background-color")).to.equal(
147-
"rgb(255, 192, 203)"
147+
"rgb(255, 192, 203)",
148148
);
149149
});
150150
});
@@ -169,7 +169,7 @@ describe("iframe behavior", { retries: 10 }, () => {
169169
.realHover()
170170
.then(($target) => {
171171
expect($target.css("background-color")).to.equal(
172-
"rgb(255, 192, 203)"
172+
"rgb(255, 192, 203)",
173173
);
174174
});
175175
});

cypress/e2e/mouse.cy.ts

+12-12
Original file line numberDiff line numberDiff line change
@@ -7,19 +7,19 @@ describe("cy.realMouseDown and cy.realMouseUp", () => {
77
cy.get(".action-btn").should(
88
"have.css",
99
"background-color",
10-
"rgb(217, 83, 79)"
10+
"rgb(217, 83, 79)",
1111
);
1212
cy.get(".action-btn").realMouseDown();
1313
cy.get(".action-btn").should(
1414
"have.css",
1515
"background-color",
16-
"rgb(172, 41, 37)"
16+
"rgb(172, 41, 37)",
1717
);
1818
cy.get(".action-btn").realMouseUp(); // will go in hover state
1919
cy.get(".action-btn").should(
2020
"have.css",
2121
"background-color",
22-
"rgb(201, 48, 44)"
22+
"rgb(201, 48, 44)",
2323
);
2424
});
2525

@@ -123,10 +123,10 @@ describe("cy.realMouseDown and cy.realMouseUp", () => {
123123
const screenCenter = screenTop + (screenBottom - screenTop) / 2;
124124

125125
expect($elTop).to.equal(
126-
Math.floor(screenCenter) - $canvas.outerHeight() / 2
126+
Math.floor(screenCenter) - $canvas.outerHeight() / 2,
127127
);
128128
expect($elBottom).to.equal(
129-
Math.floor(screenCenter) + $canvas.outerHeight() / 2
129+
Math.floor(screenCenter) + $canvas.outerHeight() / 2,
130130
);
131131
});
132132
});
@@ -204,10 +204,10 @@ describe("cy.realMouseDown and cy.realMouseUp", () => {
204204
const screenCenter = screenTop + (screenBottom - screenTop) / 2;
205205

206206
expect($elTop).to.equal(
207-
Math.floor(screenCenter) - $canvas.outerHeight() / 2
207+
Math.floor(screenCenter) - $canvas.outerHeight() / 2,
208208
);
209209
expect($elBottom).to.equal(
210-
Math.floor(screenCenter) + $canvas.outerHeight() / 2
210+
Math.floor(screenCenter) + $canvas.outerHeight() / 2,
211211
);
212212
});
213213
});
@@ -285,7 +285,7 @@ describe(
285285
.realMouseDown()
286286
.then(($target) => {
287287
expect($target.css("background-color")).to.equal(
288-
"rgb(0, 0, 255)"
288+
"rgb(0, 0, 255)",
289289
);
290290
});
291291

@@ -294,7 +294,7 @@ describe(
294294
.realMouseUp()
295295
.then(($target) => {
296296
expect($target.css("background-color")).to.equal(
297-
"rgb(255, 192, 203)"
297+
"rgb(255, 192, 203)",
298298
);
299299
});
300300
});
@@ -319,7 +319,7 @@ describe(
319319
.realMouseDown()
320320
.then(($target) => {
321321
expect($target.css("background-color")).to.equal(
322-
"rgb(0, 0, 255)"
322+
"rgb(0, 0, 255)",
323323
);
324324
});
325325

@@ -328,12 +328,12 @@ describe(
328328
.realMouseUp()
329329
.then(($target) => {
330330
expect($target.css("background-color")).to.equal(
331-
"rgb(255, 192, 203)"
331+
"rgb(255, 192, 203)",
332332
);
333333
});
334334
});
335335
});
336-
}
336+
},
337337
);
338338

339339
describe("realMouseMove", () => {

cypress/e2e/swipe.cy.ts

+44-30
Original file line numberDiff line numberDiff line change
@@ -1,45 +1,59 @@
11
describe("cy.realSwipe", () => {
22
beforeEach(() => {
3-
cy.viewport("iphone-x")
3+
cy.viewport("iphone-x");
44
cy.visit("https://csb-dhe0i-qj8xxmx8y.vercel.app/");
55
});
66

7-
([
8-
{
9-
button: "left",
10-
swipe: "toLeft",
11-
length: 150,
12-
touchPosition: "right",
13-
},
14-
{
15-
button: "right",
16-
swipe: "toRight",
17-
length: 150,
18-
touchPosition: "left",
19-
},
20-
{
21-
button: "top",
22-
swipe: "toTop",
23-
length: 300,
24-
touchPosition: "center",
25-
},
26-
{
27-
button: "bottom",
28-
swipe: "toBottom",
29-
length: 300,
30-
touchPosition: "top",
31-
},
32-
] as const).forEach(({ button, swipe, length, touchPosition }) => {
7+
(
8+
[
9+
{
10+
button: "left",
11+
swipe: "toLeft",
12+
length: 150,
13+
touchPosition: "right",
14+
},
15+
{
16+
button: "right",
17+
swipe: "toRight",
18+
length: 150,
19+
touchPosition: "left",
20+
},
21+
{
22+
button: "top",
23+
swipe: "toTop",
24+
length: 300,
25+
touchPosition: "center",
26+
},
27+
{
28+
button: "bottom",
29+
swipe: "toBottom",
30+
length: 300,
31+
touchPosition: "top",
32+
},
33+
] as const
34+
).forEach(({ button, swipe, length, touchPosition }) => {
3335
it(`swipes ${button} drawer ${swipe}`, { retries: 4 }, () => {
3436
cy.contains("button", button).click();
35-
cy.get(".MuiDrawer-paper").realSwipe(swipe, { length, step: 10, touchPosition });
37+
cy.get(".MuiDrawer-paper").realSwipe(swipe, {
38+
length,
39+
step: 10,
40+
touchPosition,
41+
});
3642

3743
cy.get(".MuiDrawer-paper").should("not.be.visible");
3844
});
3945
});
4046

4147
it("opens drawer with swipe", { retries: 4 }, () => {
42-
cy.get('.jss3.jss4').realSwipe("toRight", { length: 150, step: 10, touchPosition: "center" });
43-
cy.get('.MuiDrawer-paper').realSwipe("toLeft", { length: 150, step: 10, touchPosition: "center" });
48+
cy.get(".jss3.jss4").realSwipe("toRight", {
49+
length: 150,
50+
step: 10,
51+
touchPosition: "center",
52+
});
53+
cy.get(".MuiDrawer-paper").realSwipe("toLeft", {
54+
length: 150,
55+
step: 10,
56+
touchPosition: "center",
57+
});
4458
});
4559
});

cypress/e2e/touch.cy.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -71,4 +71,4 @@ describe("cy.realTouch", () => {
7171
})
7272
.realTouch({ radiusX: 5, radiusY: 7 });
7373
});
74-
});
74+
});

cypress/e2e/type.cy.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ describe("cy.realType", () => {
99

1010
cy.get("input[name=q]").should(
1111
"have.value",
12-
"cypress can produce real events"
12+
"cypress can produce real events",
1313
);
1414
});
1515

0 commit comments

Comments
 (0)