forked from StreamFi-x/streamfi-frontend
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patheslint.config.mjs
More file actions
76 lines (69 loc) · 2.22 KB
/
eslint.config.mjs
File metadata and controls
76 lines (69 loc) · 2.22 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
import { dirname } from "path";
import { fileURLToPath } from "url";
import { FlatCompat } from "@eslint/eslintrc";
const __filename = fileURLToPath(import.meta.url);
const __dirname = dirname(__filename);
const compat = new FlatCompat({
baseDirectory: __dirname,
});
const eslintConfig = [
{
ignores: [
".next/**",
"dist/**",
"build/**",
"coverage/**",
".turbo/**",
"node_modules/**",
],
},
...compat.extends("next/core-web-vitals", "next/typescript"),
{
rules: {
// Code quality rules
"no-console": "warn", // Warn about console.log statements
"no-debugger": "error", // Error on debugger statements
"no-unused-vars": "off", // Turn off base rule as it conflicts with TypeScript
"no-undef": "off", // TypeScript's compiler handles undefined-variable checking
"prefer-const": "error", // Prefer const over let when possible
"no-var": "error", // Don't allow var declarations
// React specific rules
"react-hooks/rules-of-hooks": "error", // Enforce rules of hooks
"react-hooks/exhaustive-deps": "warn", // Warn about missing dependencies
"react/jsx-key": "error", // Require key prop in lists
"react/jsx-no-duplicate-props": "error", // No duplicate props
// TypeScript specific rules
"@typescript-eslint/no-unused-vars": "error", // TypeScript unused vars
"@typescript-eslint/no-explicit-any": "warn", // Warn about any usage
// Best practices
eqeqeq: "error", // Require === and !==
curly: "error", // Require curly braces
"no-eval": "error", // No eval usage
"no-implied-eval": "error", // No implied eval
"no-new-func": "error", // No new Function()
},
},
{
files: [
"**/__tests__/**/*.{js,jsx,ts,tsx}",
"**/*.{test,spec}.{js,jsx,ts,tsx}",
"__mocks__/**/*.{js,ts}",
],
languageOptions: {
globals: {
jest: "readonly",
describe: "readonly",
it: "readonly",
expect: "readonly",
beforeEach: "readonly",
afterEach: "readonly",
beforeAll: "readonly",
afterAll: "readonly",
},
},
rules: {
"no-undef": "off",
},
},
];
export default eslintConfig;