Skip to content

Commit bce6e23

Browse files
authored
Merge pull request #1766 from skaut/frontend-eslint-updates
[frontend] Updated eslint vitest ruleset
2 parents 8cd6afd + 658da38 commit bce6e23

20 files changed

+8
-82
lines changed

packages/frontend/eslint.config.js

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,14 @@ export default tseslint.config(
234234
"vitest/prefer-comparison-matcher": "error",
235235
"vitest/prefer-each": "error",
236236
"vitest/prefer-equality-matcher": "error",
237-
"vitest/prefer-expect-assertions": "error",
237+
"vitest/prefer-expect-assertions": [
238+
"error",
239+
{
240+
onlyFunctionsWithAsyncKeyword: true,
241+
onlyFunctionsWithExpectInCallback: true,
242+
onlyFunctionsWithExpectInLoop: true,
243+
},
244+
],
238245
"vitest/prefer-expect-resolves": "error",
239246
"vitest/prefer-hooks-in-order": "error",
240247
"vitest/prefer-hooks-on-top": "error",
@@ -243,9 +250,7 @@ export default tseslint.config(
243250
"vitest/prefer-spy-on": "error",
244251
"vitest/prefer-strict-equal": "error",
245252
"vitest/prefer-to-be": "error",
246-
"vitest/prefer-to-be-falsy": "error",
247253
"vitest/prefer-to-be-object": "error",
248-
"vitest/prefer-to-be-truthy": "error",
249254
"vitest/prefer-to-contain": "error",
250255
"vitest/prefer-to-have-length": "error",
251256
"vitest/prefer-todo": "error",

packages/frontend/tests/App.test.tsx

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,6 @@ describe("App", () => {
1515
});
1616

1717
test("should render correctly", () => {
18-
expect.assertions(1);
19-
2018
vi.mocked(swr).default.mockReturnValue({
2119
data: testData,
2220
error: undefined,
@@ -34,8 +32,6 @@ describe("App", () => {
3432
});
3533

3634
test("should render projects correctly", () => {
37-
expect.assertions(1);
38-
3935
vi.mocked(swr).default.mockReturnValue({
4036
data: testData,
4137
error: undefined,
@@ -53,8 +49,6 @@ describe("App", () => {
5349
});
5450

5551
test("should render project listing correctly", () => {
56-
expect.assertions(1);
57-
5852
vi.mocked(swr).default.mockReturnValue({
5953
data: testData,
6054
error: undefined,
@@ -72,8 +66,6 @@ describe("App", () => {
7266
});
7367

7468
test("should render issue listing correctly", () => {
75-
expect.assertions(1);
76-
7769
vi.mocked(swr).default.mockReturnValue({
7870
data: testData,
7971
error: undefined,
@@ -91,8 +83,6 @@ describe("App", () => {
9183
});
9284

9385
test("should handle error gracefully", () => {
94-
expect.assertions(1);
95-
9686
vi.mocked(swr).default.mockReturnValue({
9787
data: undefined,
9888
error: true,

packages/frontend/tests/components/AppNavigation.test.tsx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@ import { AppNavigation } from "../../src/components/AppNavigation";
66

77
describe("AppNavigation component", () => {
88
test("should render correctly", () => {
9-
expect.assertions(1);
10-
119
const { container } = render(
1210
<MemoryRouter>
1311
<AppNavigation />

packages/frontend/tests/components/Button.test.tsx

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@ import { Button } from "../../src/components/Button";
55

66
describe("Button component", () => {
77
test("should render correctly", () => {
8-
expect.assertions(1);
9-
108
const { container } = render(
119
<Button href="http://www.somewhere.com">Link somewhere</Button>,
1210
);
@@ -15,8 +13,6 @@ describe("Button component", () => {
1513
});
1614

1715
test("should render correctly with title", () => {
18-
expect.assertions(1);
19-
2016
const { container } = render(
2117
<Button href="http://www.somewhere.com" title="myTitle">
2218
Link somewhere
@@ -27,8 +23,6 @@ describe("Button component", () => {
2723
});
2824

2925
test("should render correctly with custom class", () => {
30-
expect.assertions(1);
31-
3226
const { container } = render(
3327
<Button className="myClassName" href="http://www.somewhere.com">
3428
Link somewhere
@@ -39,8 +33,6 @@ describe("Button component", () => {
3933
});
4034

4135
test("should render correctly with target self", () => {
42-
expect.assertions(1);
43-
4436
const { container } = render(
4537
<Button href="http://www.somewhere.com" targetSelf>
4638
Link somewhere

packages/frontend/tests/components/ColoredTag.test.tsx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@ import { ColoredTag } from "../../src/components/ColoredTag";
55

66
describe("ColoredTag component", () => {
77
test("should render correctly", () => {
8-
expect.assertions(1);
9-
108
const { container } = render(<ColoredTag>Tag</ColoredTag>);
119

1210
expect(container.firstChild).toMatchSnapshot();

packages/frontend/tests/components/ExtLink.test.tsx

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@ import { ExtLink } from "../../src/components/ExtLink";
55

66
describe("ExtLink component", () => {
77
test("should render correctly", () => {
8-
expect.assertions(1);
9-
108
const { container } = render(
119
<ExtLink href="http://www.somewhere.com">Link somewhere</ExtLink>,
1210
);
@@ -15,8 +13,6 @@ describe("ExtLink component", () => {
1513
});
1614

1715
test("should render correctly with title", () => {
18-
expect.assertions(1);
19-
2016
const { container } = render(
2117
<ExtLink href="http://www.somewhere.com" title="myTitle">
2218
Link somewhere
@@ -27,8 +23,6 @@ describe("ExtLink component", () => {
2723
});
2824

2925
test("should render correctly with custom class", () => {
30-
expect.assertions(1);
31-
3226
const { container } = render(
3327
<ExtLink className="myClassName" href="http://www.somewhere.com">
3428
Link somewhere
@@ -39,8 +33,6 @@ describe("ExtLink component", () => {
3933
});
4034

4135
test("should render correctly with target self", () => {
42-
expect.assertions(1);
43-
4436
const { container } = render(
4537
<ExtLink href="http://www.somewhere.com" targetSelf>
4638
Link somewhere

packages/frontend/tests/components/Issue.test.tsx

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ const issueWithProject = getIssueWithProject(
1818

1919
describe("Issue component", () => {
2020
test("should render correctly", () => {
21-
expect.assertions(2);
2221
expect(issue).not.toBeNull();
2322

2423
const { container } = render(
@@ -31,8 +30,6 @@ describe("Issue component", () => {
3130
});
3231

3332
test("should render correctly without tags", () => {
34-
expect.assertions(1);
35-
3633
const { container } = render(
3734
<MemoryRouter>
3835
<Issue hideTags issue={issueWithProject} />

packages/frontend/tests/components/IssuesList.test.tsx

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,6 @@ const project = testData.projects[0];
99

1010
describe("IssuesList component", () => {
1111
test("should render correctly", () => {
12-
expect.assertions(1);
13-
1412
const { container } = render(
1513
<MemoryRouter>
1614
<IssuesList issues={project.issues} project={project} />
@@ -21,8 +19,6 @@ describe("IssuesList component", () => {
2119
});
2220

2321
test("should render correctly without link", () => {
24-
expect.assertions(1);
25-
2622
const { container } = render(
2723
<MemoryRouter>
2824
<IssuesList

packages/frontend/tests/components/Navigation.test.tsx

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@ import { Navigation } from "../../src/components/Navigation";
66

77
describe("Navigation component", () => {
88
test("should render correctly", () => {
9-
expect.assertions(1);
10-
119
const { container } = render(
1210
<MemoryRouter>
1311
<Navigation
@@ -29,8 +27,6 @@ describe("Navigation component", () => {
2927
});
3028

3129
test("should render correctly with active item", () => {
32-
expect.assertions(1);
33-
3430
const { container } = render(
3531
<MemoryRouter>
3632
<Navigation

packages/frontend/tests/components/Project.test.tsx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,6 @@ const project = testData.projects[0];
99

1010
describe("Project component", () => {
1111
test("should render correctly", () => {
12-
expect.assertions(1);
13-
1412
const { container } = render(
1513
<MemoryRouter>
1614
<Project project={project} />

0 commit comments

Comments
 (0)