-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy patheslint.config.js
108 lines (106 loc) · 2.48 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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
import js from "@eslint/js";
import prettier from "eslint-config-prettier";
import a11yLint from "eslint-plugin-jsx-a11y";
import prettierPlugin from "eslint-plugin-prettier";
import reactHooks from "eslint-plugin-react-hooks";
import globals from "globals";
import tseslint from "typescript-eslint";
const ERROR = "error";
const WARN = "warn";
export default tseslint.config(
{
ignores: [
"**/.cache/**",
"**/node_modules/**",
"**/build/**",
"**/public/build/**",
"**/server-build/**",
"**/dist/**",
"**/coverage/**",
"**/.netlify/**",
"**/app/generated/**",
],
},
{
plugins: {
import: (await import("eslint-plugin-import-x")).default,
},
languageOptions: {
globals: {
...globals.browser,
...globals.node,
},
},
rules: {
"no-unexpected-multiline": ERROR,
"no-warning-comments": [
ERROR,
{ terms: ["FIXME"], location: "anywhere" },
],
"import/no-duplicates": [WARN, { "prefer-inline": true }],
"import/order": [
WARN,
{
alphabetize: { order: "asc", caseInsensitive: true },
pathGroups: [{ pattern: "#*/**", group: "internal" }],
groups: [
"builtin",
"external",
"internal",
"parent",
"sibling",
"index",
],
},
],
},
},
{
files: ["**/*.tsx", "**/*.jsx"],
plugins: {
react: (await import("eslint-plugin-react")).default,
},
languageOptions: {
parser: (await import("typescript-eslint")).parser,
parserOptions: {
jsx: true,
},
},
rules: {
"react/jsx-key": WARN,
},
},
{
extends: [js.configs.recommended, ...tseslint.configs.recommended],
files: ["**/*.{ts,tsx}"],
languageOptions: {
ecmaVersion: 2020,
globals: globals.browser,
},
plugins: {
"react-hooks": reactHooks,
"jsx-a11y": a11yLint,
},
rules: {
...reactHooks.configs.recommended.rules,
...a11yLint.configs.recommended.rules,
"jsx-a11y/alt-text": "off", // it's not smart enough...
},
},
{
files: ["**/*.js", "**/*.ts", "**/*.jsx", "**/*.tsx"],
plugins: {
prettier: prettierPlugin,
},
languageOptions: {
parserOptions: {
ecmaVersion: "latest",
sourceType: "module",
},
},
rules: {
...prettier.rules,
"prettier/prettier": "error",
},
},
);