-
Notifications
You must be signed in to change notification settings - Fork 2
/
eslint.config.mjs
121 lines (119 loc) · 3.99 KB
/
eslint.config.mjs
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
110
111
112
113
114
115
116
117
118
119
120
121
import pluginJs from '@eslint/js';
import nextPlugin from '@next/eslint-plugin-next';
import eslintConfigPrettier from 'eslint-config-prettier';
import importPlugin from 'eslint-plugin-import';
import pluginPromise from 'eslint-plugin-promise';
import pluginReact from 'eslint-plugin-react';
import simpleImportSort from 'eslint-plugin-simple-import-sort';
import globals from 'globals';
import tseslint from 'typescript-eslint';
import tailwind from 'eslint-plugin-tailwindcss';
export default [
{
files: ['**/*.{js,mjs,cjs,ts,jsx,tsx}']
},
{
languageOptions: {
ecmaVersion: 'latest',
globals: { ...globals.browser, ...globals.node },
parser: '@typescript-eslint/parser',
parserOptions: {
project: './tsconfig.json',
tsconfigRootDir: process.cwd(),
sourceType: 'module'
}
}
},
{
settings: {
react: {
version: 'detect'
},
tailwindcss: {
callees: ['cn'],
config: 'tailwind.config.ts'
}
}
},
pluginJs.configs.recommended,
importPlugin.flatConfigs.recommended,
...tseslint.configs.recommended,
pluginPromise.configs['flat/recommended'],
pluginReact.configs.flat.recommended,
pluginReact.configs.flat['jsx-runtime'],
eslintConfigPrettier,
...tailwind.configs['flat/recommended'],
{
plugins: {
'simple-import-sort': simpleImportSort
},
rules: {
'tailwindcss/no-contradicting-classname': 'off',
'react/react-in-jsx-scope': 'off',
'react-hooks/exhaustive-deps': 'off',
'react/prop-types': 'off',
'newline-before-return': 'error',
'@typescript-eslint/no-unused-vars': [
'warn',
{
argsIgnorePattern: '^_'
}
],
'@typescript-eslint/no-unused-expressions': 'off',
'tailwindcss/no-custom-classname': 'off',
'tailwindcss/migration-from-tailwind-2': 'off',
'import/no-unresolved': 'off',
'import/no-named-as-default': 'off',
'@typescript-eslint/no-unsafe-assignment': 'off',
'@typescript-eslint/no-unsafe-member-access': 'off',
'@typescript-eslint/unbound-method': 'off',
'sort-imports': 'off',
'simple-import-sort/imports': [
'error',
{
groups: [
['^react', '^@?\\w'],
['^(@|components|utils|hooks|contexts)(/.*|$)'],
['^\\u0000'],
['^\\.\\.(?!/?$)', '^\\.\\./?$'],
['^\\./(?=.*/)(?!/?$)', '^\\.(?!/?$)', '^\\./?$'],
['^.+\\.?(css|scss)$']
]
}
],
'simple-import-sort/exports': 'error',
'import/first': 'error',
'import/newline-after-import': 'error',
'import/no-duplicates': 'error',
'@typescript-eslint/consistent-type-imports': [
'warn',
{
prefer: 'type-imports',
fixStyle: 'inline-type-imports'
}
],
'@typescript-eslint/require-await': 'off',
'@typescript-eslint/no-misused-promises': [
'error',
{
checksVoidReturn: {
attributes: false
}
}
]
}
},
{
plugins: {
'@next/next': nextPlugin
},
rules: {
...nextPlugin.configs.recommended.rules,
...nextPlugin.configs['core-web-vitals'].rules,
'@next/next/no-img-element': 'off'
}
},
{
ignores: ['dist/*', '.cache', 'public', 'node_modules', '*.esm.js', '.next/*']
}
];