-
Notifications
You must be signed in to change notification settings - Fork 33
Expand file tree
/
Copy patheslint.config.mjs
More file actions
112 lines (102 loc) · 2.8 KB
/
eslint.config.mjs
File metadata and controls
112 lines (102 loc) · 2.8 KB
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
109
110
// ESLint flat config for TypeScript + React (ESLint v9)
// See: https://eslint.org/docs/latest/use/configure/configuration-files-new
// @ts-nocheck
import globals from "globals";
import tseslint from "@typescript-eslint/eslint-plugin";
import tsParser from "@typescript-eslint/parser";
import reactPlugin from "eslint-plugin-react";
import reactHooks from "eslint-plugin-react-hooks";
import { defineConfig } from "eslint/config";
export default defineConfig([
{
ignores: [
".docusaurus/**",
"build/**",
"node_modules/**",
"coverage/**",
"dist/**",
"**/*.min.js",
".eslintrc.js",
],
linterOptions: {
reportUnusedDisableDirectives: true,
},
},
// TypeScript files
{
files: ["**/*.{ts,tsx}"],
languageOptions: {
parser: tsParser,
parserOptions: {
projectService: true,
tsconfigRootDir: process.cwd(),
ecmaVersion: 2023,
sourceType: "module",
ecmaFeatures: { jsx: true },
},
globals: {
...globals.browser,
...globals.node,
},
},
plugins: {
"@typescript-eslint": tseslint,
react: reactPlugin,
"react-hooks": reactHooks,
},
settings: {
react: { version: "detect" },
},
rules: {
"@typescript-eslint/consistent-type-imports": ["error", { prefer: "type-imports" }],
"@typescript-eslint/no-unused-vars": [
"warn",
{ argsIgnorePattern: "^_", varsIgnorePattern: "^_" },
],
"@typescript-eslint/no-explicit-any": "off",
"no-unused-vars": "off",
"no-console": ["warn", { allow: ["warn", "error"] }],
eqeqeq: ["error", "smart"],
"prefer-const": "error",
"react/jsx-uses-react": "off",
"react/react-in-jsx-scope": "off",
"react/no-unknown-property": ["error", { ignore: ["class"] }],
"react/prop-types": "off",
"react-hooks/rules-of-hooks": "error",
"react-hooks/exhaustive-deps": "warn",
},
},
// JavaScript files
{
files: ["**/*.{js,jsx}"],
languageOptions: {
parserOptions: {
ecmaVersion: 2023,
sourceType: "module",
ecmaFeatures: { jsx: true },
},
globals: {
...globals.browser,
...globals.node,
},
},
plugins: {
react: reactPlugin,
"react-hooks": reactHooks,
},
settings: {
react: { version: "detect" },
},
rules: {
"no-console": ["warn", { allow: ["warn", "error"] }],
eqeqeq: ["error", "smart"],
"prefer-const": "error",
"react/jsx-uses-react": "off",
"react/react-in-jsx-scope": "off",
"react/no-unknown-property": ["error", { ignore: ["class"] }],
"react/prop-types": "off",
"react-hooks/rules-of-hooks": "error",
"react-hooks/exhaustive-deps": "warn",
},
},
]);