-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy patheslint.config.mjs
More file actions
120 lines (108 loc) · 3.97 KB
/
eslint.config.mjs
File metadata and controls
120 lines (108 loc) · 3.97 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
import { FlatCompat } from '@eslint/eslintrc'
import eslintJs from '@eslint/js'
import tanstackQueryPlugin from '@tanstack/eslint-plugin-query'
import prettierConfig from 'eslint-config-prettier'
// import storybookPlugin from 'eslint-plugin-storybook'
import { dirname } from 'path'
import tseslint from 'typescript-eslint'
import { fileURLToPath } from 'url'
// import globals from "globals"; // Uncomment if you need to define global environments like browser/node explicitly
const __filename = fileURLToPath(import.meta.url)
const __dirname = dirname(__filename)
const compat = new FlatCompat({
baseDirectory: __dirname,
})
const eslintConfig = [
// Base ESLint recommended rules
eslintJs.configs.recommended,
// Next.js configurations using FlatCompat
...compat.extends('next/core-web-vitals', 'next/typescript'),
// TypeScript configuration
...tseslint.config({
// This is equivalent to plugin:@typescript-eslint/recommended-type-checked
// It applies recommended rules that require type information.
extends: [...tseslint.configs.recommendedTypeChecked, ...tseslint.configs.stylisticTypeChecked],
files: ['**/*.ts', '**/*.tsx'],
languageOptions: {
parser: tseslint.parser,
parserOptions: {
project: './tsconfig.eslint.json', // Changed to use tsconfig.eslint.json
tsconfigRootDir: __dirname,
},
},
rules: {
// Your specific TypeScript rules
'@typescript-eslint/no-unused-vars': [
'warn',
{
argsIgnorePattern: '^_',
varsIgnorePattern: '^_',
},
],
'@typescript-eslint/consistent-type-imports': 'warn',
// Add other TypeScript specific rules here if needed
},
}),
// TanStack Query configuration
{
files: ['**/*.ts', '**/*.tsx'], // Apply only to relevant files
plugins: {
'@tanstack/query': tanstackQueryPlugin,
},
rules: {
...tanstackQueryPlugin.configs.recommended.rules,
},
},
// Tailwind CSS configuration - disabled for now, not compatible with eslint 9
// {
// files: ['**/*.ts', '**/*.tsx', '**/*.js', '**/*.jsx'], // Apply to relevant files
// plugins: {
// tailwindcss: tailwindcssPlugin,
// },
// rules: {
// ...tailwindcssPlugin.configs.recommended.rules,
// },
// },
// Storybook configuration
// {
// // For Storybook files, typically in .stories.ts/tsx or .storybook/
// files: ['**/*.stories.@(ts|tsx|js|jsx|mjs|cjs)', '.storybook/**'],
// plugins: {
// storybook: storybookPlugin,
// },
// processor: storybookPlugin.processors.storiesMd, // if you use .stories.md files
// rules: {
// // Using spread for rules from storybookPlugin.configs.recommended.rules
// // is safer as 'extends' is not a standard property in flat config objects directly
// ...storybookPlugin.configs.recommended.rules,
// },
// },
// If you have .stories.mdx files:
// {
// files: ['**/*.stories.mdx'],
// extends: ['plugin:mdx/recommended'],
// rules: {
// 'react/jsx-filename-extension': [1, { extensions: ['.mdx'] }],
// },
// },
// General rules (can be in a separate object or merged)
{
rules: {
'react/self-closing-comp': 'warn',
// Add other global/JS/React rules here
},
},
// Prettier configuration (should be last to override other styling rules)
prettierConfig,
// Ignore patterns
{
ignores: [
'node_modules/',
'.next/',
'.vercel/',
'contracts/*/*', // Your custom ignore pattern
// Add other global ignore patterns here
],
},
]
export default eslintConfig