Skip to content

Commit

Permalink
Rework the docs for ESLint bulk suppressions
Browse files Browse the repository at this point in the history
  • Loading branch information
octogonz committed Jan 24, 2024
1 parent 4f84967 commit 8618d41
Show file tree
Hide file tree
Showing 4 changed files with 236 additions and 126 deletions.
39 changes: 25 additions & 14 deletions eslint/eslint-bulk/README.md
Original file line number Diff line number Diff line change
@@ -1,29 +1,37 @@
# @rushstack/eslint-bulk

This is a companion package for @rushstack/eslint-patch that should be installed globally as follows:
```bash
npm i -g @rushstack/eslint-bulk
```
This package provides the command-line interface (CLI) for the **ESLint bulk suppressions**
feature from
[`@rushstack/eslint-patch`](https://www.npmjs.com/package/@rushstack/eslint-patch).

The **eslint-bulk** package is a set of command line tools to use with the ESLint bulk suppressions patch.
eslint-bulk commands must be run in the same current working directory containing your package's pertaining
.eslintrc.js or .eslintrc.cjs file.
> 👉 See the `@rushstack/eslint-patch` [documentation](https://www.npmjs.com/package/@rushstack/eslint-patch)
> for details.
## eslint-bulk suppress
### Typical workflow

Use this command to automatically generate bulk suppressions for the given files and given rules.
Supply the paths as the main argument. The paths argument is a glob pattern that follows the same
rules as the "files" argument in the "eslint" command.
1. Checkout your `main` branch, which is in a clean state where ESLint reports no violations.
2. Update your configuration to enable the latest lint rules; ESLint now reports thousands of legacy violations.
3. Run `eslint-bulk suppress --all ./src` to update **.eslint-bulk-suppressions.json.**
4. ESLint now no longer reports violations, so commit the results to Git and merge your pull request.
5. Over time, engineers may improve some of the suppressed code, in which case the associated suppressions are no longer needed.
6. Run `eslint-bulk prune` periodically to find and remove unnecessary suppressions from **.eslint-bulk-suppressions.json**, ensuring that new violations will now get caught in those scopes.

### "eslint-bulk suppress" command

```bash
eslint-bulk suppress --rule NAME1 [--rule NAME2...] PATH1 [PATH2...]
eslint-bulk suppress --all PATH1 [PATH2...]
```

## eslint-bulk prune
Use this command to automatically generate bulk suppressions for the specified lint rules and file paths.
The path argument is a [glob pattern](https://en.wikipedia.org/wiki/Glob_(programming)) with the same syntax
as path arguments for the `eslint` command.


Use this command to automatically delete all unused suppression entries in all .eslint-bulk-suppressions.json
files under the current working directory.
### "eslint-bulk prune" command

Use this command to automatically delete all unnecessary suppression entries in all
**.eslint-bulk-suppressions.json** files under the current working directory.

```bash
eslint-bulk prune
Expand All @@ -34,4 +42,7 @@ eslint-bulk prune
- [CHANGELOG.md](https://github.com/microsoft/rushstack/blob/main/eslint/eslint-bulk/CHANGELOG.md) - Find
out what's new in the latest version

- [`@rushstack/eslint-patch`](https://www.npmjs.com/package/@rushstack/eslint-patch) required companion package


`@rushstack/eslint-bulk` is part of the [Rush Stack](https://rushstack.io/) family of projects.
6 changes: 4 additions & 2 deletions eslint/eslint-bulk/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@rushstack/eslint-bulk",
"version": "0.1.5",
"description": "A set of helper CLIs to use with the rushstack ESLint toolchain",
"description": "Roll out new ESLint rules in a large monorepo without cluttering up your code with \"eslint-ignore-next-line\"",
"main": "index.js",
"license": "MIT",
"repository": {
Expand All @@ -26,7 +26,9 @@
"retroactive",
"disable",
"ignore",
"suppression"
"suppression",
"monkey",
"patch"
],
"devDependencies": {
"@rushstack/heft": "workspace:*",
Expand Down

0 comments on commit 8618d41

Please sign in to comment.