Skip to content

Commit 748389e

Browse files
Add Jest linting (#33)
1 parent c85b540 commit 748389e

File tree

4 files changed

+25
-2
lines changed

4 files changed

+25
-2
lines changed

README.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,10 @@ This package contains several main ESLint configs for different project styles:
1212
- `matrix-org/typescript`: The style for TypeScript projects. It extends
1313
`matrix-org/javascript`.
1414

15-
There is also a mixin config that can be used together with any of the above:
15+
There are also some mixin configs that can be used together with any of the above:
1616

1717
- `matrix-org/react`: The style for React projects.
18+
- `matrix-org/jest`: The style for projects that use Jest for testing.
1819

1920
# Getting started
2021

@@ -101,7 +102,7 @@ Standard TypeScript with React
101102
}
102103
```
103104

104-
Standard TypeScript with React and jsx a11y
105+
Standard TypeScript with React, jsx a11y, and Jest
105106
```js
106107
{
107108
plugins: [
@@ -111,6 +112,7 @@ Standard TypeScript with React and jsx a11y
111112
"plugin:matrix-org/typescript",
112113
"plugin:matrix-org/react",
113114
"plugin:matrix-org/a11y"
115+
"plugin:matrix-org/jest"
114116
]
115117
}
116118
```
@@ -145,6 +147,7 @@ following depending on the configs you enable:
145147
* eslint-config-google
146148
* eslint-config-prettier
147149
* eslint-plugin-deprecate
150+
* eslint-plugin-jest
148151
* eslint-plugin-jsx-a11y
149152
* eslint-plugin-react
150153
* eslint-plugin-react-hooks

index.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,6 @@ module.exports = {
88
"react": require("./react"),
99
"typescript": require("./typescript"),
1010
"a11y": require("./a11y"),
11+
"jest": require("./jest"),
1112
},
1213
};

jest.js

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
module.exports = {
2+
plugins: ["jest"],
3+
extends: ["plugin:jest/recommended"],
4+
rules: {
5+
"jest/no-standalone-expect": [
6+
"error",
7+
{
8+
additionalTestBlockFunctions: [
9+
"beforeAll",
10+
"beforeEach",
11+
],
12+
},
13+
],
14+
// It's ok to have no expect assertions in your test. Maybe you're testing that
15+
// things just don't blow up.
16+
"jest/expect-expect": "off",
17+
},
18+
};

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
"eslint-config-prettier": "*",
2727
"eslint-plugin-deprecate": "*",
2828
"eslint-plugin-import": "*",
29+
"eslint-plugin-jest": "*",
2930
"eslint-plugin-jsx-a11y": "*",
3031
"eslint-plugin-react": "*",
3132
"eslint-plugin-react-hooks": "*",

0 commit comments

Comments
 (0)