Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: advice for inline disabling of rules #17458

Merged
merged 4 commits into from Aug 22, 2023
Merged
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
12 changes: 12 additions & 0 deletions docs/src/use/configure/rules.md
Expand Up @@ -144,6 +144,18 @@ 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**: Developers should provide a comment explaining the reason for disabling a particular rule. This
documentation should clarify why the rule is being disabled and why it is necessary in that specific situation.
* **Temporary Solutions**: If a disabled comment is added as a temporary measure to address a pressing issue, developers
should also create a follow-up task or ticket to address the underlying problem adequately. This ensures that the
disabled 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 disabling comments and ensure that they are used appropriately.
* **Configurations**: Whenever possible, prefer using ESLint configuration settings over disabled comments. Configuration
files allow for consistent and project-wide rule handling.

nzakas marked this conversation as resolved.
Show resolved Hide resolved
To disable rule warnings in a part of a file, use block comments in the following format:

```js
Expand Down