-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy patheslint.config.mjs
More file actions
104 lines (91 loc) · 2.87 KB
/
Copy patheslint.config.mjs
File metadata and controls
104 lines (91 loc) · 2.87 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
import globals from "globals";
import pluginJs from "@eslint/js";
import tseslint from "typescript-eslint";
import prettierlint from "eslint-config-prettier";
import pluginReact from "eslint-plugin-react";
import pluginStorybook from "eslint-plugin-storybook";
import pluginReactHooks from "eslint-plugin-react-hooks";
import pluginPreferArrows from "eslint-plugin-prefer-arrow-functions";
import pluginReactRefresh from "eslint-plugin-react-refresh";
import pluginImportX from "eslint-plugin-import-x";
/** @type {import("eslint").Linter.Config[]} */
export default [
{
// This is auto-generated by Panda so we do not need to lint it.
ignores: ["src/styled-system/"],
// This is auto-generated by Paraglide JS so we do not need to lint it.
ignores: ["src/paraglide/"],
},
{
files: ["**/*.{ts,tsx}"],
},
{
settings: { react: { version: "19.0", }, },
languageOptions: {
ecmaVersion: "latest",
sourceType: "module",
globals: globals.browser,
parserOptions: {
projectService: true,
tsconfigRootDir: import.meta.dirname,
},
}
},
prettierlint,
pluginJs.configs.recommended,
...tseslint.configs.recommendedTypeChecked,
...tseslint.configs.stylisticTypeChecked,
pluginReact.configs.flat.recommended,
pluginReact.configs.flat["jsx-runtime"],
...pluginStorybook.configs["flat/recommended"],
pluginReactRefresh.configs.recommended,
pluginImportX.flatConfigs.recommended,
pluginImportX.flatConfigs.typescript,
{
"rules": {
"@typescript-eslint/consistent-type-imports": "error",
"react-refresh/only-export-components": ["warn", { allowConstantExport: true }],
"import-x/no-default-export": "error",
},
},
{
files: [
// Stories need default exports, so we disable the rule there: https://github.com/storybookjs/storybook/issues/12914#issue-729393535
"**/*.stories.tsx",
// Library config files typically use default exports, so we disable the rule
"**/*.config.ts",
// Tanstack Start config files need default export, so we disable the rule
"**/ssr.tsx",
"**/api.ts",
],
"rules": {
"import-x/no-default-export": "off",
}
},
// https://github.com/facebook/react/issues/28313#issuecomment-2580001921
{
plugins: {
"react-hooks": pluginReactHooks,
},
rules: {
"react-hooks/rules-of-hooks": "error",
"react-hooks/exhaustive-deps": "warn",
},
},
// Prefer arrow functions in all of our code
{
plugins: {
"prefer-arrow-functions": pluginPreferArrows,
},
rules: {
"prefer-arrow-functions/prefer-arrow-functions": [
"error",
{
"returnStyle": "implicit",
}
],
"prefer-arrow-callback": ["error", { allowNamedFunctions: false }],
"func-style": ["error", "expression", { allowArrowFunctions: false }],
},
},
];