1+ import eslint from '@eslint/js'
2+ import tseslint from '@typescript-eslint/eslint-plugin'
3+ import tseslintParser from '@typescript-eslint/parser'
4+ import prettier from 'eslint-plugin-prettier'
5+ import react from 'eslint-plugin-react'
6+ import reactHooks from 'eslint-plugin-react-hooks'
7+
8+ const config = [
9+ {
10+ ignores : [
11+ 'node_modules/**' ,
12+ 'dist/**' ,
13+ '.next/**' ,
14+ 'coverage/**' ,
15+ '*.js' ,
16+ '*.cjs' ,
17+ '*.mjs' ,
18+ 'postcss.config.js' ,
19+ 'next.config.js' ,
20+ 'tailwind.config.ts'
21+ ]
22+ } ,
23+ eslint . configs . recommended ,
24+ {
25+ files : [ '**/*.ts' , '**/*.tsx' ] ,
26+ languageOptions : {
27+ ecmaVersion : 2022 ,
28+ sourceType : 'module' ,
29+ parser : tseslintParser ,
30+ parserOptions : {
31+ project : [ './tsconfig.json' ] ,
32+ tsconfigRootDir : import . meta. dirname ,
33+ ecmaFeatures : {
34+ jsx : true
35+ }
36+ } ,
37+ globals : {
38+ process : 'readonly' ,
39+ console : 'readonly' ,
40+ __dirname : 'readonly' ,
41+ __filename : 'readonly' ,
42+ Buffer : 'readonly' ,
43+ setTimeout : 'readonly' ,
44+ clearTimeout : 'readonly' ,
45+ setInterval : 'readonly' ,
46+ clearInterval : 'readonly' ,
47+ NodeJS : 'readonly' ,
48+ React : 'readonly' ,
49+ JSX : 'readonly'
50+ }
51+ } ,
52+ plugins : {
53+ '@typescript-eslint' : tseslint ,
54+ 'prettier' : prettier ,
55+ 'react' : react ,
56+ 'react-hooks' : reactHooks
57+ } ,
58+ settings : {
59+ react : {
60+ version : 'detect'
61+ }
62+ } ,
63+ rules : {
64+ // Prettier configuration - enforce single quotes and no semicolons
65+ 'prettier/prettier' : [
66+ 'error' ,
67+ {
68+ singleQuote : true ,
69+ semi : false ,
70+ arrowParens : 'always' ,
71+ bracketSpacing : true ,
72+ trailingComma : 'es5' ,
73+ printWidth : 100 ,
74+ tabWidth : 2 ,
75+ useTabs : false ,
76+ jsxSingleQuote : true
77+ }
78+ ] ,
79+
80+ // TypeScript specific rules
81+ '@typescript-eslint/no-explicit-any' : 'warn' ,
82+ '@typescript-eslint/explicit-function-return-type' : 'off' ,
83+ '@typescript-eslint/no-unsafe-assignment' : 'off' ,
84+ '@typescript-eslint/no-unsafe-member-access' : 'off' ,
85+ '@typescript-eslint/no-unsafe-argument' : 'off' ,
86+ '@typescript-eslint/no-misused-promises' : 'off' ,
87+ '@typescript-eslint/ban-ts-comment' : 'off' ,
88+
89+ // General rules
90+ 'no-unused-vars' : 'off' ,
91+ '@typescript-eslint/no-unused-vars' : [ 'warn' , {
92+ 'argsIgnorePattern' : '^_' ,
93+ 'varsIgnorePattern' : '^_' ,
94+ 'caughtErrorsIgnorePattern' : '^_'
95+ } ] ,
96+
97+ // Enforce consistent coding style
98+ 'quotes' : 'off' ,
99+ '@typescript-eslint/quotes' : [ 'error' , 'single' , { 'avoidEscape' : true } ] ,
100+ 'semi' : 'off' ,
101+ '@typescript-eslint/semi' : [ 'error' , 'never' ] ,
102+ 'jsx-quotes' : [ 'error' , 'prefer-single' ] ,
103+
104+ // React specific rules
105+ 'react/prop-types' : 'off' ,
106+ 'react/react-in-jsx-scope' : 'off' , // Not needed in Next.js
107+ 'react/jsx-uses-react' : 'off' ,
108+ 'react/jsx-uses-vars' : 'error' ,
109+ 'react-hooks/rules-of-hooks' : 'error' ,
110+ 'react-hooks/exhaustive-deps' : 'warn' ,
111+
112+ // Next.js specific
113+ 'no-console' : [ 'warn' , { allow : [ 'warn' , 'error' ] } ] ,
114+ 'prefer-const' : 'error' ,
115+ 'no-var' : 'error' ,
116+ 'object-shorthand' : 'error' ,
117+ 'prefer-arrow-callback' : 'error'
118+ }
119+ }
120+ ]
121+
122+ export default config
0 commit comments