# babel-plugin-auto-symbol-description

> A Babel plugin to automatically set Symbol descriptions.

Latest version **2.0.0** (published 2019-05-25) · MIT license · 0 weekly downloads

## Install

```sh
npm install babel-plugin-auto-symbol-description
pnpm add babel-plugin-auto-symbol-description
yarn add babel-plugin-auto-symbol-description
bun add babel-plugin-auto-symbol-description
```

## 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 | 2.0.0 |
| Published | 2019-05-25 |
| First published | 2015-09-04 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 139.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | Kenneth Chung |
| Maintainers | kentor |
| Keywords | babel, babel-plugin, dx, redux, symbol |

## Links

- npm: https://www.npmjs.com/package/babel-plugin-auto-symbol-description
- Repository: https://github.com/kentor/babel-plugin-auto-symbol-description
- Issues: https://github.com/kentor/babel-plugin-auto-symbol-description/issues
- npm.io page: https://npm.io/package/babel-plugin-auto-symbol-description

## Alternatives

- [@openai/codex-sdk](https://npm.io/package/@openai/codex-sdk.md) — 731.4K weekly downloads
- [babel-plugin-transform-react-jsx](https://npm.io/package/babel-plugin-transform-react-jsx.md) — 565.0K weekly downloads
- [babel-helper-remove-or-void](https://npm.io/package/babel-helper-remove-or-void.md) — 508.5K weekly downloads
- [@pnpm/store-controller-types](https://npm.io/package/@pnpm/store-controller-types.md) — 186.9K weekly downloads
- [react-native-signature-canvas](https://npm.io/package/react-native-signature-canvas.md) — 155.6K weekly downloads

## Recent versions

- 2.0.0 (latest) — 2019-05-25
- 1.0.0 — 2015-11-09
- 0.0.1 — 2015-09-04

## README

# Auto Symbol Description [![Build Status](https://travis-ci.org/kentor/babel-plugin-auto-symbol-description.svg)](https://travis-ci.org/kentor/babel-plugin-auto-symbol-description) [![npm](https://img.shields.io/npm/v/babel-plugin-auto-symbol-description.svg)](https://www.npmjs.com/package/babel-plugin-auto-symbol-description)

A [Babel][b] plugin to automatically set [Symbol][s] descriptions.

**Note:** Babel 7 is supported in version 2.0+.

**Note:** Babel 6 is supported in version 1.0+. Keep using version 0.0.1
for Babel 5 support.

## Use Cases

### Redux
Very useful with Redux if you use Symbols for action types:

In:

```js
// TodoActions.js
export const CREATE = Symbol();
export const CREATE_SUCCESS = Symbol();
export const CREATE_FAILURE = Symbol();
```

Out (something like this):

```js
// TodoActions.js
export const CREATE = Symbol('TodoActions.CREATE');
export const CREATE_SUCCESS = Symbol('TodoActions.CREATE_SUCCESS');
export const CREATE_FAILURE = Symbol('TodoActions.CREATE_FAILURE');
```

Then use these constants in a reducer:

```js
// TodoReducer.js
import * as TodoActions from '../actions/TodoActions';

export function TodoReducer(state, action) {
  switch (action) {
  case TodoActions.CREATE:
    // Handle create
    break;
  case TodoActions.CREATE_SUCCESS:
    // Handle create success
    break;
  case TodoActions.CREATE_FAILURE:
    // Handle create failure
    break;
  default:
    return state;
  }
}
```

Symbol descriptions are only useful for debugging, so idealy you would only
include this transformation in development.

## Installation

```
npm install -D babel-plugin-auto-symbol-description
```

.babelrc:
```
{
  "env": {
    "development": {
      "plugins": ["auto-symbol-description"]
    }
  }
}
```

## Notes

This plugin won't transform any `Symbol` calls with an argument, and it only
works for assignments and variable declarations for now. Let me know if there is
demand for the transformation when setting an object property or any other use
cases.

[b]: http://babeljs.io/
[s]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Symbol

---
_Source: https://npm.io/package/babel-plugin-auto-symbol-description · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
