forked from TypeStrong/typedoc
-
Notifications
You must be signed in to change notification settings - Fork 0
/
eslint.config.mjs
135 lines (115 loc) · 4.58 KB
/
eslint.config.mjs
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
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
// @ts-check
import eslint from "@eslint/js";
import tslint from "typescript-eslint";
/** @type {import("typescript-eslint").ConfigWithExtends} */
const config = {
languageOptions: {
parserOptions: {
project: true,
tsconfigRootDir: import.meta.dirname,
},
},
rules: {
"@typescript-eslint/no-floating-promises": "error",
"@typescript-eslint/await-thenable": "error",
"@typescript-eslint/consistent-type-imports": [
"error",
{
fixStyle: "inline-type-imports",
prefer: "type-imports",
disallowTypeAnnotations: false,
},
],
"@typescript-eslint/restrict-template-expressions": [
"error",
{
allowBoolean: true,
allowNumber: true,
},
],
// This one is just annoying since it complains at incomplete code
"no-empty": "off",
// Doesn't properly handle intersections of generics.
"@typescript-eslint/unified-signatures": "off",
// This rule is factually incorrect. Interfaces which extend some type alias can be used to introduce
// new type names. This is useful particularly when dealing with mixins.
"@typescript-eslint/no-empty-interface": "off",
// Conflicts with TS option to require dynamic access for records, which I find more useful.
"@typescript-eslint/no-dynamic-delete": "off",
// Conflicts with the `NeverIfInternal` type used to enforce a stricter API internally
"@typescript-eslint/no-redundant-type-constituents": "off",
"@typescript-eslint/no-unnecessary-boolean-literal-compare": "off",
// This is sometimes useful for clarity
"@typescript-eslint/no-unnecessary-type-arguments": "off",
// We still use `any` fairly frequently...
"@typescript-eslint/ban-types": "off",
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/no-unsafe-assignment": "off",
"@typescript-eslint/no-unsafe-argument": "off",
"@typescript-eslint/no-unsafe-return": "off",
"@typescript-eslint/no-unsafe-member-access": "off",
"@typescript-eslint/no-unsafe-call": "off",
// Really annoying, doesn't provide any value.
"@typescript-eslint/no-empty-function": "off",
// Declaration merging with a namespace is a necessary tool when working with enums.
"@typescript-eslint/no-namespace": "off",
// Reported by TypeScript
"@typescript-eslint/no-unused-vars": "off",
"no-console": "warn",
"@typescript-eslint/no-confusing-void-expression": "off",
"@typescript-eslint/unbound-method": "off",
"@typescript-eslint/prefer-literal-enum-member": [
"error",
{ allowBitwiseExpressions: true },
],
// I'd like to have this turned on, but haven't figured out how to tell it about
// checks that are correctly linted as unnecessary for TypeDoc's usage, but not
// for plugin permitted usage.
"@typescript-eslint/no-unnecessary-condition": "off",
// Feel free to turn one of these back on and submit a PR!
"@typescript-eslint/no-non-null-assertion": "off",
"@typescript-eslint/explicit-module-boundary-types": "off",
"no-restricted-syntax": [
"warn",
{
selector: "ImportDeclaration[source.value=/.*perf$/]",
message: "Benchmark calls must be removed before committing.",
},
{
selector:
"MemberExpression[object.name=type][property.name=symbol]",
message:
"Use type.getSymbol() instead, Type.symbol is not properly typed.",
},
],
},
};
export default tslint.config(
eslint.configs.recommended,
...tslint.configs.strictTypeChecked,
config,
{
ignores: [
"eslint.config.mjs",
"src/test/renderer/specs",
"dist",
"docs",
"tmp",
"coverage",
"static/main.js",
"src/lib/output/themes/default/assets",
"**/node_modules",
"example",
"src/test/converter",
"src/test/converter2",
"src/test/module",
"src/test/packages",
"src/test/renderer/",
"src/test/slow/entry-points",
"scripts",
"bin",
// Not long for this world
"src/test/events.test.ts",
],
},
);