From 1867728ba104a6a21941ed300828110964a43b96 Mon Sep 17 00:00:00 2001 From: "T.D. Stoneheart" Date: Sat, 14 May 2022 22:44:02 +0700 Subject: [PATCH] feat(eslint-plugin): Add BigInt object type to default ban-types list (#4970) * Add BigInt object type to default ban-types list * Update documentation with bigint type added --- packages/eslint-plugin/docs/rules/ban-types.md | 6 ++++++ packages/eslint-plugin/src/rules/ban-types.ts | 4 ++++ 2 files changed, 10 insertions(+) diff --git a/packages/eslint-plugin/docs/rules/ban-types.md b/packages/eslint-plugin/docs/rules/ban-types.md index 0a16559e96f..8f59dd8f60d 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; diff --git a/packages/eslint-plugin/src/rules/ban-types.ts b/packages/eslint-plugin/src/rules/ban-types.ts index 38224b15ce9..00279a7db0c 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: [