-
Notifications
You must be signed in to change notification settings - Fork 0
/
eslint.config.js
107 lines (101 loc) · 2.3 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
/**
* @file The eslint config.
*/
/* eslint-disable @typescript-eslint/naming-convention */
import {ConfigGenerator, mergeGlobals} from "@logicer/eslint-plugin";
import globals from "globals";
const generator = new ConfigGenerator({
javascript: true,
jsdoc: true,
prettier: true,
svelte: true,
typescript: true
});
/**
* @type {import("eslint").Linter.FlatConfigFileSpec[]}
*/
const ignores = [
"node_modules/**/*",
"build/**/*",
".svelte-kit/**/*",
"package/**/*",
".type-coverage/**/*",
"**/.DS_Store",
"**/.env",
"**/.env.*",
"**/!.env.example",
"**/svelte.config.js",
"**/.eslintrc.cjs",
"**/pnpm-lock.yaml",
"**/package-lock.json",
"**/yarn.lock",
"**/vite.config.js.timestamp-*",
"**/vite.config.ts.timestamp-*",
"**/.eslint_report.json",
"**/*.tsbuildinfo",
"**/.eslintcache"
];
/**
* @type {import("eslint").Linter.FlatConfig[]}
*/
const svelteConfigs = [
{
languageOptions: {
globals: mergeGlobals(globals.browser, globals.es2017, globals.node),
parserOptions: {
ecmaVersion: 2020,
extraFileExtensions: [".svelte"],
project: ["./tsconfig.json", "./tsconfig.*.json"],
sourceType: "module"
}
}
},
{
files: ["src/**/*"],
rules: {
"import/no-unresolved": [
"error",
{
// Regex
ignore: [
"\\$app/environment",
"\\$app/forms",
"\\$app/navigation",
"\\$app/paths",
"\\$app/stores",
"\\$env/dynamic/private",
"\\$env/dynamic/public",
"\\$env/static/private",
"\\$env/static/public",
"\\$service-worker"
]
}
],
"n/no-missing-import": "off",
"n/prefer-global/process": ["error", "always"]
}
}
];
/**
* @type {import("eslint").Linter.FlatConfig[]}
*/
const config = [
{ignores},
{
settings: {
"import/parsers": {
// Temporary until https://github.com/import-js/eslint-plugin-import/pull/2829
espree: [".js", ".jsx", ".cjs", ".mjs"]
},
"import/resolver": {
typescript: {
project: ["tsconfig.json", "tsconfig.eslint.json"]
}
}
}
},
...(await generator.config),
...svelteConfigs,
...(await generator.endConfig)
];
export default config;