Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/nwtgck/eslint-plugin-exaggerated-non-null-assertion

Exaggerated Non-Null Assertion
https://github.com/nwtgck/eslint-plugin-exaggerated-non-null-assertion

eslint linter non-null-assertion typescript-eslint

Last synced: 14 days ago
JSON representation

Exaggerated Non-Null Assertion

Awesome Lists containing this project

README

        

# eslint-plugin-exaggerated-non-null-assertion

## Rule Details

Example of **incorrect** code for this rule:

```ts
const foo: number | undefined = undefined;
const bar = foo!;
```

Example of **correct** code for this rule:

```ts
const foo: number | undefined = undefined;
const bar = foo!!!;
```

## Installation

```bash
npm i -D nwtgck/eslint-plugin-exaggerated-non-null-assertion
```

Add the following settings to `.eslintrc.js` or the other ESLint setting file.

```js
...
"plugins": [
...
"exaggerated-non-null-assertion"
],
```

```js
...
"rules": {
...
// NOTE: Disable no-extra-non-null-assertion and no-non-null-assertion
"@typescript-eslint/no-extra-non-null-assertion": "off",
"@typescript-eslint/no-non-null-assertion": "off",
// Enable Exaggerated Non-Null Assertion
"exaggerated-non-null-assertion/exaggerated-non-null-assertion": "error",
}
```

## Example

Here is an example using this lint.