-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy patheslint.config.js
88 lines (86 loc) · 2.47 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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
// @ts-check
import js from "@eslint/js";
// @ts-expect-error https://github.com/import-js/eslint-plugin-import/issues/2948
import imp from "eslint-plugin-import";
import prettier from "eslint-plugin-prettier";
// support will be added soon: https://github.com/jsx-eslint/eslint-plugin-react/pull/3727
import react from "eslint-plugin-react";
// import reactRecommended from "eslint-plugin-react/configs/recommended.js";
// support will be added soon: https://github.com/facebook/react/pull/28773
import reactHooks from "eslint-plugin-react-hooks";
import simpleImpSort from "eslint-plugin-simple-import-sort";
import ts from "typescript-eslint";
export default ts.config(
{ ignores: ["node_modules", "**/dist"] },
{
files: ["**/*.{j,t}s?(x)"],
extends: [
js.configs.recommended,
...ts.configs.recommended,
// reactRecommended, // not compatible currently
// reactHooks.configs.recommended, // not compatible currently
],
plugins: {
prettier,
import: imp,
"simple-import-sort": simpleImpSort,
"react-hooks": reactHooks,
react,
},
rules: {
"prettier/prettier": "warn",
"arrow-body-style": ["warn", "as-needed"],
"no-console": "warn",
eqeqeq: ["error", "always"],
"simple-import-sort/imports": [
"warn",
{
groups: [
[
"vitest",
// scss and css file imports
"\\.s?css$",
// side effect (e.g. `import "./foo"`)
"^\\u0000",
// every import starting with "react"
"^react",
// things that start with a letter (or digit or underscore), or `@` followed by a letter
"^@?\\w",
// internal relative paths
"^\\.",
],
],
},
],
"simple-import-sort/exports": "warn",
"no-restricted-imports": [
"error",
{
patterns: ["**/build/*", "**/dist/*"],
},
],
"import/no-duplicates": "warn",
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/no-unused-vars": [
"warn",
{
argsIgnorePattern: "^_",
varsIgnorePattern: "^_",
caughtErrorsIgnorePattern: "^_",
},
],
},
},
{
files: ["**/*.d.ts"],
rules: {
"no-var": "off",
},
},
{
files: ["**/*.test.ts?(x)"],
rules: {
"@typescript-eslint/no-non-null-assertion": "off",
},
},
);