From cab21e64a8f79779c641178f825945958667c6e4 Mon Sep 17 00:00:00 2001 From: Ashish Yadav <48384865+criticalAY@users.noreply.github.com> Date: Tue, 22 Aug 2023 20:47:33 +0530 Subject: [PATCH] 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 --- docs/src/use/configure/rules.md | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/docs/src/use/configure/rules.md b/docs/src/use/configure/rules.md index fd93c2919a0..7fa0bde7f31 100644 --- a/docs/src/use/configure/rules.md +++ b/docs/src/use/configure/rules.md @@ -144,6 +144,17 @@ You can also use this format with configuration comments, such as: ### Using configuration comments +* **Use with Caution.** Disabling ESLint rules inline should be restricted and used only in situations with a clear and + valid reason for doing so. Disabling rules inline should not be the default solution to resolve linting errors. +* **Document the Reason.** Provide a comment explaining the reason for disabling a particular rule after the `--` section of the comment. This + documentation should clarify why the rule is being disabled and why it is necessary in that specific situation. +* **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 + disable comment is revisited and resolved at a later stage. +* **Code Reviews and Pair Programming.** Encourage team members to review each other's code regularly. Code reviews can help + identify the reasons behind disable comments and ensure that they are used appropriately. +* **Configurations.** Whenever possible, prefer using ESLint configuration files over disable comments. Configuration + files allow for consistent and project-wide rule handling. + To disable rule warnings in a part of a file, use block comments in the following format: ```js