-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy patheslint.config.js
More file actions
93 lines (79 loc) · 1.82 KB
/
eslint.config.js
File metadata and controls
93 lines (79 loc) · 1.82 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
import eslintPlugin from 'eslint-plugin-eslint-plugin';
import simpleImportSort from 'eslint-plugin-simple-import-sort';
import globals from 'globals';
import tseslint from 'typescript-eslint';
import eslint from '@eslint/js';
export default tseslint.config(
eslint.configs.recommended,
...tseslint.configs.strictTypeChecked,
// eslint-disable-next-line -- It has no types.
eslintPlugin.configs['flat/recommended'],
{
plugins: {
'simple-import-sort': simpleImportSort,
},
},
{
languageOptions: {
globals: {
...globals.browser,
...globals.node,
},
parserOptions: {
project: true,
tsconfigRootDir: import.meta.dirname,
},
},
},
{
ignores: [
'**/coverage/**',
'**/dist/**',
'**/node_modules/**',
'**/__snapshots__/**',
],
},
{
rules: {
'no-console': 'error',
'@typescript-eslint/consistent-type-imports': [
'error',
{
fixStyle: 'inline-type-imports',
},
],
'simple-import-sort/imports': [
'error',
{
groups: getImportSortGroups(),
},
],
},
},
);
function getImportSortGroups() {
// Customized defaults from `eslint-plugin-simple-import-sort`:
// https://github.com/lydell/eslint-plugin-simple-import-sort/blob/66d84f742/src/imports.js#L5-L19
return [
// Side effect imports.
['^\\u0000'],
// Node.js builtins prefixed with `node:`.
['^node:'],
[
// Packages that don't start with @ ('fs', 'path', etc.)
'^\\w',
// Packages with path imports.
'^@?\\w+\\/\\w',
// Things that start with a letter (or digit or underscore), or `@` followed by a letter.
'^@?\\w',
],
// Absolute imports and other imports such as Vue-style `@/foo`.
// Anything not matched in another group.
['^'],
// Rules imports.
['\\/rules\\/'],
// Relative imports.
// Anything that starts with a dot.
['^\\.'],
];
}