vite-templates/eslint.config.js

51 lines
1.4 KiB
JavaScript
Raw Permalink 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'
2024-09-30 10:13:11 -04:00
import prettierPlugin from 'eslint-plugin-prettier'
2024-09-30 09:25:00 -04:00
export default tseslint.config(
{ ignores: ['dist'] },
{
2024-09-30 10:13:11 -04:00
extends: [
js.configs.recommended,
...tseslint.configs.recommendedTypeChecked,
'plugin:prettier/recommended',
],
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 10:13:11 -04:00
sourceType: 'module',
ecmaFeatures: {
jsx: true,
},
2024-09-30 09:37:11 -04:00
},
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 10:13:11 -04:00
prettier: prettierPlugin,
2024-09-30 09:37:11 -04:00
react,
2024-09-30 09:25:00 -04:00
'react-hooks': reactHooks,
'react-refresh': reactRefresh,
},
rules: {
2024-09-30 10:13:11 -04:00
'prettier/prettier': 'error',
'react/react-in-jsx-scope': 'off',
'@typescript-eslint/explicit-module-boundary-types': 'off',
2024-09-30 09:25:00 -04:00
...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 },
],
},
},
)