-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.eslintrc.json
95 lines (91 loc) · 3.21 KB
/
.eslintrc.json
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
{
"env": { "browser": true, "node": true },
"extends": [
"airbnb-base",
"plugin:@typescript-eslint/recommended",
"plugin:vitest/recommended",
"plugin:testing-library/dom",
"prettier"
],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaVersion": "latest",
"sourceType": "module",
"project": "tsconfig.json"
},
"settings": {
"import/resolver": {
"node": {
"extensions": [".js", ".ts", ".d.ts"]
}
}
},
"rules": {
// Core Configurations
"lines-between-class-members": "off",
"consistent-return": "off", // This is usually annoying, and TS works fine as long as return types are specified.
"arrow-body-style": "off", // Done because of formatting. Use discretion on which type of function to use.
"no-unreachable": "error",
"no-plusplus": ["error", { "allowForLoopAfterthoughts": true }],
"no-return-assign": ["error", "except-parens"],
"no-continue": "off", // Useful for keeping conditional logic in `for` loops simpler (similar to early `return`)
// TypeScript Configurations
"@typescript-eslint/no-explicit-any": "error",
"@typescript-eslint/consistent-type-imports": "error",
"@typescript-eslint/no-unnecessary-condition": "error",
"@typescript-eslint/strict-boolean-expressions": "off",
// Core Configurations That Conflict with TS
"no-undef": "off",
"no-use-before-define": "off",
"@typescript-eslint/no-use-before-define": ["error", "nofunc"],
"no-shadow": "off",
"@typescript-eslint/no-shadow": "error",
"default-param-last": "off",
"@typescript-eslint/default-param-last": "error",
"no-unused-vars": "off",
"@typescript-eslint/no-unused-vars": ["error", { "argsIgnorePattern": "^_" }],
// Import
"import/extensions": "off", // TypeScript drives which extensions are required (due to `moduleResolution: NodeNext`)
"import/no-unresolved": "off", // Let TypeScript handle import resolution
"import/no-extraneous-dependencies": [
"error",
{
"packageDir": [
"./",
"packages/core",
"packages/svelte",
"packages/vue",
"packages/solid",
"packages/react",
"packages/lit",
"packages/preact"
],
"peerDependencies": true,
"devDependencies": ["./vitest.*", "**/*.test.{ts,tsx}"],
"optionalDependencies": false,
"bundledDependencies": false
}
],
// Vitest
// NOTE: `eslint-plugin-vitest` still has some areas for improvement. So keep an eye out for updates.
"vitest/no-alias-methods": "error",
"vitest/no-disabled-tests": "error",
"vitest/no-focused-tests": "error",
"vitest/no-interpolation-in-snapshots": "error",
"vitest/no-mocks-import": "error",
"vitest/no-test-prefixes": "error",
"vitest/prefer-to-be": "off"
},
"overrides": [
{ "files": "**/utils/*.js", "rules": { "import/prefer-default-export": "off" } },
{
"files": "**/__tests__/**/*.test.ts?(x)",
"rules": {
"no-await-in-loop": "off",
"no-restricted-syntax": "off",
"prefer-promise-reject-errors": "off"
}
},
{ "files": "scripts/**/*.js", "rules": { "no-console": "off" } }
]
}