# eslint-plugin-use-optional-annotation

> Disallow `undefined` for keeping structure.

Latest version **1.0.3** (published 2022-01-04) · MIT license · 0 weekly downloads

## Install

```sh
npm install eslint-plugin-use-optional-annotation
pnpm add eslint-plugin-use-optional-annotation
yarn add eslint-plugin-use-optional-annotation
bun add eslint-plugin-use-optional-annotation
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.3 |
| Published | 2022-01-04 |
| First published | 2020-05-13 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Takuya Eguchi |
| Maintainers | akagire |
| Keywords | eslint |

## Links

- npm: https://www.npmjs.com/package/eslint-plugin-use-optional-annotation
- Repository: https://github.com/Akagire/eslint-plugin-use-optional-annotation
- Homepage: https://github.com/Akagire/eslint-plugin-use-optional-annotation#readme
- Issues: https://github.com/Akagire/eslint-plugin-use-optional-annotation/issues
- npm.io page: https://npm.io/package/eslint-plugin-use-optional-annotation

## Alternatives

- [eslint-plugin-sonarjs](https://npm.io/package/eslint-plugin-sonarjs.md) — 2.9M weekly downloads
- [eslint-config-expo](https://npm.io/package/eslint-config-expo.md) — 1.5M weekly downloads
- [@matter/protocol](https://npm.io/package/@matter/protocol.md) — 63.5K weekly downloads
- [@eventcatalog/linter](https://npm.io/package/@eventcatalog/linter.md) — 24.8K weekly downloads
- [@inrupt/eslint-config-base](https://npm.io/package/@inrupt/eslint-config-base.md) — 4.5K weekly downloads

## Recent versions

- 1.0.3 (latest) — 2022-01-04
- 1.0.1 — 2020-12-09
- 1.0.0 — 2020-05-13

## README

# eslint-plugin-use-optional-annotation

Disallow `undefined` for keeping structure.

The following will all be incorrect usage:

```typescript
const foo = { x: 123, y: undefined };
```

The following will all be correct usage:

```typescript
const foo: { x: number, y?: number } = { x: 123 };
```

We made it to keep this TypeScript styleguide's `null-vs-undefined`.

https://github.com/basarat/typescript-book/blob/master/docs/styleguide/styleguide.md#null-vs-undefined

# Installation

```
yarn add -D eslint-plugin-use-optional-annotation
# or npm i -D eslint-plugin-use-optional-annotation
```

# Configuration

Set `.eslintrc` following

```.eslintrc.js
plugins: [
  'use-optional-annotation' // add to `plugins` arrays final element.
],
// ...
rules: {
  'use-optional-annotation/use-optional-annotation': 'error'
}
```

---
_Source: https://npm.io/package/eslint-plugin-use-optional-annotation · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
