You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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>
Copy file name to clipboardExpand all lines: docs/src/use/configure/rules.md
+11Lines changed: 11 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -144,6 +144,17 @@ You can also use this format with configuration comments, such as:
144
144
145
145
### Using configuration comments
146
146
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
+
147
158
To disable rule warnings in a part of a file, use block comments in the following format:
0 commit comments