-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy patheslint.config.js
85 lines (83 loc) · 2.08 KB
/
eslint.config.js
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
/* eslint-disable perfectionist/sort-objects */
import { FlatCompat } from '@eslint/eslintrc'
import eslintParserAstro from 'astro-eslint-parser'
import { defineFlatConfig } from 'eslint-define-config'
import eslintPluginAstro from 'eslint-plugin-astro'
import eslintPluginPerfectionist from 'eslint-plugin-perfectionist'
import eslintPluginTypeScript from 'typescript-eslint'
const compat = new FlatCompat({
baseDirectory: import.meta.dirname
})
export default defineFlatConfig([
{
ignores: ['dist/', '.astro/', 'src/env.d.ts']
},
...compat.extends('eslint-config-standard'),
{
plugins: {
perfectionist: eslintPluginPerfectionist
},
rules: {
...eslintPluginPerfectionist.configs['recommended-alphabetical'].rules,
'perfectionist/sort-imports': [
'error',
{
type: 'alphabetical',
order: 'asc',
groups: [
'side-effect',
'type',
['builtin', 'external'],
'internal-type',
'internal',
['parent-type', 'sibling-type', 'index-type'],
['parent', 'sibling', 'index'],
'object',
'unknown'
],
newlinesBetween: 'always',
internalPattern: ['@/.*']
}
]
}
},
{
files: ['**/*.ts', '**/*.astro'],
languageOptions: {
parser: eslintPluginTypeScript.parser,
parserOptions: {
project: true
}
},
plugins: {
'@typescript-eslint': eslintPluginTypeScript.plugin
},
rules: {
...eslintPluginTypeScript.configs.recommended.rules,
'no-unused-vars': 'off'
}
},
{
files: ['**/*.astro'],
languageOptions: {
parser: eslintParserAstro,
parserOptions: {
parser: eslintPluginTypeScript.parser,
project: true
}
},
plugins: {
astro: eslintPluginAstro
},
rules: {
...eslintPluginAstro.configs['flat/recommended'].rules,
'astro/sort-attributes': [
'error',
{
order: 'asc',
type: 'alphabetical'
}
]
}
}
])