-
Notifications
You must be signed in to change notification settings - Fork 0
/
eslint.config.js
119 lines (114 loc) · 2.73 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
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
import configJs from "@eslint/js";
import pluginTypescript from "@typescript-eslint/eslint-plugin";
import parserTypescript from "@typescript-eslint/parser";
import configPrettier from "eslint-config-prettier";
import pluginImport from "eslint-plugin-import";
import pluginPromise from "eslint-plugin-promise";
import pluginSvelte from "eslint-plugin-svelte";
import globals from "globals";
import parserSvelte from "svelte-eslint-parser";
/** @type {FlatConfig} */
const baseConfig = {
plugins: {
import: pluginImport,
promise: pluginPromise,
},
languageOptions: {
ecmaVersion: "latest",
sourceType: "module",
globals: {
...globals.builtin,
...globals.browser,
...globals.node,
},
},
rules: {
...configJs.configs.recommended.rules,
...pluginPromise.configs.recommended.rules,
...configPrettier.rules,
eqeqeq: "warn",
"guard-for-in": "warn",
"no-console": "warn",
"prefer-arrow-callback": "warn",
"import/order": [
"warn",
{
alphabetize: {
order: "asc",
},
},
],
"import/no-duplicates": "warn",
"promise/always-return": [
"warn",
{
ignoreLastCallback: true,
},
],
},
};
/** @type {FlatConfig[]} */
const config = [
{
...baseConfig,
files: ["**/*.js"],
},
{
...baseConfig,
files: ["**/*.ts"],
plugins: {
...baseConfig.plugins,
"@typescript-eslint": pluginTypescript,
},
languageOptions: {
...baseConfig.languageOptions,
parser: parserTypescript,
parserOptions: {
project: "./tsconfig.json",
},
},
settings: {
...pluginImport.configs.typescript.settings,
"import/resolver": {
typescript: true,
node: true,
},
},
rules: {
...baseConfig.rules,
...pluginTypescript.configs["eslint-recommended"].rules,
...pluginTypescript.configs.recommended.rules,
...pluginTypescript.configs["recommended-requiring-type-checking"].rules,
...pluginImport.configs.typescript.rules,
...configPrettier.rules,
"@typescript-eslint/consistent-type-imports": "warn",
},
},
{
...baseConfig,
files: ["**/*.d.ts"],
},
{
...baseConfig,
files: ["**/*.svelte"],
plugins: {
...baseConfig.plugins,
svelte: pluginSvelte,
},
languageOptions: {
...baseConfig.languageOptions,
parser: parserSvelte,
},
rules: {
...baseConfig.rules,
...pluginSvelte.configs.base.overrides[0].rules,
...pluginSvelte.configs.recommended.rules,
...pluginSvelte.configs.prettier.rules,
...configPrettier.rules,
},
},
{
ignores: ["dist/**", "src-tauri/target/**"],
},
];
export default config;