Repository navigation
Expand file tree
/
Copy patheslint.config.ts
More file actions
70 lines (68 loc) · 2.21 KB
/
Copy patheslint.config.ts
File metadata and controls
70 lines (68 loc) · 2.21 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
import { defineConfig, globalIgnores } from "eslint/config";
import pluginImport from "eslint-plugin-import";
import pluginReactHooks from "eslint-plugin-react-hooks";
import pluginImportSort from "eslint-plugin-simple-import-sort";
import globals from "globals";
import nextVitals from "eslint-config-next/core-web-vitals";
import nextTs from "eslint-config-next/typescript";
import prettier from "eslint-config-prettier/flat";
/**
* This is the esLinter configuration file that dictates how all of the
* type/javascript files are formatted and linted.
*/
export default defineConfig([
globalIgnores([
"**/node_modules/*",
"**/public/*",
"**/.next/*",
"**/next-env.d.ts",
]),
...nextVitals,
...nextTs,
prettier,
pluginReactHooks.configs.flat["recommended-latest"],
{
files: ["src/**/*.{js,cjs,mjs,jsx,ts,cts,mts,tsx}"],
languageOptions: {
ecmaVersion: 2020,
globals: globals.browser,
},
plugins: {
"simple-import-sort": pluginImportSort,
import: pluginImport,
},
rules: {
...pluginReactHooks.configs.recommended.rules,
"@typescript-eslint/no-empty-function": "off",
"@typescript-eslint/no-explicit-any": "warn",
"@typescript-eslint/no-unused-expressions": [
"error",
{ allowShortCircuit: true, allowTernary: true },
],
"no-restricted-imports": [
"error",
{
patterns: [{ regex: "^@mui/[^/]+$" }, { regex: "^@toolpad/[^/]+$" }],
},
],
"react/boolean-prop-naming": "error",
"react/button-has-type": "error",
"react/display-name": "error",
"react/hook-use-state": "warn",
"react/jsx-boolean-value": "warn",
"react/jsx-handler-names": "warn",
"react/jsx-pascal-case": "error",
"react/jsx-sort-props": "warn",
"react/jsx-uses-react": "error",
"react/no-children-prop": "error",
"react/no-danger-with-children": "error",
"react/prefer-stateless-function": "error",
"react/prop-types": "error",
"simple-import-sort/imports": "warn",
"simple-import-sort/exports": "warn",
"import/first": "error",
"import/newline-after-import": "error",
"import/no-duplicates": "error",
},
},
]);