-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patheslint.config.mjs
90 lines (85 loc) · 1.76 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
import eslint from '@eslint/js'
import json from '@eslint/json'
import markdown from '@eslint/markdown'
import css from '@eslint/css'
import pluginImportX from 'eslint-plugin-import-x'
import globals from 'globals'
import simpleImportSort from 'eslint-plugin-simple-import-sort'
export default [
{
ignores: [
'*.config.*',
'**/dist/**',
],
},
// for JSON
{
plugins: {
json,
},
},
// lint JSON files
{
files: ['**/*.json'],
ignores: ['package-lock.json'],
language: 'json/json',
...json.configs.recommended,
},
// lint JSONC files
{
files: ['**/*.jsonc'],
language: 'json/jsonc',
...json.configs.recommended,
},
// lint JSON5 files
{
files: ['**/*.json5'],
language: 'json/json5',
...json.configs.recommended,
},
// for markdown
{
files: ['**/*.md'],
plugins: {
markdown
},
language: 'markdown/gfm',
rules: {
'markdown/no-duplicate-headings': 'error',
'markdown/heading-increment': 'error',
},
},
// for CSS
{
files: ['**/*.css'],
plugins: {
css,
},
language: 'css/css',
rules: {
'css/no-empty-blocks': 'error',
'css/no-invalid-properties': 'error',
},
},
{
files: ['**/*.mjs', '**/*.cjs', '**/*.js', '**/*.jsx', '**/*.mts', '**/*.ts', '**/*.tsx'],
...eslint.configs.recommended,
languageOptions: {
globals: {
...globals.node,
...globals.es2021,
}
},
plugins: {
'import-x': pluginImportX,
'simple-import-sort': simpleImportSort,
},
rules: {
'no-magic-numbers': 'off',
'no-duplicate-imports': 'off',
'import-x/no-duplicates': 'error',
'simple-import-sort/imports': 'error',
'simple-import-sort/exports': 'error',
},
},
]