tsconfig.json
{
"include": ["src"],
"compilerOptions": {
"target": "ESNext" ,
"lib": [
"ESNext",
"DOM",
"DOM.Iterable",
"WebWorker",
"Decorators"
],
"jsx": "react-jsx" ,
"module": "ESNext" ,
"moduleResolution": "Bundler" ,
"baseUrl": "./" ,
"paths": {
"@/*": ["./src/*"]
},
"allowImportingTsExtensions": true ,
"resolveJsonModule": true ,
"allowJs": true ,
"checkJs": true ,
"noEmit": true,
"outDir": "./dist" ,
"removeComments": true ,
"esModuleInterop": true ,
"forceConsistentCasingInFileNames": true ,
"strict": true ,
"noImplicitAny": true ,
"useUnknownInCatchVariables": true ,
"noUnusedLocals": true ,
"noUnusedParameters": true ,
"noFallthroughCasesInSwitch": true ,
"skipLibCheck": true
}
}
eslint.config.mjs
import globals from 'globals'
import tseslint from 'typescript-eslint'
import react from 'eslint-plugin-react'
import reactHooks from 'eslint-plugin-react-hooks'
import typescriptParser from '@typescript-eslint/parser'
import typescript from '@typescript-eslint/eslint-plugin'
import reactRefresh from 'eslint-plugin-react-refresh'
import eslintPluginPrettierRecommended from 'eslint-plugin-prettier/recommended'
export default tseslint.config(
{
files: ['src/**/*.{ts,tsx}'],
languageOptions: {
parser: typescriptParser,
ecmaVersion: 2020,
globals: globals.browser,
parserOptions: {
project: './tsconfig.json',
},
},
plugins: {
'@typescript-eslint': typescript,
},
rules: {
...typescript.configs.recommended.rules,
'prefer-const': 'error',
},
},
{
files: ['src/**/*.{jsx,ts,tsx}'],
plugins: {
react,
'react-hooks': reactHooks,
'react-refresh': reactRefresh,
},
settings: {
react: {
version: 'detect',
},
},
rules: {
...react.configs.recommended.rules,
...react.configs['jsx-runtime'].rules,
...reactHooks.configs.recommended.rules,
},
},
{
files: ['src/**/*.{js,jsx,ts,tsx}'],
...eslintPluginPrettierRecommended,
rules: {
...eslintPluginPrettierRecommended.rules,
'prettier/prettier': [
'error',
{},
{
usePrettierrc: true,
},
],
},
},
)