76 lines
2.4 KiB
JavaScript
76 lines
2.4 KiB
JavaScript
|
|
import eslintReact from '@eslint-react/eslint-plugin'
|
||
|
|
import eslintJs from '@eslint/js'
|
||
|
|
import nextVitals from 'eslint-config-next/core-web-vitals'
|
||
|
|
import prettier from 'eslint-config-prettier/flat'
|
||
|
|
import reactYouMightNotNeedAnEffect from 'eslint-plugin-react-you-might-not-need-an-effect'
|
||
|
|
import { defineConfig } from 'eslint/config'
|
||
|
|
import tseslint from 'typescript-eslint'
|
||
|
|
|
||
|
|
export default defineConfig(
|
||
|
|
{ ignores: ['src/components/ui/'] },
|
||
|
|
eslintJs.configs.recommended,
|
||
|
|
nextVitals,
|
||
|
|
|
||
|
|
// Next.js bundles eslint-plugin-react; disable its rules that overlap with @eslint-react
|
||
|
|
eslintReact.configs['disable-conflict-eslint-plugin-react'],
|
||
|
|
|
||
|
|
{
|
||
|
|
files: ['**/*.{ts,tsx}'],
|
||
|
|
languageOptions: {
|
||
|
|
parser: tseslint.parser,
|
||
|
|
parserOptions: {
|
||
|
|
projectService: true,
|
||
|
|
tsconfigRootDir: import.meta.dirname,
|
||
|
|
},
|
||
|
|
},
|
||
|
|
extends: [
|
||
|
|
tseslint.configs.recommendedTypeChecked,
|
||
|
|
tseslint.configs.stylisticTypeChecked,
|
||
|
|
eslintReact.configs['recommended-type-checked'],
|
||
|
|
reactYouMightNotNeedAnEffect.configs.recommended,
|
||
|
|
],
|
||
|
|
rules: {
|
||
|
|
eqeqeq: ['error', 'smart'],
|
||
|
|
'no-console': ['warn', { allow: ['warn', 'error'] }],
|
||
|
|
'@typescript-eslint/consistent-type-imports': [
|
||
|
|
'error',
|
||
|
|
{ fixStyle: 'inline-type-imports' },
|
||
|
|
],
|
||
|
|
'@typescript-eslint/no-unused-vars': [
|
||
|
|
'error',
|
||
|
|
{
|
||
|
|
args: 'all',
|
||
|
|
argsIgnorePattern: '^_',
|
||
|
|
caughtErrors: 'all',
|
||
|
|
caughtErrorsIgnorePattern: '^_',
|
||
|
|
destructuredArrayIgnorePattern: '^_',
|
||
|
|
varsIgnorePattern: '^_',
|
||
|
|
ignoreRestSiblings: true,
|
||
|
|
},
|
||
|
|
],
|
||
|
|
'@typescript-eslint/switch-exhaustiveness-check': 'error',
|
||
|
|
'@typescript-eslint/strict-boolean-expressions': [
|
||
|
|
'error',
|
||
|
|
{
|
||
|
|
allowNullableBoolean: true,
|
||
|
|
allowNullableString: true,
|
||
|
|
},
|
||
|
|
],
|
||
|
|
'@typescript-eslint/no-unnecessary-condition': 'error',
|
||
|
|
'@typescript-eslint/no-misused-promises': [
|
||
|
|
'error',
|
||
|
|
{ checksVoidReturn: { attributes: false } },
|
||
|
|
],
|
||
|
|
'@eslint-react/jsx-shorthand-boolean': 'error',
|
||
|
|
'@eslint-react/no-array-index-key': 'warn',
|
||
|
|
|
||
|
|
// Redundant with react-you-might-not-need-an-effect
|
||
|
|
'@eslint-react/hooks-extra/no-direct-set-state-in-use-effect': 'off',
|
||
|
|
'@eslint-react/hooks-extra/no-direct-set-state-in-use-layout-effect':
|
||
|
|
'off',
|
||
|
|
},
|
||
|
|
},
|
||
|
|
|
||
|
|
prettier,
|
||
|
|
)
|