-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patheslint.config.js
101 lines (100 loc) · 3.17 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
import globals from "globals";
import pluginJs from "@eslint/js";
import tseslint from "typescript-eslint";
import pluginReact from "eslint-plugin-react";
import eslintConfigPrettier from "eslint-config-prettier";
import eslintConfigPrettierRecommended from "eslint-plugin-prettier/recommended";
import * as importPlugin from "eslint-plugin-import";
import "eslint-import-resolver-typescript";
/** @type {import('eslint').Linter.Config} */
export default [
{
ignores: [
"**/node_modules/",
"build/",
".react-router",
"test-results",
"playwright-report",
"server.mjs",
],
},
{
files: ["**/*.{js,mjs,cjs,ts,jsx,tsx}"],
},
{
languageOptions: {
parserOptions: {
projectService: true,
tsconfigRootDir: import.meta.dirname,
},
},
},
{
settings: {
"import/resolver": {
typescript: true,
node: true,
},
react: {
createClass: "createReactClass", // Regex for Component Factory to use,
// default to "createReactClass"
pragma: "React", // Pragma to use, default to "React"
fragment: "Fragment", // Fragment to use (may be a property of <pragma>), default to "Fragment"
version: "detect", // React version. "detect" automatically picks the version you have installed.
// You can also use `16.0`, `16.3`, etc, if you want to override the detected value.
// Defaults to the "defaultVersion" setting and warns if missing, and to "detect" in the future
defaultVersion: "18.3.1", // Default React version to use when the version you have installed cannot be detected.
// If not provided, defaults to the latest React version.
},
formComponents: [
// Components used as alternatives to <form> for forms, eg. <Form endpoint={ url } />
"Form",
],
linkComponents: [{ name: "Link", linkAttribute: "to" }],
},
},
{ languageOptions: { globals: { ...globals.browser, ...globals.node } } },
pluginJs.configs.recommended,
...tseslint.configs.recommended,
...tseslint.configs.recommendedTypeChecked,
pluginReact.configs.flat.recommended,
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
importPlugin.flatConfigs.recommended,
{
rules: {
"react/react-in-jsx-scope": "off",
"react/prop-types": "off",
"require-await": "warn",
"@typescript-eslint/no-unnecessary-condition": "warn",
"@typescript-eslint/no-floating-promises": ["warn"],
"@typescript-eslint/await-thenable": ["warn"],
"@typescript-eslint/only-throw-error": "off",
"import/order": [
"error",
{
"newlines-between": "always",
groups: [
"builtin",
"external",
"type",
"internal",
"parent",
"sibling",
"index",
"object",
],
pathGroups: [
{
pattern: "@/**",
group: "internal",
},
],
distinctGroup: false,
},
],
},
},
eslintConfigPrettierRecommended,
// Turn off rules that conflict with prettier
eslintConfigPrettier,
];