From 2086c903ff2a83408d5489be7b557b908ad6009d Mon Sep 17 00:00:00 2001 From: "T.D. Stoneheart" Date: Sat, 14 May 2022 00:41:49 +0700 Subject: [PATCH 1/2] Add BigInt object type to default ban-types list --- packages/eslint-plugin/src/rules/ban-types.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/packages/eslint-plugin/src/rules/ban-types.ts b/packages/eslint-plugin/src/rules/ban-types.ts index 38224b15ce93..00279a7db0c3 100644 --- a/packages/eslint-plugin/src/rules/ban-types.ts +++ b/packages/eslint-plugin/src/rules/ban-types.ts @@ -66,6 +66,10 @@ const defaultTypes: Types = { message: 'Use symbol instead', fixWith: 'symbol', }, + BigInt: { + message: 'Use bigint instead', + fixWith: 'bigint', + }, Function: { message: [ From cd266e1d82525f4f1ce743fe2e37860f0ff1e60b Mon Sep 17 00:00:00 2001 From: "T.D. Stoneheart" Date: Sat, 14 May 2022 01:08:01 +0700 Subject: [PATCH 2/2] Update documentation with bigint type added --- packages/eslint-plugin/docs/rules/ban-types.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/packages/eslint-plugin/docs/rules/ban-types.md b/packages/eslint-plugin/docs/rules/ban-types.md index 0a16559e96f5..8f59dd8f60d3 100644 --- a/packages/eslint-plugin/docs/rules/ban-types.md +++ b/packages/eslint-plugin/docs/rules/ban-types.md @@ -105,6 +105,10 @@ const defaultTypes = { message: 'Use symbol instead', fixWith: 'symbol', }, + BigInt: { + message: 'Use bigint instead', + fixWith: 'bigint', + }, Function: { message: [ @@ -149,6 +153,7 @@ const str: String = 'foo'; const bool: Boolean = true; const num: Number = 1; const symb: Symbol = Symbol('foo'); +const bigInt: BigInt = 1n; // use a proper function type const func: Function = () => 1; @@ -169,6 +174,7 @@ const str: string = 'foo'; const bool: boolean = true; const num: number = 1; const symb: symbol = Symbol('foo'); +const bigInt: bigint = 1n; // use a proper function type const func: () => number = () => 1;