-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patheslint.config.mjs
More file actions
109 lines (104 loc) ยท 3.95 KB
/
Copy patheslint.config.mjs
File metadata and controls
109 lines (104 loc) ยท 3.95 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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
import { dirname } from 'path'
import { fileURLToPath } from 'url'
import { FlatCompat } from '@eslint/eslintrc'
import js from '@eslint/js'
import globals from 'globals'
import typescriptParser from '@typescript-eslint/parser'
import importPlugin from 'eslint-plugin-import'
import reactHooks from 'eslint-plugin-react-hooks'
import react from 'eslint-plugin-react'
import reactCompiler from 'eslint-plugin-react-compiler'
import jsxA11y from 'eslint-plugin-jsx-a11y'
import prettier from 'eslint-plugin-prettier'
import typescriptEslint from 'typescript-eslint'
import eslintConfigPrettier from 'eslint-config-prettier'
import tailwindcss from 'eslint-plugin-tailwindcss'
const __filename = fileURLToPath(import.meta.url)
const __dirname = dirname(__filename)
const compat = new FlatCompat({
baseDirectory: __dirname,
})
const eslintConfig = [
...compat.extends('next/core-web-vitals', 'next/typescript'),
...typescriptEslint.config({
ignores: ['.next'],
extends: [js.configs.recommended, ...typescriptEslint.configs.recommended],
files: ['**/*.{ts,tsx}'],
languageOptions: {
ecmaVersion: 2020,
globals: globals.browser,
parser: typescriptParser,
parserOptions: {
sourceType: 'module',
project: ['./tsconfig.json'],
tsconfigRootDir: __dirname,
},
},
plugins: {
react,
'react-compiler': reactCompiler,
'react-hooks': reactHooks,
'jsx-a11y': jsxA11y,
import: importPlugin,
prettier,
},
rules: {
'import/order': [
'warn',
{
groups: [
'builtin',
'external',
'type',
'internal',
'parent',
'sibling',
'index',
'unknown',
],
pathGroups: [
{ pattern: '@/mocks/**/*', group: 'internal', position: 'after' },
{ pattern: '@/app/**/*', group: 'internal', position: 'after' },
{ pattern: '@/views/**/*', group: 'internal', position: 'after' },
{ pattern: '@/widgets/**/*', group: 'internal', position: 'after' },
{ pattern: '@/entities/**/*', group: 'internal', position: 'after' },
{ pattern: '@/shared/**/*', group: 'internal', position: 'after' },
{ pattern: '../../api', group: 'parent', position: 'after' },
{ pattern: '../../config', group: 'parent', position: 'after' },
{ pattern: '../../lib', group: 'parent', position: 'after' },
{ pattern: '../../model', group: 'parent', position: 'after' },
{ pattern: '../../ui', group: 'parent', position: 'after' },
{ pattern: '../api', group: 'parent', position: 'after' },
{ pattern: '../config', group: 'parent', position: 'after' },
{ pattern: '../lib', group: 'parent', position: 'after' },
{ pattern: '../model', group: 'parent', position: 'after' },
{ pattern: '../ui', group: 'parent', position: 'after' },
],
alphabetize: { order: 'asc' },
},
],
'import/no-unresolved': 'off',
'@typescript-eslint/consistent-type-exports': 'error',
'@typescript-eslint/consistent-type-imports': 'error',
...react.configs.recommended.rules,
...react.configs['jsx-runtime'].rules,
'react-compiler/react-compiler': 'error',
'react/jsx-props-no-spreading': 'off',
'react/require-default-props': 'off',
'react/prop-types': 'off',
'react/display-name': 'off',
'react/no-unknown-property': ['error', { ignore: ['css'] }],
'react/self-closing-comp': 'warn',
...reactHooks.configs.recommended.rules,
...jsxA11y.configs.recommended.rules,
'jsx-a11y/label-has-associated-control': ['error', { some: ['nesting', 'id'] }],
'prettier/prettier': 'warn',
},
settings: {
react: { version: 'detect' },
},
}),
...tailwindcss.configs['flat/recommended'],
eslintConfigPrettier,
]
export default eslintConfig