-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy patheslint.config.js
110 lines (104 loc) · 2.9 KB
/
eslint.config.js
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
import tsPlugin from '@typescript-eslint/eslint-plugin'
import tsParser from '@typescript-eslint/parser'
import prettierPlugin from 'eslint-plugin-prettier'
import reactPlugin from 'eslint-plugin-react'
import reactHooksPlugin from 'eslint-plugin-react-hooks'
import importPlugin from 'eslint-plugin-import'
import { fileURLToPath } from 'url'
import { dirname, resolve } from 'path'
const __filename = fileURLToPath(import.meta.url)
const __dirname = dirname(__filename)
export default [
// Configuración para TypeScript
{
files: ['**/src/**/*.{ts,tsx}'], // Solo archivos TypeScript
ignores: [
'**/node_modules/**',
'**/dist/**',
'**/.next/**',
'**/build/**',
'**/coverage/**',
'**/*.spec.ts',
'**/*.e2e-spec.ts',
'**/*.d.ts',
'**/backend/dist/**',
'**/frontend/.next/**',
'**/frontend/dist/**',
],
languageOptions: {
ecmaVersion: 2021,
sourceType: 'module',
parser: tsParser,
},
plugins: {
'@typescript-eslint': tsPlugin,
prettier: prettierPlugin,
react: reactPlugin,
'react-hooks': reactHooksPlugin,
import: importPlugin,
},
rules: {
'prettier/prettier': 'error',
'@typescript-eslint/no-unused-vars': 'warn',
'react-hooks/rules-of-hooks': 'error',
'react-hooks/exhaustive-deps': 'warn',
'import/no-extraneous-dependencies': 'error',
},
},
// Configuración para JavaScript
{
files: ['**/src/**/*.{js,jsx}'], // Solo archivos JavaScript
languageOptions: {
ecmaVersion: 2021,
sourceType: 'module',
parserOptions: {
ecmaFeatures: {
jsx: true,
},
},
},
plugins: {
prettier: prettierPlugin,
react: reactPlugin,
'react-hooks': reactHooksPlugin,
import: importPlugin,
},
rules: {
'prettier/prettier': 'error',
'no-unused-vars': 'warn', // Usar la regla nativa de ESLint para JS
'react-hooks/rules-of-hooks': 'error',
'react-hooks/exhaustive-deps': 'warn',
'import/no-extraneous-dependencies': 'error',
},
},
// Configuración específica para backend
{
files: ['**/backend/src/**/*.{ts,tsx}'],
languageOptions: {
parser: tsParser,
parserOptions: {
project: resolve(__dirname, 'backend/tsconfig.json'),
tsconfigRootDir: resolve(__dirname, 'backend'),
},
},
},
// Configuración específica para frontend
{
files: ['**/frontend/src/**/*.{ts,tsx}'],
languageOptions: {
parser: tsParser,
parserOptions: {
project: resolve(__dirname, 'frontend/tsconfig.json'),
tsconfigRootDir: resolve(__dirname, 'frontend'),
},
},
},
// Ignorar archivos generados
{
files: ['**/backend/dist/**/*', '**/frontend/.next/**/*'],
rules: {
'@typescript-eslint/no-unused-vars': 'off',
'import/no-extraneous-dependencies': 'off',
},
},
]