-
Notifications
You must be signed in to change notification settings - Fork 2
/
eslint.config.js
56 lines (54 loc) · 1.58 KB
/
eslint.config.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
import globals from "globals";
import pluginJs from "@eslint/js";
import eslintConfigPrettier from "eslint-config-prettier";
import jestPlugin from "eslint-plugin-jest";
export default [
pluginJs.configs.recommended,
eslintConfigPrettier,
{
files: ["src/**/*.js"],
languageOptions: {
globals: { ...globals.browser, ...globals.node },
},
rules: {
"no-unused-vars": [
"warn",
{ argsIgnorePattern: "^_", varsIgnorePattern: "^_" },
],
},
},
{
files: ["**/*.test.js", "**/*.spec.js"],
plugins: {
jest: jestPlugin,
},
languageOptions: {
globals: {
...globals.jest,
},
},
rules: {
...jestPlugin.configs.recommended.rules,
"jest/expect-expect": "error",
"jest/no-disabled-tests": "error",
"jest/no-done-callback": "error",
"jest/no-duplicate-hooks": "error",
"jest/no-conditional-expect": "error",
"jest/no-export": "error",
"jest/no-focused-tests": "error",
"jest/no-identical-title": "error",
"jest/no-interpolation-in-snapshots": "error",
"jest/no-jasmine-globals": "error",
"jest/no-large-snapshots": "error",
"jest/no-mocks-import": "error",
"jest/no-standalone-expect": "error",
"jest/no-test-prefixes": "error",
"jest/valid-expect-in-promise": "error",
"jest/prefer-to-have-length": "warn",
"jest/valid-expect": "error",
},
},
];
// useful links:
// + https://prettier.io/docs/en/integrating-with-linters.html
// + https://dev.to/alexyang/jest-best-practice-1-use-eslint-plugin-jest-o7e