Skip to content

Commit

Permalink
docs(no-inferrable-types): fix tabs (typescript-eslint#4180)
Browse files Browse the repository at this point in the history
* docs(no-inferrable-types): fix tabs

* Update no-inferrable-types.md
  • Loading branch information
MichaelDeBoey committed Nov 18, 2021
1 parent 0fe07e2 commit 6c3816b
Showing 1 changed file with 42 additions and 42 deletions.
84 changes: 42 additions & 42 deletions packages/eslint-plugin/docs/rules/no-inferrable-types.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,48 @@ With these options, the following patterns are:

<!--tabs-->

#### ❌ Correct
#### ❌ Incorrect

```ts
const a: bigint = 10n;
const a: bigint = -10n;
const a: bigint = BigInt(10);
const a: bigint = -BigInt(10);
const a: boolean = false;
const a: boolean = true;
const a: boolean = Boolean(null);
const a: boolean = !0;
const a: number = 10;
const a: number = +10;
const a: number = -10;
const a: number = Number('1');
const a: number = +Number('1');
const a: number = -Number('1');
const a: number = Infinity;
const a: number = +Infinity;
const a: number = -Infinity;
const a: number = NaN;
const a: number = +NaN;
const a: number = -NaN;
const a: null = null;
const a: RegExp = /a/;
const a: RegExp = RegExp('a');
const a: RegExp = new RegExp('a');
const a: string = 'str';
const a: string = `str`;
const a: string = String(1);
const a: symbol = Symbol('a');
const a: undefined = undefined;
const a: undefined = void someValue;

class Foo {
prop: number = 5;
}

function fn(a: number = 5, b: boolean = true) {}
```

#### ✅ Correct

```ts
const a = 10n;
Expand Down Expand Up @@ -76,47 +117,6 @@ function fn(a = 5, b = true) {}
function fn(a: number, b: boolean, c: string) {}
```

#### ❌ Incorrect

```ts
const a: bigint = 10n;
const a: bigint = -10n;
const a: bigint = BigInt(10);
const a: bigint = -BigInt(10);
const a: boolean = false;
const a: boolean = true;
const a: boolean = Boolean(null);
const a: boolean = !0;
const a: number = 10;
const a: number = +10;
const a: number = -10;
const a: number = Number('1');
const a: number = +Number('1');
const a: number = -Number('1');
const a: number = Infinity;
const a: number = +Infinity;
const a: number = -Infinity;
const a: number = NaN;
const a: number = +NaN;
const a: number = -NaN;
const a: null = null;
const a: RegExp = /a/;
const a: RegExp = RegExp('a');
const a: RegExp = new RegExp('a');
const a: string = 'str';
const a: string = `str`;
const a: string = String(1);
const a: symbol = Symbol('a');
const a: undefined = undefined;
const a: undefined = void someValue;

class Foo {
prop: number = 5;
}

function fn(a: number = 5, b: boolean = true) {}
```

<!--/tabs-->

### `ignoreParameters`
Expand Down

0 comments on commit 6c3816b

Please sign in to comment.