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
Copy file name to clipboardExpand all lines: crates/biome_analyze/CONTRIBUTING.md
+23Lines changed: 23 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -516,6 +516,28 @@ declare_lint_rule! {
516
516
}
517
517
```
518
518
519
+
#### Rule group and severity
520
+
521
+
> [!NOTE]
522
+
> This section is relevant to Biome maintainers when they want to move (promote) a rule to a group that is not `nursery`.
523
+
524
+
We try to maintain consistency in the default severity level and group membership of the rules.
525
+
For legacy reasons, we have some rules that don't follow these constraints.
526
+
527
+
-`correctness`, `security`, and `a11y` rules **must** have a severity set to `error`.
528
+
529
+
If `error` is too strict for a rule, then it should certainly be in another group (for example `suspicious` instead of `correctness`).
530
+
531
+
-`style` rules **must** have a severity set to `info` or `warn`. If in doubt, choose `info`.
532
+
533
+
-`complexity` rules **must** have a severity set to `warn` or `info`. If in doubt, choose `info`.
534
+
535
+
-`suspicious` rules **must** have a severity set to `warn` or `error`. If in doubt, choose `warn`.
536
+
537
+
-`performance` rules **must** have a severity set to `warn`.
538
+
539
+
- Actions **must** have a severity set to `info`.
540
+
519
541
#### Rule domains
520
542
521
543
Domains are very specific ways to collect rules that belong to the same "concept". Domains are a way for users to opt-in/opt-out rules that belong to the same domain.
@@ -548,6 +570,7 @@ Instead, if the rule is **recommended** but _doesn't have domains_, the rule is
548
570
> [!NOTE]
549
571
> Before adding a new domain, please consult with the maintainers of the project.
550
572
573
+
551
574
#### Rule Options
552
575
553
576
Some rules may allow customization [using per-rule options in `biome.json`](https://biomejs.dev/linter/#rule-options).
"The rule '{rule_name}' belongs to the group '{group}' and has a severity set to '{rule_severity}'. Rules that belong to the group {group} must have a severity set to 'error'. Set the severity to 'error' or change the group of the rule."
"The rule '{rule_name}' belongs to the group '{group}' and has a severity set to '{rule_severity}'. Rules that belong to the group '{group}' must not have a severity set to 'error'. Lower down the severity or change the group of the rule."
"The rule '{rule_name}' belongs to the group '{group}' and has a severity set to '{rule_severity}'. Rules that belong to the group '{group}' must have a severity set to 'warn'. Set the severity to 'warn' or change the group of the rule."
113
+
)));
114
+
}elseif group == "suspicious"
115
+
&& rule_severity == Severity::Information
116
+
&& !matches!(
117
+
rule_name,
118
+
// Legacy exceptions (severity set to 'info')
119
+
"noAlert"
120
+
| "noBitwiseOperators"
121
+
| "noConstantBinaryExpressions"
122
+
| "noUnassignedVariables"
123
+
| "useStaticResponseMethods"
124
+
| "noQuickfixBiome"
125
+
| "noDuplicateFields"
126
+
)
127
+
{
128
+
self.errors.push(Errors::new(format!(
129
+
"The rule '{rule_name}' belongs to the group '{group}' and has a severity set to '{rule_severity}'. Rules that belong to the group '{group}' must have a severity set to 'warn' or 'error'. Change the severity or change the group of the rule."
"The action '{rule_name}' has a severity set to '{rule_severity}'. Actions must have a severity set to 'info'. Set the severity of the rule to 'info'."
0 commit comments