# eslint-plugin-export-default-identifier

> eslint plugin to ensure that export default must export an identifier.

Latest version **0.3.0** (published 2021-06-11) · ISC license · 0 weekly downloads

## Install

```sh
npm install eslint-plugin-export-default-identifier
pnpm add eslint-plugin-export-default-identifier
yarn add eslint-plugin-export-default-identifier
bun add eslint-plugin-export-default-identifier
```

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.3.0 |
| Published | 2021-06-11 |
| First published | 2020-07-03 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 9 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Raine Revere |
| Maintainers | raine |
| Keywords | eslint, typescript, example |

## Links

- npm: https://www.npmjs.com/package/eslint-plugin-export-default-identifier
- npm.io page: https://npm.io/package/eslint-plugin-export-default-identifier

## 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
- [@pandacss/eslint-plugin](https://npm.io/package/@pandacss/eslint-plugin.md) — 18.7K weekly downloads

## Recent versions

- 0.3.0 (latest) — 2021-06-11
- 0.2.0 — 2020-07-03
- 0.1.0 — 2020-07-03

## README

# export-default-identifier

An eslint plugin that only allows `export default` to export specific types of expressions.

By default, only allows `Identifier` expressions, i.e. named variables. Excludes all anonymous classes, functions, and objects. This was originally created for use with [TypeDoc](https://typedoc.org/), which does not generate proper JSDOC documentation for anonymous export defaults.

NOTE: Equivalent to [`import/no-anonymous-default-export`](https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-anonymous-default-export.md):

```
"import/no-anonymous-default-export": ["error", {
  "allowArray": false,
  "allowArrowFunction": false,
  "allowAnonymousClass": false,
  "allowAnonymousFunction": false,
  "allowCallExpression": false,
  "allowLiteral": false,
  "allowObject": false
}]
```

# Install

```
npm install --save-dev export-default-identifier
```

# Usage

Add to your `.eslintrc.json`:

```js
{
  "plugins": [
    "export-default-identifier",
  ],
  ...
  "rules": {
    "export-default-identifier/export-default-identifier": "error"
  }
}
```

Specify exactly which types can be exported as default:

```js
"export-default-identifier/export-default-identifier": ["error", {
  "types": ["Identifier"]
}]
```

## Rule details

❌ Examples of **incorrect** code:
```js
export default {}
export default function test() {}
```

✔️ Examples of **correct** code:
```js

const myExport = {}
export default myExport
```

❌ Examples of **incorrect** code with `[{"types":["Identifier","FunctionDeclaration"]}]` options:
```js
export default {}
```

✔️ Examples of **correct** code with `[{"types":["Identifier","FunctionDeclaration"]}]` options:
```js

const myExport = {}
export default myExport

export default function test() {}
```

## Resources

* [Rule source](/src/rules/export-default-identifier.ts)
* [Test source](/src/rules/export-default-identifier.test.ts)

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