forked from serwist/serwist
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patheslint.config.js
102 lines (100 loc) · 3.43 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
import { fileURLToPath } from "node:url";
import path from "node:path";
import js from "@eslint/js";
import ts from "typescript-eslint";
import svelte from "eslint-plugin-svelte";
import prettier from "eslint-config-prettier";
import sort from "eslint-plugin-simple-import-sort";
import turbo from "eslint-plugin-turbo";
import globals from "globals";
const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
/** @type {import('eslint').Linter.Config[]} */
export default [
js.configs.recommended,
.../** @type {import('eslint').Linter.Config[]} */ (ts.configs.recommended),
...svelte.configs["flat/recommended"],
prettier,
...svelte.configs["flat/prettier"],
{
ignores: ["**/*.*", "!**/*.svelte", "!**/*.md", "**/build/", "**/.svelte-kit/", "**/dist/"],
},
{
languageOptions: {
parserOptions: {
tsconfigRootDir: __dirname,
project: "tsconfig.eslint.json",
ecmaVersion: "latest",
sourceType: "module",
warnOnUnsupportedTypeScriptVersion: false,
extraFileExtensions: [".svelte"],
},
},
},
{
plugins: {
turbo: {
rules: turbo.rules,
},
"simple-import-sort": sort,
},
rules: {
"constructor-super": "off", // ts(2335) & ts(2377)
"getter-return": "off", // ts(2378)
"no-const-assign": "off", // ts(2588)
"no-dupe-args": "off", // ts(2300)
"no-dupe-class-members": "off", // ts(2393) & ts(2300)
"no-dupe-keys": "off", // ts(1117)
"no-func-assign": "off", // ts(2630)
"no-import-assign": "off", // ts(2632) & ts(2540)
"no-new-native-nonconstructor": "off", // ts(7009)
"no-obj-calls": "off", // ts(2349)
"no-redeclare": "off", // ts(2451)
"no-setter-return": "off", // ts(2408)
"no-this-before-super": "off", // ts(2376) & ts(17009)
"no-undef": "off", // ts(2304) & ts(2552)
"no-unreachable": "off", // ts(7027)
"no-unsafe-negation": "off", // ts(2365) & ts(2322) & ts(2358)
"no-var": "error", // ts transpiles let/const to var, so no need for vars any more
"no-fallthrough": "off",
"no-unused-vars": "off",
"no-extra-boolean-cast": "off",
"prefer-const": "off",
"prefer-rest-params": "error", // ts provides better types with rest args over arguments
"prefer-spread": "error", // ts transpiles spread to apply, so no need for manual apply
"@typescript-eslint/ban-ts-comment": "error",
"@typescript-eslint/no-unused-expressions": "off", // svelte's `$effect` sometimes needs dangling expressions to track variables
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/no-var-requires": "off",
"@typescript-eslint/consistent-type-imports": "warn",
"@typescript-eslint/no-empty-object-type": "off",
"@typescript-eslint/no-unused-vars": [
"warn",
{
ignoreRestSiblings: true,
varsIgnorePattern: "^_",
argsIgnorePattern: "^_",
},
],
// Doesn't play nice with using stores...
"svelte/valid-compile": "off",
"simple-import-sort/imports": "warn",
"simple-import-sort/exports": "warn",
"turbo/no-undeclared-env-vars": "off",
},
languageOptions: {
globals: {
...globals.browser,
...globals.node,
},
},
},
{
files: ["**/*.svelte"],
languageOptions: {
parserOptions: {
parser: ts.parser,
},
},
},
];