-
Notifications
You must be signed in to change notification settings - Fork 30
/
eslint.config.js
55 lines (54 loc) · 1.66 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
// @ts-check
import eslint from "@eslint/js";
import vitest from "eslint-plugin-vitest";
import { dirname } from "path";
import tsEslint from "typescript-eslint";
import { fileURLToPath } from "url";
export default tsEslint.config(
{
ignores: ["**/dist/**/*", "**/.temp/**/*", "eslint.config.js"],
},
eslint.configs.recommended,
...tsEslint.configs.recommended,
{
languageOptions: {
parserOptions: {
projectService: {
allowDefaultProject: ["eng/*.mjs", "packages/*/cmd/cli.mjs"],
defaultProject: "./tsconfig.json",
},
tsconfigRootDir: dirname(fileURLToPath(import.meta.url)),
},
},
rules: {
"no-console": "warn",
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/no-unused-vars": [
"warn",
{ varsIgnorePattern: "^_", argsIgnorePattern: ".*", caughtErrorsIgnorePattern: ".*", ignoreRestSiblings: true },
],
"prefer-const": "warn",
"@typescript-eslint/no-floating-promises": "warn",
"eqeqeq": ["warn", "always", { null: "ignore" }],
"no-case-declarations": "off",
"no-undef": "off",
},
},
{
/**
* Test files specific rules
*/
files: ["**/*.test.ts"],
plugins: { vitest },
rules: {
"vitest/no-focused-tests": "warn",
"vitest/no-identical-title": "error",
"vitest/no-commented-out-tests": "warn",
"vitest/no-import-node-test": "warn",
"vitest/require-local-test-context-for-concurrent-snapshots": "warn",
"vitest/valid-describe-callback": "warn",
"vitest/valid-expect": "warn",
"@typescript-eslint/no-non-null-asserted-optional-chain": "off",
},
},
);