-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy patheslint.config.mjs
More file actions
82 lines (78 loc) · 2.21 KB
/
eslint.config.mjs
File metadata and controls
82 lines (78 loc) · 2.21 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
import { FlatCompat } from '@eslint/eslintrc'
import { fileURLToPath } from 'url'
import { dirname } from 'path'
import typescriptParser from '@typescript-eslint/parser'
import typescriptPlugin from '@typescript-eslint/eslint-plugin'
import prettierPlugin from 'eslint-plugin-prettier'
import jsxA11yPlugin from 'eslint-plugin-jsx-a11y'
import reactPlugin from 'eslint-plugin-react'
const __filename = fileURLToPath(import.meta.url)
const __dirname = dirname(__filename)
const compat = new FlatCompat({
baseDirectory: __dirname,
})
const eslintConfig = [
{ ignores: ['**/.next/*'] },
...compat.extends(
'next/core-web-vitals',
'next/typescript',
'plugin:import/errors',
'plugin:import/warnings',
'plugin:@typescript-eslint/recommended',
'plugin:react/recommended',
'plugin:jsx-a11y/recommended',
'prettier',
),
{
files: ['**/*.{js,jsx,ts,tsx}'],
languageOptions: {
parser: typescriptParser,
parserOptions: {
project: './tsconfig.json',
ecmaVersion: 2022,
sourceType: 'module',
ecmaFeatures: {
jsx: true,
},
tsconfigRootDir: __dirname,
},
},
plugins: {
'@typescript-eslint': typescriptPlugin,
prettier: prettierPlugin,
'jsx-a11y': jsxA11yPlugin,
react: reactPlugin,
},
rules: {
// Disable base rule to avoid conflict
'no-unused-vars': 'off',
'@typescript-eslint/no-unused-vars': [
'error',
{
vars: 'all',
args: 'after-used',
ignoreRestSiblings: true,
argsIgnorePattern: '^_', // Allow arguments prefixed with `_` to be unused
varsIgnorePattern: '^_', // Allow variables prefixed with `_` to be unused
},
],
semi: ['error', 'never'],
quotes: ['error', 'single'],
'react/prop-types': 'off',
'jsx-quotes': ['error', 'prefer-single'],
'arrow-parens': ['error', 'as-needed'],
'prettier/prettier': 'error',
'no-duplicate-imports': 'off',
'import/no-duplicates': 'error',
'react/react-in-jsx-scope': 'off',
'import/named': 'off',
},
},
{
files: ['**/*.json'],
rules: {
quotes: 'off',
},
},
]
export default eslintConfig