-
Notifications
You must be signed in to change notification settings - Fork 92
/
Copy patheslint.config.js
47 lines (45 loc) · 1.68 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
import pluginJs from "@eslint/js";
import configPrettier from "eslint-config-prettier";
import pluginNoOnlyTests from "eslint-plugin-no-only-tests";
import pluginReact from "eslint-plugin-react";
import pluginReactHooks from "eslint-plugin-react-hooks";
import pluginTypescript from "typescript-eslint";
for (const config of pluginTypescript.configs.recommendedTypeChecked) {
config.files = ["**/*.{ts,tsx,mts,cts}"]; // ensure config only targets TypeScript files
}
/** @type {import('eslint').Linter.Config[]} */
export default [
{ ignores: ["**/dist/"] },
pluginJs.configs.recommended,
pluginReact.configs.flat.recommended,
pluginReact.configs.flat["jsx-runtime"],
{ settings: { react: { version: "detect" } } },
{ plugins: { "no-only-tests": pluginNoOnlyTests, "react-hooks": pluginReactHooks } },
{
rules: {
"no-console": "error",
"no-only-tests/no-only-tests": "error",
"no-undef": "off",
"no-unused-vars": ["error", { argsIgnorePattern: "^_", varsIgnorePattern: "^_" }],
"react/prop-types": "off",
"react-hooks/rules-of-hooks": "error",
"react-hooks/exhaustive-deps": "error",
},
},
...pluginTypescript.configs.recommendedTypeChecked,
{ languageOptions: { parserOptions: { projectService: true } } },
{
files: ["**/*.{ts,tsx,mts,cts}"],
rules: {
"@typescript-eslint/no-unused-vars": ["error", { argsIgnorePattern: "^_", varsIgnorePattern: "^_" }],
},
},
{
files: ["**/*.test.{ts,tsx,mts,cts}"],
rules: {
// native node test runner types for describe() and it() return a promise, so disable this rule in tests
"@typescript-eslint/no-floating-promises": "off",
},
},
configPrettier,
];