vite-templates/eslint.config.js

38 lines
1.0 KiB
JavaScript
Raw Normal View History

2024-09-30 09:25:00 -04:00
import js from '@eslint/js'
import globals from 'globals'
2024-09-30 09:37:11 -04:00
import react from 'eslint-plugin-react'
2024-09-30 09:25:00 -04:00
import reactHooks from 'eslint-plugin-react-hooks'
import reactRefresh from 'eslint-plugin-react-refresh'
import tseslint from 'typescript-eslint'
export default tseslint.config(
{ ignores: ['dist'] },
{
2024-09-30 09:37:11 -04:00
extends: [js.configs.recommended, ...tseslint.configs.recommendedTypeChecked],
2024-09-30 09:25:00 -04:00
files: ['**/*.{ts,tsx}'],
languageOptions: {
ecmaVersion: 2020,
globals: globals.browser,
2024-09-30 09:37:11 -04:00
parserOptions: {
project: ['./tsconfig.node.json', './tsconfig.app.json'],
tsconfigRootDir: import.meta.dirname,
},
2024-09-30 09:25:00 -04:00
},
2024-09-30 09:37:11 -04:00
settings: { react: { version: '18.3' } },
2024-09-30 09:25:00 -04:00
plugins: {
2024-09-30 09:37:11 -04:00
react,
2024-09-30 09:25:00 -04:00
'react-hooks': reactHooks,
'react-refresh': reactRefresh,
},
rules: {
...reactHooks.configs.recommended.rules,
2024-09-30 09:37:11 -04:00
...react.configs.recommended.rules,
...react.configs['jsx-runtime'].rules,
2024-09-30 09:25:00 -04:00
'react-refresh/only-export-components': [
'warn',
{ allowConstantExport: true },
],
},
},
)