Skip to content
This repository has been archived by the owner on Aug 31, 2023. It is now read-only.

Commit

Permalink
chore(website): add section for suppression comments for linter (#3172)
Browse files Browse the repository at this point in the history
Co-authored-by: Micha Reiser <[email protected]>
  • Loading branch information
ematipico and MichaReiser authored Sep 7, 2022
1 parent c31dc64 commit dd61588
Showing 1 changed file with 30 additions and 1 deletion.
31 changes: 30 additions & 1 deletion website/src/_includes/docs/linter.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,37 @@ At the moment only a few rules are implemented as the linting / analysis infrast

**See the full [list of rules](/docs/lint/rules).**

All rules are enabled by default, and cannot be disabled. [Suppressions](#suppressions) can be used to hide specific lint errors.
All rules are enabled by default, and cannot be disabled. [Suppression](#lint-suppression) can be used to hide specific lint errors.


[VS Code extension]: https://marketplace.visualstudio.com/items?itemName=rome.rome
[release page]: https://github.com/rome/tools/releases


### Lint suppression

There are times when a developer wants to ignore a lint rule for a specific line of the code.

You can achieve this by adding a suppression comment above the line that is triggering the lint diagnostic.

Suppression comments have the following format:

```js
// rome-ignore lint: <explanation>
// rome-ignore lint(js/noDebugger): <explanation>
```

Where
- `rome-ignore` is the start of a suppression comment;
- `lint:` suppresses the linter;
- `(js/noDebugger)`: **optional**, group and name of the rule you want to suppress;
- `<explanation>` explanation why the rule is disabled

Here's an example:

```ts
// rome-ignore lint: reason
declare const Foo: number;
// rome-ignore lint(js/noUnusedVariables): reason
declare const Bar: number;
```

0 comments on commit dd61588

Please sign in to comment.