Skip to content

Commit

Permalink
feat(eslint-plugin): Add BigInt object type to default ban-types list (
Browse files Browse the repository at this point in the history
…#4970)

* Add BigInt object type to default ban-types list

* Update documentation with bigint type added
  • Loading branch information
tduyduc committed May 14, 2022
1 parent 0377070 commit 1867728
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
6 changes: 6 additions & 0 deletions packages/eslint-plugin/docs/rules/ban-types.md
Expand Up @@ -105,6 +105,10 @@ const defaultTypes = {
message: 'Use symbol instead',
fixWith: 'symbol',
},
BigInt: {
message: 'Use bigint instead',
fixWith: 'bigint',
},

Function: {
message: [
Expand Down Expand Up @@ -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;
Expand All @@ -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;
Expand Down
4 changes: 4 additions & 0 deletions packages/eslint-plugin/src/rules/ban-types.ts
Expand Up @@ -66,6 +66,10 @@ const defaultTypes: Types = {
message: 'Use symbol instead',
fixWith: 'symbol',
},
BigInt: {
message: 'Use bigint instead',
fixWith: 'bigint',
},

Function: {
message: [
Expand Down

0 comments on commit 1867728

Please sign in to comment.