-
Notifications
You must be signed in to change notification settings - Fork 8
/
eslint.config.js
71 lines (70 loc) · 2.03 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
// @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: [
"**/*.d.ts",
"**/dist/**/*",
"**/.temp/**/*",
"eslint.config.js",
"packages/*/vitest.config.ts",
"packages/*/babel.config.cjs",
"packages/babel-plugin-jsx-dom-expressions/**/*",
"packages/babel-plugin-alloy/**/*",
"packages/babel-preset-alloy/**/*",
"packages/docs/**/*",
"samples/**/*", // for some reason eslint is unhappy with some files in here
],
},
eslint.configs.recommended,
...tsEslint.configs.recommended,
{
languageOptions: {
parserOptions: {
projectService: {
allowDefaultProject: [],
defaultProject: "./tsconfig.json",
},
tsconfigRootDir: dirname(fileURLToPath(import.meta.url)),
},
},
rules: {
"no-console": "warn",
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/no-empty-object-type": "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" }],
},
},
{
/**
* 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",
},
},
);