-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patheslint.config.mjs
85 lines (84 loc) · 2.35 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
import { fixupConfigRules } from '@eslint/compat'
import pluginNext from '@next/eslint-plugin-next'
import stylistic from '@stylistic/eslint-plugin'
import pluginTs from '@typescript-eslint/eslint-plugin'
import parserTs from '@typescript-eslint/parser'
import pluginReact from 'eslint-plugin-react'
import pluginReactHooks from 'eslint-plugin-react-hooks'
import pluginImportSort from 'eslint-plugin-simple-import-sort'
import pluginTailwind from 'eslint-plugin-tailwindcss'
export default fixupConfigRules([
// ignores
{
ignores: ['node_modules', '.next', '.content-collections'],
},
// stylistic
stylistic.configs.customize({
indent: 2,
quotes: 'single',
semi: false,
jsx: true,
braceStyle: '1tbs',
}),
// react, next
{
files: ['**/*.{ts,tsx}'],
languageOptions: {
parser: parserTs,
parserOptions: {
ecmaVersion: 'latest',
ecmaFeatures: { jsx: true },
sourceType: 'module',
},
},
plugins: {
'@typescript-eslint': pluginTs,
'react': pluginReact,
'react-hooks': pluginReactHooks,
'@next/next': pluginNext,
},
rules: {
...pluginTs.configs['eslint-recommended'].overrides[0].rules,
...pluginTs.configs['recommended'].rules,
...pluginReact.configs['jsx-runtime'].rules,
...pluginReactHooks.configs['recommended'].rules,
...pluginNext.configs['recommended'].rules,
...pluginNext.configs['core-web-vitals'].rules,
'@typescript-eslint/no-unused-vars': 'warn',
'@typescript-eslint/no-empty-object-type': 'warn',
'@typescript-eslint/no-unused-expressions': 'warn',
'@typescript-eslint/no-require-imports': 'warn',
},
},
// tailwindcss
...pluginTailwind.configs['flat/recommended'],
{
settings: {
tailwindcss: {
callees: ['cn', 'cva'],
config: 'tailwind.config.ts',
},
},
},
// sort imports, exports
{
plugins: {
'import-sort': pluginImportSort,
},
rules: {
'import-sort/exports': 'error',
'import-sort/imports': [
'error',
{
groups: [
['^\\u0000'],
['^react', '^next', '@?\\w'],
['^./.*', '^~/.*', '^#/.*', '^@/.*'],
['^\\.\\.(?!/?$)', '^\\.\\./?$'],
['^\\./(?=.*/)(?!/?$)', '^\\.(?!/?$)', '^\\./?$'],
],
},
],
},
},
])