-
Notifications
You must be signed in to change notification settings - Fork 18
Expand file tree
/
Copy patheslint.config.mjs
More file actions
99 lines (98 loc) · 3.2 KB
/
eslint.config.mjs
File metadata and controls
99 lines (98 loc) · 3.2 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
import js from "@eslint/js";
import ts from "@typescript-eslint/eslint-plugin";
import parser from "@typescript-eslint/parser";
import playwright from "eslint-plugin-playwright";
import prettier from "eslint-plugin-prettier/recommended";
import globals from "globals";
export default [
{
files: ["*.js", "*.mjs"],
rules: {
...js.configs.recommended.rules,
eqeqeq: ["error", "smart"],
"no-unused-vars": "warn",
// ignore line endings between Windows and Unix
"prettier/prettier": ["error", { endOfLine: "auto" }],
},
languageOptions: {
globals: {
...globals.builtin,
...globals.node,
},
},
},
{
files: ["src/**/*.ts", "src/**/*.mts"],
ignores: ["src/clients/**"],
plugins: { "@typescript-eslint": ts },
rules: {
...js.configs.recommended.rules,
...ts.configs.recommended.rules,
eqeqeq: ["error", "smart"],
// TypeScript covers undefined things instead
"no-undef": "off",
"no-unused-vars": "off",
"no-redeclare": "off",
// "require-await": "warn",
"@typescript-eslint/no-unused-vars": "error",
// Some untyped things may require extra effort to be fixed
"@typescript-eslint/no-explicit-any": "off",
// replacement of ESLint's no-redeclare with support for function overload
"@typescript-eslint/no-redeclare": "error",
// require awaiting or .then() chaining for promises
"@typescript-eslint/no-floating-promises": "warn",
// suggest type imports where possible
"@typescript-eslint/consistent-type-imports": "warn",
// ignore line endings between Windows and Unix
"prettier/prettier": ["error", { endOfLine: "auto" }],
},
languageOptions: {
parser,
globals: {
...globals.builtin,
...globals.browser,
...globals.node,
},
parserOptions: {
projectService: true,
tsconfigRootDir: import.meta.dirname,
},
},
},
{
files: ["src/**/*.test.ts"],
languageOptions: { globals: { ...globals.mocha } },
},
{
files: ["tests/**/*.spec.ts", "tests/**/*.ts", "src/webviews/**/*.ts"],
...playwright.configs["flat/recommended"],
plugins: { playwright, "@typescript-eslint": ts },
languageOptions: {
parser,
globals: {
...globals.builtin,
...globals.browser,
...globals.node,
},
},
rules: {
"playwright/missing-playwright-await": "error",
"playwright/prefer-web-first-assertions": "error",
"playwright/no-commented-out-tests": "error",
"playwright/no-unsafe-references": "error",
"playwright/no-wait-for-timeout": "error",
"playwright/valid-describe-callback": "error",
"playwright/no-conditional-expect": "error",
"playwright/no-page-pause": "error",
"playwright/expect-expect": "error",
"playwright/no-standalone-expect": "error",
"playwright/no-conditional-in-test": "error",
"playwright/no-wait-for-selector": "error",
"playwright/no-force-option": "error",
"playwright/no-useless-await": "error",
// suggest type imports where possible
"@typescript-eslint/consistent-type-imports": "warn",
},
},
prettier,
];