Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/crazy-steaks-mix.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@biomejs/biome": minor
---

The rules in a domain are no longer enabled automatically by the installed dependencies unless the rule is recommended.
12 changes: 12 additions & 0 deletions .changeset/seven-beans-cough.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
---
"@biomejs/biome": minor
---

The following rules are now a part of the `react` domain, and they won't be enabled automatically unless you enabled the domain, or Biome detects `react` as a dependency of your closest `package.json`:

- [`lint/correctness/noChildrenProp`](https://biomejs.dev/linter/rules/no-children-prop/) (recommended)
- [`lint/correctness/noReactPropAssignments`](https://biomejs.dev/linter/rules/no-react-prop-assignments/)
- [`lint/security/noDangerouslySetInnerHtml`](https://biomejs.dev/linter/rules/no-dangerously-set-inner-html/) (recommended)
- [`lint/security/noDangerouslySetInnerHtmlWithChildren`](https://biomejs.dev/linter/rules/no-dangerously-set-inner-html-with-children/) (recommended)
- [`lint/style/useComponentExportOnlyModules`](https://biomejs.dev/linter/rules/use-component-export-only-modules/)
- [`lint/suspicious/noArrayIndexKey`](https://biomejs.dev/linter/rules/no-array-index-key/) (recommended)
4 changes: 0 additions & 4 deletions crates/biome_configuration/src/analyzer/linter/rules.rs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions crates/biome_configuration/src/generated/domain_selector.rs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
use crate::react::{ReactApiCall, ReactCreateElementCall};
use crate::services::semantic::Semantic;
use biome_analyze::context::RuleContext;
use biome_analyze::{Rule, RuleDiagnostic, RuleSource, declare_lint_rule};
use biome_analyze::{Rule, RuleDiagnostic, RuleDomain, RuleSource, declare_lint_rule};
use biome_console::markup;
use biome_diagnostics::Severity;
use biome_js_syntax::{JsCallExpression, JsxAttribute};
use biome_rowan::{AstNode, TextRange, declare_node_union};
use biome_rule_options::no_children_prop::NoChildrenPropOptions;

declare_lint_rule! {
/// Prevent passing of **children** as props.
///
Expand All @@ -29,6 +30,7 @@ declare_lint_rule! {
name: "noChildrenProp",
language: "jsx",
sources: &[RuleSource::EslintReact("no-children-prop").same()],
domains: &[RuleDomain::React],
recommended: true,
severity: Severity::Error,
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@ use crate::react::components::{
AnyPotentialReactComponentDeclaration, ReactComponentInfo, ReactComponentKind,
};
use crate::services::semantic::Semantic;
use biome_analyze::{Rule, RuleDiagnostic, RuleSource, context::RuleContext, declare_lint_rule};
use biome_analyze::{
Rule, RuleDiagnostic, RuleDomain, RuleSource, context::RuleContext, declare_lint_rule,
};
use biome_console::markup;
use biome_js_semantic::SemanticModel;
use biome_js_syntax::{AnyJsExpression, AnyJsStatement, JsParameterList};
Expand Down Expand Up @@ -42,6 +44,7 @@ declare_lint_rule! {
name: "noReactPropAssignments",
language: "jsx",
sources: &[RuleSource::EslintReactHooks("react-compiler").same()],
domains: &[RuleDomain::React],
recommended: false,
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use crate::react::ReactCreateElementCall;
use crate::services::semantic::Semantic;
use biome_analyze::context::RuleContext;
use biome_analyze::{Rule, RuleDiagnostic, RuleSource, declare_lint_rule};
use biome_analyze::{Rule, RuleDiagnostic, RuleDomain, RuleSource, declare_lint_rule};
use biome_console::markup;
use biome_diagnostics::Severity;
use biome_js_syntax::{AnyJsxAttributeName, JsCallExpression, JsxAttribute};
Expand Down Expand Up @@ -32,6 +32,7 @@ declare_lint_rule! {
name: "noDangerouslySetInnerHtml",
language: "jsx",
sources: &[RuleSource::EslintReact("no-danger").same()],
domains: &[RuleDomain::React],
recommended: true,
severity: Severity::Error,
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use crate::react::{ReactApiCall, ReactCreateElementCall};
use crate::services::semantic::Semantic;
use biome_analyze::context::RuleContext;
use biome_analyze::{Rule, RuleDiagnostic, RuleSource, declare_lint_rule};
use biome_analyze::{Rule, RuleDiagnostic, RuleDomain, RuleSource, declare_lint_rule};
use biome_console::markup;
use biome_diagnostics::Severity;
use biome_js_semantic::SemanticModel;
Expand Down Expand Up @@ -41,6 +41,7 @@ declare_lint_rule! {
name: "noDangerouslySetInnerHtmlWithChildren",
language: "jsx",
sources: &[RuleSource::EslintReact("no-danger-with-children").same()],
domains: &[RuleDomain::React],
recommended: true,
severity: Severity::Error,
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use crate::react::components::ReactComponentInfo;
use biome_analyze::{
Ast, Rule, RuleDiagnostic, RuleSource, context::RuleContext, declare_lint_rule,
Ast, Rule, RuleDiagnostic, RuleDomain, RuleSource, context::RuleContext, declare_lint_rule,
};
use biome_console::markup;
use biome_diagnostics::Severity;
Expand Down Expand Up @@ -101,6 +101,7 @@ declare_lint_rule! {
name: "useComponentExportOnlyModules",
language: "jsx",
sources: &[RuleSource::EslintReactRefresh("only-export-components").inspired()],
domains: &[RuleDomain::React],
recommended: false,
severity: Severity::Warning,
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use crate::react::{ReactLibrary, is_react_call_api};
use crate::services::semantic::Semantic;
use biome_analyze::context::RuleContext;
use biome_analyze::{Rule, RuleDiagnostic, RuleSource, declare_lint_rule};
use biome_analyze::{Rule, RuleDiagnostic, RuleDomain, RuleSource, declare_lint_rule};
use biome_console::markup;
use biome_diagnostics::Severity;
use biome_js_syntax::{
Expand Down Expand Up @@ -70,6 +70,7 @@ declare_lint_rule! {
name: "noArrayIndexKey",
language: "jsx",
sources: &[RuleSource::EslintReact("no-array-index-key").same()],
domains: &[RuleDomain::React],
recommended: true,
severity: Severity::Error,
}
Expand Down
3 changes: 2 additions & 1 deletion crates/biome_service/src/file_handlers/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1036,8 +1036,9 @@ impl<'a, 'b> LintVisitor<'a, 'b> {

let path = self.path.expect("File path");

let is_recommended = R::METADATA.recommended;
let recommended_enabled = self.settings.linter_recommended_enabled();
if !recommended_enabled {
if !is_recommended || !recommended_enabled {
return;
}

Expand Down