# eslint-plugin-optimize-regex

> Optimize regex literals

Latest version **1.2.1** (published 2021-07-26) · MIT license · 0 weekly downloads

## Install

```sh
npm install eslint-plugin-optimize-regex
pnpm add eslint-plugin-optimize-regex
yarn add eslint-plugin-optimize-regex
bun add eslint-plugin-optimize-regex
```

## 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.2.1 |
| Published | 2021-07-26 |
| First published | 2017-04-14 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=10 |
| Dependencies | 1 |
| Unpacked size | 11.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Ezinwa Okpoechi |
| Maintainers | brainmaestro |
| Keywords | eslint, eslintplugin, eslint-plugin, regex, regex-optimizer |

## Links

- npm: https://www.npmjs.com/package/eslint-plugin-optimize-regex
- Repository: https://github.com/BrainMaestro/eslint-plugin-optimize-regex
- Issues: https://github.com/BrainMaestro/eslint-plugin-optimize-regex/issues
- npm.io page: https://npm.io/package/eslint-plugin-optimize-regex

## Dependencies (1)

- [regexp-tree](https://npm.io/package/regexp-tree.md) ^0.1.21

## 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

- 1.2.1 (latest) — 2021-07-26
- 1.2.0 — 2020-04-19
- 1.1.7 — 2019-09-24
- 1.1.6 — 2018-09-15
- 1.1.5 — 2017-12-04
- 1.1.4 — 2017-08-01
- 1.1.3 — 2017-07-11
- 1.1.2 — 2017-06-28
- 1.1.1 — 2017-04-27
- 1.1.0 — 2017-04-26
- 1.0.0 — 2017-04-14
- 0.1.0 — 2017-04-14

## README

# eslint-plugin-optimize-regex
[![npm](https://img.shields.io/npm/v/eslint-plugin-optimize-regex.svg)](https://www.npmjs.com/package/eslint-plugin-optimize-regex)
[![npm](https://img.shields.io/npm/dt/eslint-plugin-optimize-regex.svg)](https://www.npmjs.com/package/eslint-plugin-optimize-regex)

> Optimize regex literals

## Installation

You'll first need to install [ESLint](http://eslint.org):

```
npm i eslint --save-dev
```

Next, install `eslint-plugin-optimize-regex`:

```
npm install eslint-plugin-optimize-regex --save-dev
```

**Note:** If you installed ESLint globally (using the `-g` flag) then you must also install `eslint-plugin-optimize-regex` globally.

## Usage

Add `optimize-regex` to the plugins section of your `.eslintrc` configuration file. You can omit the `eslint-plugin-` prefix:

```json
{
    "plugins": [
        "optimize-regex"
    ]
}
```


Then configure the rules you want to use under the rules section.

```json
{
    "rules": {
        "optimize-regex/optimize-regex": "warn"
    }
}
```

If you wish to add a `whitelist` or `blacklist` array against `regexp-tree`'s
[transforms](https://github.com/DmitrySoshnikov/regexp-tree/blob/master/src/optimizer/README.md#transforms), you can add them on an objects object:

```json
{
    "rules": {
        "optimize-regex/optimize-regex": ["warn", {
            "blacklist": ["charClassClassrangesMerge"]
        }]
    }
}
```

If you want the latter particular settings, you can avoid setting `plugins` and
`rules` and just use:

```json
{
  "extends": ["optimize-regex/recommended"]
}
```

Or without the blacklist:

```json
{
  "extends": ["optimize-regex/all"]
}
```

## Rules

* [optimize-regex](./docs/rules/optimize-regex.md)

## Inspiration

* [regexp-tree](https://github.com/DmitrySoshnikov/regexp-tree)

## License

MIT © Ezinwa Okpoechi

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