Skip to content

Commit a6df6c0

Browse files
authored
Enable @typescript-eslint/ban-types (#55133)
1 parent c69f447 commit a6df6c0

File tree

3 files changed

+15
-4
lines changed

3 files changed

+15
-4
lines changed

.eslintrc.json

+12-1
Original file line numberDiff line numberDiff line change
@@ -89,9 +89,20 @@
8989
"@typescript-eslint/no-var-requires": "off",
9090
"@typescript-eslint/no-empty-interface": "off",
9191
"@typescript-eslint/no-explicit-any": "off",
92+
"@typescript-eslint/ban-types": [
93+
"error",
94+
{
95+
"extendDefaults": true,
96+
"types": {
97+
// This is theoretically good, but ts-eslint appears to mistake our declaration of Symbol for the global Symbol type.
98+
// See: https://github.com/typescript-eslint/typescript-eslint/issues/7306
99+
"Symbol": false,
100+
"{}": false // {} is a totally useful and valid type.
101+
}
102+
}
103+
],
92104

93105
// Todo: For each of these, investigate whether we want to enable them ✨
94-
"@typescript-eslint/ban-types": "off",
95106
"no-useless-escape": "off",
96107
"prefer-rest-params": "off",
97108
"prefer-spread": "off",

src/compiler/sys.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1711,7 +1711,7 @@ export let sys: System = (() => {
17111711

17121712
function bufferFrom(input: string, encoding?: string): Buffer {
17131713
// See https://github.com/Microsoft/TypeScript/issues/25652
1714-
return Buffer.from && (Buffer.from as Function) !== Int8Array.from
1714+
return Buffer.from && Buffer.from !== Int8Array.from
17151715
? Buffer.from(input, encoding)
17161716
: new Buffer(input, encoding);
17171717
}

src/harness/fourslashImpl.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -442,11 +442,11 @@ export class TestState {
442442
for (const k of keys) {
443443
const key = k as keyof typeof ls;
444444
if (cacheableMembers.indexOf(key) === -1) {
445-
proxy[key] = (...args: any[]) => (ls[key] as Function)(...args);
445+
proxy[key] = (...args: any[]) => (ls[key] as (...args: any[]) => any)(...args);
446446
continue;
447447
}
448448
const memo = Utils.memoize(
449-
(_version: number, _active: string, _caret: number, _selectEnd: number, _marker: string | undefined, ...args: any[]) => (ls[key] as Function)(...args),
449+
(_version: number, _active: string, _caret: number, _selectEnd: number, _marker: string | undefined, ...args: any[]) => (ls[key] as (...args: any[]) => any)(...args),
450450
(...args) => args.map(a => a && typeof a === "object" ? JSON.stringify(a) : a).join("|,|")
451451
);
452452
proxy[key] = (...args: any[]) => memo(

0 commit comments

Comments
 (0)