Skip to content

Commit cab21e6

Browse files
criticalAYnzakas
andauthored
docs: advice for inline disabling of rules (#17458)
* docs: advice for dev while disabling rules * docs: advice for dev while disabling rules * docs: advice for dev while disabling rules * Update docs/src/use/configure/rules.md --------- Co-authored-by: Nicholas C. Zakas <nicholas@humanwhocodes.com>
1 parent 056499d commit cab21e6

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

docs/src/use/configure/rules.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,17 @@ You can also use this format with configuration comments, such as:
144144

145145
### Using configuration comments
146146

147+
* **Use with Caution.** Disabling ESLint rules inline should be restricted and used only in situations with a clear and
148+
valid reason for doing so. Disabling rules inline should not be the default solution to resolve linting errors.
149+
* **Document the Reason.** Provide a comment explaining the reason for disabling a particular rule after the `--` section of the comment. This
150+
documentation should clarify why the rule is being disabled and why it is necessary in that specific situation.
151+
* **Temporary Solutions.** If a disable comment is added as a temporary measure to address a pressing issue, create a follow-up task to address the underlying problem adequately. This ensures that the
152+
disable comment is revisited and resolved at a later stage.
153+
* **Code Reviews and Pair Programming.** Encourage team members to review each other's code regularly. Code reviews can help
154+
identify the reasons behind disable comments and ensure that they are used appropriately.
155+
* **Configurations.** Whenever possible, prefer using ESLint configuration files over disable comments. Configuration
156+
files allow for consistent and project-wide rule handling.
157+
147158
To disable rule warnings in a part of a file, use block comments in the following format:
148159

149160
```js

0 commit comments

Comments
 (0)