# add-eslint-comment

> Add ESLint comment per file according to the ESLint result.

Latest version **0.1.0** (published 2017-08-11) · MIT license · 0 weekly downloads

## Install

```sh
npm install add-eslint-comment
pnpm add add-eslint-comment
yarn add add-eslint-comment
bun add add-eslint-comment
```

Provides the command `add-eslint-comment`.

## 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.1.0 |
| Published | 2017-08-11 |
| First published | 2017-08-11 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 9 |
| Author | xcatliu |
| Maintainers | xcatliu |
| Keywords | eslint, eslint-comment |

## Links

- npm: https://www.npmjs.com/package/add-eslint-comment
- Repository: https://github.com/xcatliu/add-eslint-comment
- Homepage: https://github.com/xcatliu/add-eslint-comment#readme
- Issues: https://github.com/xcatliu/add-eslint-comment/issues
- npm.io page: https://npm.io/package/add-eslint-comment

## Dependencies (1)

- [commander](https://npm.io/package/commander.md) ^2.11.0

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

- 0.1.0 (latest) — 2017-08-11

## README

# Add ESLint Comment

Every time when I trying to add ESLint to an old project, it's painful to fix errors like `eqeqeq` or `no-var`.

One way is to enable these rules and add eslint comment to the old files to prevent new files breaking these rules.

This is what this tool can do.

> Add ESLint comment per file according to the ESLint result.

Before:

```js
var foo;
if (foo == 1) {
    alert(foo);
}
```

After:

```js
/* eslint no-var:0 */
/* eslint no-alert:0 */
/* eslint eqeqeq:0 */
var foo;
if (foo == 1) {
    alert(foo);
}
```

## Getting Started

### Installation

```bash
npm install add-eslint-comment -g
```

### Generate ESLint Result JSON

```bash
eslint -f json src > eslint-result.json
```

This will lint your `src` directory, formatter the result to json, and output into `eslint-result.json` file.

Checkout [the documentation](http://eslint.org/docs/user-guide/formatters/#json) for more details.

### Add ESLint Comment per file

```bash
add-eslint-comment -j eslint-result.json
```

---

Have fun with add-eslint-comment!

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