Files
2026-03-11 22:40:29 +05:45

65 lines
1.8 KiB
JavaScript

import js from '@eslint/js'
import globals from 'globals'
import react from 'eslint-plugin-react'
import reactHooks from 'eslint-plugin-react-hooks'
import reactRefresh from 'eslint-plugin-react-refresh'
import tseslint from 'typescript-eslint'
import { defineConfig, globalIgnores } from 'eslint/config'
import eslintPluginPrettierRecommended from 'eslint-plugin-prettier/recommended'
export default defineConfig([
globalIgnores(['dist']),
{
files: ['**/*.{ts,tsx}'],
plugins: {
react,
},
extends: [
js.configs.recommended,
tseslint.configs.recommended,
reactHooks.configs.flat.recommended,
reactRefresh.configs.vite,
eslintPluginPrettierRecommended,
],
languageOptions: {
ecmaVersion: 2020,
globals: globals.browser,
},
rules: {
...react.configs.recommended.rules,
...reactHooks.configs.recommended.rules,
'react-refresh/only-export-components': ['warn', { allowConstantExport: true }],
// ESLint basic rules
'no-implicit-coercion': 'error',
'no-useless-escape': 'error',
'prefer-const': 'error',
'no-console': ['warn', { allow: ['warn', 'error', 'info'] }],
'no-debugger': 'error',
'no-nested-ternary': 'warn',
curly: ['error', 'all'],
// TypeScript rules
'@typescript-eslint/no-unused-vars': [
'error',
{ varsIgnorePattern: '^_', argsIgnorePattern: '^_' },
],
// React rules
'react-hooks/exhaustive-deps': 'error',
'react/jsx-key': 'error',
'react/jsx-no-bind': ['error', { allowArrowFunctions: true }],
// Disabled rules
'react/react-in-jsx-scope': 'off',
'react/prop-types': 'off',
},
settings: {
react: {
version: 'detect',
},
},
},
])