eslint.config.mjs
Rama main · réplica de lectura del repositorio original.
import js from '@eslint/js'
import tseslint from 'typescript-eslint'
import react from 'eslint-plugin-react'
import reactHooks from 'eslint-plugin-react-hooks'
import importPlugin from 'eslint-plugin-import'
import jsxA11y from 'eslint-plugin-jsx-a11y'
import globals from 'globals'
export default [
{
ignores: ['.next/'],
},
{
files: ['**/*.{js,jsx,mjs,cjs,ts,tsx}'],
...js.configs.recommended,
languageOptions: {
globals: {
...globals.browser,
...globals.node,
},
},
plugins: {
react,
'react-hooks': reactHooks,
import: importPlugin,
'jsx-a11y': jsxA11y,
},
rules: {
...js.configs.recommended.rules,
// Next.js rules are handled by next lint's internal config
// React rules
'react-hooks/rules-of-hooks': 'error',
'react-hooks/exhaustive-deps': 'warn',
'react/prop-types': 'off',
'react/react-in-jsx-scope': 'off',
'react/no-unknown-property': 'off',
'react/jsx-no-target-blank': 'off',
// Import rules
'import/no-anonymous-default-export': 'warn',
// JSX A11y rules
'jsx-a11y/alt-text': ['warn', { elements: ['img'], img: ['Image'] }],
'jsx-a11y/aria-props': 'warn',
'jsx-a11y/aria-proptypes': 'warn',
'jsx-a11y/aria-unsupported-elements': 'warn',
'jsx-a11y/role-has-required-aria-props': 'warn',
'jsx-a11y/role-supports-aria-props': 'warn',
},
settings: {
react: {
version: 'detect',
},
},
},
...tseslint.config({
files: ['**/*.ts', '**/*.tsx'],
extends: [
...tseslint.configs.recommended,
],
languageOptions: {
parserOptions: {
projectService: true,
},
},
rules: {
'@typescript-eslint/ban-ts-comment': 'warn',
'@typescript-eslint/no-empty-object-type': 'warn',
'@typescript-eslint/no-explicit-any': 'warn',
'@typescript-eslint/no-unused-vars': [
'warn',
{
vars: 'all',
args: 'after-used',
ignoreRestSiblings: false,
argsIgnorePattern: '^_',
varsIgnorePattern: '^_',
destructuredArrayIgnorePattern: '^_',
caughtErrorsIgnorePattern: '^(_|ignore)',
},
],
},
}),
]