The project uses a flat configuration format for ESLint. It applies recommended configurations for JavaScript, TypeScript, React Hooks, and Vite React Refresh.
Key behaviors include:
- Global Ignores: The
dist directory is ignored by default. - TypeScript Rules: Unused variables starting with an underscore (
_) are permitted. The @typescript-eslint/ban-ts-comment rule is disabled. - Fast Refresh Exceptions: To support the pattern where components and utility values (like
buttonVariants) are exported from the same file, the react-refresh/only-export-components rule is disabled for:src/components/ui/**/*.{ts,tsx}src/components/editor/**/*.{ts,tsx}
import js from '@eslint/js'
import globals from 'globals'
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'
export default defineConfig([
globalIgnores(['dist']),
{
files: ['**/*.{ts,tsx}'],
extends: [
js.configs.recommended,
tseslint.configs.recommended,
reactHooks.configs.flat.recommended,
reactRefresh.configs.vite,
],
languageOptions: {
ecmaVersion: 2020,
globals: globals.browser,
},
rules: {
'@typescript-eslint/no-unused-vars': ['error', { varsIgnorePattern: '^_', argsIgnorePattern: '^_' }],
'@typescript-eslint/ban-ts-comment': 'off',
},
},
{
files: ['src/components/ui/**/*.{ts,tsx}'],
rules: {
'react-refresh/only-export-components': 'off',
},
},
{
files: ['src/components/editor/**/*.{ts,tsx}'],
rules: {
'react-refresh/only-export-components': 'off',
},
},
])