-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patheslint.config.js
75 lines (73 loc) · 2.05 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
import js from "@eslint/js";
import globals from "globals";
import reactHooks from "eslint-plugin-react-hooks";
import reactRefresh from "eslint-plugin-react-refresh";
import tseslint from "typescript-eslint";
import pluginReact from "eslint-plugin-react";
import importPlugin from "eslint-plugin-import";
import noRelativeImportsPlugin from "eslint-plugin-no-relative-import-paths";
import { fileURLToPath } from "url";
import { dirname } from "path";
const __filename = fileURLToPath(import.meta.url);
const __dirname = dirname(__filename);
export default tseslint.config(
{ ignores: ["dist"] },
{ languageOptions: { globals: globals.browser } },
{
extends: [js.configs.recommended, ...tseslint.configs.recommended],
files: ["**/*.{ts,tsx}"],
languageOptions: {
parserOptions: {
project: "./tsconfig.app.json",
tsconfigRootDir: __dirname,
},
},
settings: {
react: {
version: "detect",
},
},
plugins: {
"react-hooks": reactHooks,
"react-refresh": reactRefresh,
react: pluginReact,
import: importPlugin,
"no-relative-import-paths": noRelativeImportsPlugin,
},
rules: {
...reactHooks.configs.recommended.rules,
"@typescript-eslint/naming-convention": [
"error",
{
selector: "interface",
format: ["PascalCase"],
},
],
"react/function-component-definition": [
2,
{
namedComponents: "function-declaration",
},
],
"no-console": "error",
"import/order": 2,
"no-relative-import-paths/no-relative-import-paths": [
"error",
{
allowSameFolder: true,
},
],
"no-nested-ternary": 2,
"@typescript-eslint/consistent-type-imports": [
"error",
{
prefer: "type-imports",
},
],
"dot-notation": "off",
"@typescript-eslint/dot-notation": "error",
"react/react-in-jsx-scope": "off",
},
ignores: ["vite-env.d.ts", "vite.config.ts", "vitest.config.ts"],
},
);