-
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy patheslint.config.js
More file actions
120 lines (117 loc) · 3.1 KB
/
eslint.config.js
File metadata and controls
120 lines (117 loc) · 3.1 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
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
120
import js from "@eslint/js";
import globals from "globals";
import ts from "typescript-eslint";
import { fileURLToPath } from "node:url";
import svelte from "eslint-plugin-svelte";
import prettier from "eslint-config-prettier";
import { includeIgnoreFile } from "@eslint/compat";
import perfectionist from "eslint-plugin-perfectionist";
import unusedImports from "eslint-plugin-unused-imports";
import tanstackQuery from "@tanstack/eslint-plugin-query";
import svelteConfig from "./svelte.config.js";
const gitignorePath = fileURLToPath(new URL("./.gitignore", import.meta.url));
const overlayGitignorePath = fileURLToPath(
new URL("./overlay/.gitignore", import.meta.url),
);
const scriptingGitignorePath = fileURLToPath(
new URL("./scripting/.gitignore", import.meta.url),
);
export default ts.config(
// Ignored files
includeIgnoreFile(gitignorePath),
includeIgnoreFile(overlayGitignorePath),
includeIgnoreFile(scriptingGitignorePath),
{ ignores: ["src-tauri/src/script/**/*", "script/**/*"] },
// JS
js.configs.recommended,
// TS
...ts.configs.recommended,
// Svelte
...svelte.configs.recommended,
// Prettier
prettier,
...svelte.configs.prettier,
// Tanstack
tanstackQuery.configs["flat/recommended"],
// Globals and undef
{
languageOptions: {
globals: { ...globals.browser, ...globals.node },
},
rules: {
// typescript-eslint strongly recommend that you do not use the no-undef lint rule on TypeScript projects.
// see: https://typescript-eslint.io/troubleshooting/faqs/eslint/#i-get-errors-from-the-no-undef-rule-about-global-variables-not-being-defined-even-though-there-are-no-typescript-errors
"no-undef": "off",
},
},
// Svelte files
{
files: ["**/*.svelte", "**/*.svelte.ts", "**/*.svelte.js"],
languageOptions: {
parserOptions: {
// projectService: true,
extraFileExtensions: [".svelte"],
parser: ts.parser,
svelteConfig,
},
},
},
// Unused imports
{
plugins: {
"unused-imports": unusedImports,
},
rules: {
"no-unused-vars": "off",
"@typescript-eslint/no-unused-vars": "off",
"unused-imports/no-unused-imports": "warn",
"unused-imports/no-unused-vars": [
"warn",
{
vars: "all",
varsIgnorePattern: "^_",
args: "after-used",
argsIgnorePattern: "^_",
},
],
},
},
// Perfectionist
{
plugins: {
perfectionist,
},
rules: {
"perfectionist/sort-named-imports": [
"warn",
{
order: "asc",
type: "line-length",
},
],
"perfectionist/sort-named-exports": [
"warn",
{
order: "asc",
type: "line-length",
},
],
"perfectionist/sort-exports": [
"warn",
{
order: "asc",
type: "line-length",
},
],
"perfectionist/sort-imports": [
"warn",
{
order: "asc",
type: "line-length",
newlinesBetween: "always",
internalPattern: ["^~/.*"],
},
],
},
},
);