-
Notifications
You must be signed in to change notification settings - Fork 19
Expand file tree
/
Copy patheslint.config.ts
More file actions
103 lines (100 loc) · 3.34 KB
/
Copy patheslint.config.ts
File metadata and controls
103 lines (100 loc) · 3.34 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
100
101
102
103
// @ts-check
import { URL, fileURLToPath } from "url";
import { defineConfig } from "eslint/config";
import eslint from "@eslint/js";
import tseslint from "typescript-eslint";
export default defineConfig([
{
ignores: ["build/scripts/", "archived/", "spec/build/", "spec/plugin/", "scripts/*.js", "copy-client.js"],
},
eslint.configs.recommended,
...tseslint.configs.recommendedTypeChecked,
...tseslint.configs.stylisticTypeChecked,
{
languageOptions: {
parserOptions: {
project: ["./tsconfig.json", "./spec/tsconfig.json", "./scripts/tsconfig.json"],
tsconfigRootDir: fileURLToPath(new URL(".", import.meta.url)),
}
},
rules: {
"indent": [
"warn",
"tab",
{
ignoredNodes: [
"* > TemplateLiteral",
"TemplateLiteral ~ *",
"TemplateLiteral *",
"SwitchCase",
"ConditionalExpression",
"PropertyDefinition > ObjectExpression"
],
}
],
"no-undef": "off",
"linebreak-style": "off",
"semi": ["error", "always"],
"no-unused-vars": "off",
"prefer-const": "warn",
"no-unexpected-multiline": "off",
"no-empty": ["warn", {"allowEmptyCatch": true}],
"no-control-regex": "off",
"@typescript-eslint/no-require-imports": "off",
"@typescript-eslint/no-unused-vars": "off",
"@typescript-eslint/no-empty-object-type": "off",
"@typescript-eslint/prefer-promise-reject-errors": "off",
"@typescript-eslint/consistent-type-definitions": ["error", "type"],
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/no-this-alias": "off",
"@typescript-eslint/prefer-regexp-exec": "off",
"@typescript-eslint/array-type": ["error", {default: "array-simple"}],
"@typescript-eslint/no-floating-promises": ["warn", { "checkThenables": true }],
'no-restricted-syntax': [
'warn',
{
selector: 'LogicalExpression[operator="||"][right.value=true]',
message: '|| true is only for testing',
},
{
selector: 'LogicalExpression[operator="&&"][right.value=false]',
message: '&& false is only for testing',
},
],
"no-fallthrough": "off", //Typescript's native noFallthroughCasesInSwitch is more accurate
"@typescript-eslint/no-unsafe-argument": "off",
"@typescript-eslint/no-unsafe-assignment": "off",
"@typescript-eslint/no-unsafe-call": "off",
"@typescript-eslint/no-unsafe-function-type": "off",
"@typescript-eslint/no-unsafe-member-access": "off",
"@typescript-eslint/no-unsafe-return": "off",
"@typescript-eslint/no-inferrable-types": "off",
"@typescript-eslint/dot-notation": "off",
"@typescript-eslint/prefer-nullish-coalescing": "off",
"@typescript-eslint/no-empty-function": ["warn", {
allow: ["arrowFunctions"]
}],
//This rule is really useful but it's generating too many false positives
//TODO try to turn it back on, maybe it's a temporary bug?
"@typescript-eslint/no-unnecessary-type-assertion": "off",
},
},
{
files: ["src/**/*.ts"],
rules: {
'no-restricted-imports': ['error', {
patterns: [{
group: ['./*'],
message: 'Do not import things from "./foo", this will crash at runtime. Use "/foo" instead.',
}, {
group: ['../*'],
message: 'Do not import things from "../foo", this will crash at runtime. Use "/foo" instead.',
}],
}],
}
},
{
files: ["src/main.js", "eslint.config.ts"],
extends: [tseslint.configs.disableTypeChecked],
},
]);