-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patheslint.config.mjs
More file actions
157 lines (137 loc) · 3.75 KB
/
eslint.config.mjs
File metadata and controls
157 lines (137 loc) · 3.75 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
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
import js from "@eslint/js";
import { FlatCompat } from "@eslint/eslintrc";
const compat = new FlatCompat({
// import.meta.dirname is available after Node.js v20.11.0
baseDirectory: import.meta.dirname,
recommendedConfig: js.configs.recommended,
});
const eslintConfig = [
// Use Next.js recommended configuration as base
...compat.config({
extends: [
"next/core-web-vitals", // Includes Next.js specific rules + React rules
"next/typescript", // TypeScript specific rules for Next.js
"prettier", // Disable ESLint rules that conflict with Prettier
],
}),
// Global ignores (replaces .eslintignore)
{
ignores: [
// Dependencies
"**/node_modules/**",
"**/.pnp",
"**/.pnp.js",
"**/.yarn/**",
// Build outputs
"**/.next/**",
"**/out/**",
"**/build/**",
"**/dist/**",
"**/.vercel/**",
"**/storybook-static/**",
// Testing & Coverage
"**/coverage/**",
"**/.nyc_output/**",
"**/test-results/**",
"**/playwright-report/**",
"**/playwright/.cache/**",
// Configuration files
"**/*.config.js",
"**/*.config.mjs",
"**/*.config.ts",
"**/commitlint.config.js",
// Generated files
"**/*.min.js",
"**/*.min.css",
"**/public/sw.js",
"**/public/workbox-*.js",
"**/public/worker-*.js",
"**/public/fallback-*.js",
"**/public/precache.*.js",
// TypeScript
"**/*.d.ts",
"**/next-env.d.ts",
"**/*.tsbuildinfo",
// Logs
"**/logs/**",
"**/*.log",
"**/npm-debug.log*",
"**/yarn-debug.log*",
"**/yarn-error.log*",
"**/pnpm-debug.log*",
"**/lerna-debug.log*",
// OS files
"**/.DS_Store",
"**/Thumbs.db",
// Security
"**/*.pem",
"**/*.key",
"**/*.crt",
// Environment
"**/.env*",
// Temporary & cache
"**/.cache/**",
"**/.parcel-cache/**",
"**/tmp/**",
"**/temp/**",
"**/*.tmp",
"**/*.temp",
// Package files
"**/package-lock.json",
"**/yarn.lock",
"**/pnpm-lock.yaml",
// Documentation
"**/*.md",
"**/LICENSE",
// Misc
"**/.eslintcache",
"**/.prettierignore",
"**/.gitignore",
],
},
// Add custom rules as a separate configuration object
{
rules: {
// TypeScript rules (warnings for gradual adoption)
"@typescript-eslint/no-explicit-any": "warn",
"@typescript-eslint/no-unused-vars": [
"warn",
{
argsIgnorePattern: "^_",
varsIgnorePattern: "^_",
caughtErrorsIgnorePattern: "^_",
},
],
"@typescript-eslint/consistent-type-imports": [
"warn",
{
prefer: "type-imports",
fixStyle: "inline-type-imports",
},
],
// React best practices
// Allow both arrow functions and function declarations
"react/function-component-definition": "off",
// Next.js specific rules
"@next/next/no-html-link-for-pages": "error",
"@next/next/no-img-element": "warn", // Warn instead of error for gradual migration
// General code quality
"no-console": [
"warn",
{
allow: ["warn", "error", "info", "debug"], // Allow more console methods in development
},
],
"prefer-const": "error",
"no-var": "error",
"object-shorthand": "warn",
"prefer-arrow-callback": "off", // Turn off to allow function expressions
"prefer-template": "warn",
// Import rules (when import plugin is available)
"import/first": "off",
"import/newline-after-import": "off",
"import/no-duplicates": "off",
},
},
];
export default eslintConfig;