-
Notifications
You must be signed in to change notification settings - Fork 7
/
eslint.config.js
98 lines (97 loc) · 2.62 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
import "eslint-plugin-only-warn";
// @ts-ignore
import js from "@eslint/js";
import ts from "typescript-eslint";
import react from "eslint-plugin-react";
// @ts-ignore
import prettier from "eslint-config-prettier";
import svelte from "eslint-plugin-svelte";
import globals from "globals";
import svelteParser from "svelte-eslint-parser";
export default ts.config(
js.configs.recommended,
...ts.configs.recommendedTypeChecked,
// @ts-ignore
...svelte.configs["flat/recommended"],
prettier,
...svelte.configs["flat/prettier"],
// react.configs.flat.recommended,
{
files: ["**/*.{jsx,tsx}"],
plugins: { react },
languageOptions: {
parserOptions: { ecmaFeatures: { jsx: true } },
globals: { ...globals.browser },
},
},
{
languageOptions: {
ecmaVersion: 2022,
sourceType: "module",
globals: {
...globals.node,
...globals.browser,
sveltify: true,
hooks: true,
react: true,
},
parser: svelteParser,
parserOptions: {
parser: ts.parser,
extraFileExtensions: [".svelte"],
project: `tsconfig.eslint.json`,
ecmaFeatures: {},
},
},
},
{
rules: {
"@typescript-eslint/ban-ts-comment": "off",
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/no-unsafe-assignment": "off",
"@typescript-eslint/no-unsafe-member-access": "off",
"@typescript-eslint/no-unused-vars": [
"warn",
{ ignoreRestSiblings: true, argsIgnorePattern: "^_+$" },
],
curly: "warn",
eqeqeq: "warn",
"no-console": ["warn", { allow: ["info", "warn", "error"] }],
"no-useless-rename": "warn",
"object-shorthand": "warn",
"prefer-template": "warn",
"svelte/block-lang": ["warn", { script: "ts" }],
"svelte/no-at-html-tags": "off",
"@typescript-eslint/no-unsafe-call": 0,
"@typescript-eslint/no-unsafe-return": 0,
"@typescript-eslint/no-unsafe-argument": 0,
},
},
{
files: ["src/routes/**/*.ts", "src/routes/**/*.svelte"],
rules: {
// ESLint is not aware of the generated ./$types and reports false positives
"@typescript-eslint/no-unsafe-argument": 0,
"@typescript-eslint/no-unsafe-call": 0,
},
},
{
files: ["**/*.cjs"],
rules: {
// Allow require() in CommonJS modules.
"@typescript-eslint/no-require-imports": "off",
},
},
{
ignores: [
".svelte-kit",
".vercel",
"build",
"node_modules",
"package",
"vite.config.ts.timestamp-*.mjs",
"src/global.d.ts",
"src/tests/reactify.spec.tsx",
],
},
);