Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@Jagget
Copy link

@Jagget Jagget commented Oct 24, 2025


Closes #6438, #3682

Summary

Problem: When using alternative JSX libraries (Preact, Stencil, or custom JSX implementations) with the classic JSX runtime, Biome incorrectly reports custom JSX factory functions as unused imports.

// tsconfig.json
{
  "compilerOptions": {
    "jsx": "react",
    "jsxFactory": "h",
    "jsxFragmentFactory": "Fragment"
  }
}

// Component.jsx
import { h, Fragment } from 'preact';

function App() {
  return <div>Hello</div>;
}

Root cause: Biome only recognized the hardcoded identifiers when jsxRuntime is set to "reactClassic". It didn't read or respect the jsxFactory and jsxFragmentFactory settings from tsconfig.json.

Changeset

Added support for custom JSX factory functions when using the classic React runtime.

Test Plan

Tests added into "biome/crates/biome_js_analyze/tests/specs/correctness/noUnusedImports"

@changeset-bot
Copy link

changeset-bot bot commented Oct 24, 2025

⚠️ No Changeset found

Latest commit: c4bd356

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@github-actions github-actions bot added A-Project Area: project A-Linter Area: linter L-JavaScript Language: JavaScript and super languages labels Oct 24, 2025
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Oct 24, 2025

Walkthrough

This PR adds support for custom JSX factories and fragment factories (e.g., Preact's h) by threading jsx_factory and jsx_fragment_factory configuration through the analyser. The settings are read from tsconfig.json and propagated via AnalyzerOptions and RuleContext, allowing linting rules like noUnusedImports to correctly identify custom JSX factory imports as used rather than unused.

Possibly related PRs

Suggested labels

A-Linter, L-JavaScript, A-Diagnostic, A-Project

Suggested reviewers

  • arendjr
  • dyc3

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 56.76% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
βœ… Passed checks (4 passed)
Check name Status Explanation
Linked Issues Check βœ… Passed The PR successfully addresses the requirements from issue #6438. It prevents false positive noUnusedImports diagnostics for custom JSX factory imports by reading and respecting jsxFactory and jsxFragmentFactory from tsconfig.json when jsxRuntime is set to reactClassic. The implementation extends RuleContext, AnalyzerConfiguration, and lint rules to propagate these settings throughout the analysis pipeline. Custom JSX factories are now recognized via the is_jsx_factory_import helper, and the no_unused_imports rule has been updated to exempt these imports. Spec tests verify the Preact scenario works correctly.
Out of Scope Changes Check βœ… Passed All code changes are directly scoped to supporting custom JSX factory functionality. Modifications span the configuration layer (JsConfiguration, TsConfigJson parsing), the analysis context layer (RuleContext, AnalyzerConfiguration), the rule implementations (no_unused_imports, use_import_type), and supporting infrastructure (signals, registry, settings propagation). Each change serves the primary objective of reading, propagating, and respecting custom JSX factory identifiers from tsconfig.json. No unrelated refactoring, cleanup, or tangential changes are present.
Description Check βœ… Passed The description is well-structured and directly relates to the changeset. It clearly outlines the problem (false positives for custom JSX factory imports), the root cause (ignoring tsconfig JSX factory settings), and the solution provided. The description includes a concrete example with Preact, references the linked issues, and mentions that tests have been added. This provides meaningful context for understanding the changes.
Title Check βœ… Passed The title "feat(biome_js_analyze): custom jsxFactory and jsxFragmentFactory" directly and accurately summarizes the main change in this pull request. The changeset adds comprehensive support for custom JSX factory functions from tsconfig.json throughout the analyzer pipeline, preventing false positive unused import warnings when using libraries like Preact with the classic JSX runtime. The title is concise, uses conventional commit formatting, and is specific enough that a developer scanning the history would clearly understand the PR addresses custom JSX factory handling.
✨ Finishing touches
  • πŸ“ Generate docstrings
πŸ§ͺ Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❀️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
crates/biome_service/src/settings.rs (1)

1796-1819: Propagate factory settings in overrides too

Overrides currently merge only jsx_runtime; jsx_factory/jsx_fragment_factory are dropped, which can surprise users overriding per‑path settings.

Consider:

-    language_setting.environment.jsx_runtime =
-        conf.jsx_runtime.or(parent_settings.environment.jsx_runtime);
+    language_setting.environment.jsx_runtime =
+        conf.jsx_runtime.or(parent_settings.environment.jsx_runtime);
+    language_setting.environment.jsx_factory =
+        conf.jsx_factory.or_else(|| parent_settings.environment.jsx_factory.clone());
+    language_setting.environment.jsx_fragment_factory =
+        conf.jsx_fragment_factory.or_else(|| parent_settings.environment.jsx_fragment_factory.clone());
🧹 Nitpick comments (9)
crates/biome_js_analyze/src/react.rs (1)

338-345: Consider validating import source.

Unlike is_global_react_import (which checks declaration type and import source), this function only checks the binding name. This might match local variables with the same name as the factory.

If the JSX factory configuration expects imports from specific modules (e.g., 'preact'), consider adding source validation similar to is_global_react_import.

crates/biome_configuration/src/javascript/mod.rs (1)

48-60: JSX factory fields: good addition; consider normalising inputs

Two minor polish items:

  • Trim whitespace on values at read time to avoid config nits.
  • Clarify in rustdoc that these should be base identifiers (before any dot), since downstream code often expects that.

Happy path as-is; these are non-blocking.

crates/biome_js_analyze/tests/spec_tests.rs (1)

182-200: Avoid double tsconfig lookup and trim identifiers

  • Query tsconfig once and reuse for factory + fragment.
  • Trim the identifiers to be safe.

Example tweak:

-    if options.jsx_runtime() == Some(JsxRuntime::ReactClassic) {
-        if options.jsx_factory().is_none() {
-            let factory = project_layout.query_tsconfig_for_path(input_file, |tsconfig| {
-                tsconfig.jsx_factory_identifier().map(|s| s.to_string())
-            }).flatten();
-            options.set_jsx_factory(factory.map(|s| s.into()));
-        }
-        if options.jsx_fragment_factory().is_none() {
-            let fragment_factory = project_layout.query_tsconfig_for_path(input_file, |tsconfig| {
-                tsconfig.jsx_fragment_factory_identifier().map(|s| s.to_string())
-            }).flatten();
-            options.set_jsx_fragment_factory(fragment_factory.map(|s| s.into()));
-        }
-    }
+    if options.jsx_runtime() == Some(JsxRuntime::ReactClassic) {
+        if options.jsx_factory().is_none() || options.jsx_fragment_factory().is_none() {
+            if let Some(tsconfig) = project_layout.find_tsconfig_for_path(input_file) {
+                if options.jsx_factory().is_none() {
+                    let f = tsconfig.jsx_factory_identifier().map(|s| s.trim().to_string());
+                    options.set_jsx_factory(f.map(Into::into));
+                }
+                if options.jsx_fragment_factory().is_none() {
+                    let ff = tsconfig.jsx_fragment_factory_identifier().map(|s| s.trim().to_string());
+                    options.set_jsx_fragment_factory(ff.map(Into::into));
+                }
+            }
+        }
+    }
crates/biome_js_analyze/src/lint/correctness/no_unused_imports.rs (1)

626-642: Nice exemption for custom JSX factories; consider sharing helper

Logic is sound and fixes the false positives. To DRY with use_import_type, extract a shared helper (e.g. react::is_jsx_factory_binding(binding, ctx)) so both rules stay in lockstep when this grows.

crates/biome_analyze/src/context.rs (1)

164-172: Doc nudge: clarify expected shape of identifiers

Please mention these are base identifiers (pre‑dot), e.g. β€œReact” not β€œReact.createElement”, matching what services/options pass in. Keeps invariants obvious for rule authors.

crates/biome_service/src/file_handlers/javascript.rs (1)

346-359: Minor normalisation: trim and gate by runtime

Two tiny tweaks:

  • Trim before split to avoid stray spaces.
  • Optionally only forward factories when runtime is ReactClassic (purely to reduce surprise).

Example:

-        let jsx_factory = environment
+        let jsx_factory = (matches!(jsx_runtime, biome_analyze::options::JsxRuntime::ReactClassic))
+            .then_some(environment)
             .and_then(|env| env.jsx_factory.as_ref())
-            .and_then(|factory| factory.split('.').next())
+            .map(|s| s.trim())
+            .and_then(|factory| factory.split('.').next())
             .map(|s| s.into());
-        let jsx_fragment_factory = environment
+        let jsx_fragment_factory = (matches!(jsx_runtime, biome_analyze::options::JsxRuntime::ReactClassic))
+            .then_some(environment)
             .and_then(|env| env.jsx_fragment_factory.as_ref())
-            .and_then(|factory| factory.split('.').next())
+            .map(|s| s.trim())
+            .and_then(|factory| factory.split('.').next())
             .map(|s| s.into());
crates/biome_package/src/node_js_package/tsconfig_json.rs (1)

120-136: Trim before splitting to be tolerant of whitespace

A tiny guard improves resilience:

-    pub fn jsx_factory_identifier(&self) -> Option<&str> {
-        self.compiler_options
-            .jsx_factory
-            .as_ref()
-            .map(|factory| factory.split('.').next().unwrap_or(factory.as_str()))
-    }
+    pub fn jsx_factory_identifier(&self) -> Option<&str> {
+        self.compiler_options.jsx_factory.as_deref().map(|factory| {
+            let f = factory.trim();
+            f.split('.').next().unwrap_or(f)
+        })
+    }

Apply the same to jsx_fragment_factory_identifier.

crates/biome_js_analyze/src/lint/style/use_import_type.rs (1)

1101-1129: Centralise is_jsx_factory_binding to avoid drift

Great extraction. Consider moving this to crate::react (public helper) so both this rule and noUnusedImports share one source of truth for JSX‑factory recognition. Less chance of future divergence.

crates/biome_analyze/src/options.rs (1)

179-193: Consider adding rustdoc and reordering methods.

Two suggestions to improve maintainability:

  1. Missing rustdoc comments: Per the coding guidelines, "Document rules, assists, and options with inline rustdoc in source". These public API methods should have doc comments explaining their purpose and return values.

  2. Method ordering: Grouping each field's getter and setter together would improve readability. Current order (jsx_factory getter β†’ factory setter β†’ fragment setter β†’ fragment getter) is a bit unusual.

Example improvement:

+    /// Returns the configured JSX factory identifier, if any (e.g., "h" for Preact).
     pub fn jsx_factory(&self) -> Option<&str> {
         self.configuration.jsx_factory.as_deref()
     }
 
+    /// Sets the JSX factory identifier for the classic JSX runtime.
     pub fn set_jsx_factory(&mut self, jsx_factory: Option<Box<str>>) {
         self.configuration.jsx_factory = jsx_factory;
     }
 
-    pub fn set_jsx_fragment_factory(&mut self, jsx_fragment_factory: Option<Box<str>>) {
-        self.configuration.jsx_fragment_factory = jsx_fragment_factory;
-    }
-
+    /// Returns the configured JSX fragment factory identifier, if any (e.g., "Fragment").
     pub fn jsx_fragment_factory(&self) -> Option<&str> {
         self.configuration.jsx_fragment_factory.as_deref()
     }
+
+    /// Sets the JSX fragment factory identifier for the classic JSX runtime.
+    pub fn set_jsx_fragment_factory(&mut self, jsx_fragment_factory: Option<Box<str>>) {
+        self.configuration.jsx_fragment_factory = jsx_fragment_factory;
+    }
πŸ“œ Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

πŸ“₯ Commits

Reviewing files that changed from the base of the PR and between 72afdfa and b219942.

β›” Files ignored due to path filters (1)
  • crates/biome_js_analyze/tests/specs/correctness/noUnusedImports/jsxFactoryPreact.js.snap is excluded by !**/*.snap and included by **
πŸ“’ Files selected for processing (17)
  • crates/biome_analyze/src/context.rs (4 hunks)
  • crates/biome_analyze/src/options.rs (3 hunks)
  • crates/biome_analyze/src/registry.rs (2 hunks)
  • crates/biome_analyze/src/signals.rs (3 hunks)
  • crates/biome_configuration/src/javascript/mod.rs (1 hunks)
  • crates/biome_js_analyze/src/lint/correctness/no_unused_imports.rs (2 hunks)
  • crates/biome_js_analyze/src/lint/style/use_import_type.rs (6 hunks)
  • crates/biome_js_analyze/src/react.rs (1 hunks)
  • crates/biome_js_analyze/tests/quick_test.rs (1 hunks)
  • crates/biome_js_analyze/tests/spec_tests.rs (1 hunks)
  • crates/biome_js_analyze/tests/specs/correctness/noUnusedImports/jsxFactoryPreact.js (1 hunks)
  • crates/biome_js_analyze/tests/specs/correctness/noUnusedImports/jsxFactoryPreact.options.json (1 hunks)
  • crates/biome_js_analyze/tests/specs/correctness/noUnusedImports/jsxFactoryPreact.tsconfig.json (1 hunks)
  • crates/biome_package/src/node_js_package/tsconfig_json.rs (2 hunks)
  • crates/biome_service/src/file_handlers/javascript.rs (2 hunks)
  • crates/biome_service/src/file_handlers/mod.rs (1 hunks)
  • crates/biome_service/src/settings.rs (1 hunks)
🧰 Additional context used
πŸ““ Path-based instructions (5)
crates/biome_*/**

πŸ“„ CodeRabbit inference engine (CLAUDE.md)

Place core crates under /crates/biome_*/

Files:

  • crates/biome_analyze/src/registry.rs
  • crates/biome_js_analyze/src/react.rs
  • crates/biome_service/src/settings.rs
  • crates/biome_js_analyze/tests/specs/correctness/noUnusedImports/jsxFactoryPreact.tsconfig.json
  • crates/biome_js_analyze/src/lint/correctness/no_unused_imports.rs
  • crates/biome_analyze/src/signals.rs
  • crates/biome_configuration/src/javascript/mod.rs
  • crates/biome_package/src/node_js_package/tsconfig_json.rs
  • crates/biome_js_analyze/tests/specs/correctness/noUnusedImports/jsxFactoryPreact.js
  • crates/biome_service/src/file_handlers/mod.rs
  • crates/biome_js_analyze/tests/specs/correctness/noUnusedImports/jsxFactoryPreact.options.json
  • crates/biome_js_analyze/tests/spec_tests.rs
  • crates/biome_js_analyze/tests/quick_test.rs
  • crates/biome_analyze/src/options.rs
  • crates/biome_analyze/src/context.rs
  • crates/biome_service/src/file_handlers/javascript.rs
  • crates/biome_js_analyze/src/lint/style/use_import_type.rs
**/*.rs

πŸ“„ CodeRabbit inference engine (CONTRIBUTING.md)

**/*.rs: Format Rust files before committing (e.g., via just f which formats Rust)
Document rules, assists, and options with inline rustdoc in source

Files:

  • crates/biome_analyze/src/registry.rs
  • crates/biome_js_analyze/src/react.rs
  • crates/biome_service/src/settings.rs
  • crates/biome_js_analyze/src/lint/correctness/no_unused_imports.rs
  • crates/biome_analyze/src/signals.rs
  • crates/biome_configuration/src/javascript/mod.rs
  • crates/biome_package/src/node_js_package/tsconfig_json.rs
  • crates/biome_service/src/file_handlers/mod.rs
  • crates/biome_js_analyze/tests/spec_tests.rs
  • crates/biome_js_analyze/tests/quick_test.rs
  • crates/biome_analyze/src/options.rs
  • crates/biome_analyze/src/context.rs
  • crates/biome_service/src/file_handlers/javascript.rs
  • crates/biome_js_analyze/src/lint/style/use_import_type.rs
crates/biome_*_{syntax,parser,formatter,analyze,factory,semantic}/**

πŸ“„ CodeRabbit inference engine (CLAUDE.md)

Maintain the per-language crate structure: biome_{lang}_{syntax,parser,formatter,analyze,factory,semantic}

Files:

  • crates/biome_js_analyze/src/react.rs
  • crates/biome_js_analyze/tests/specs/correctness/noUnusedImports/jsxFactoryPreact.tsconfig.json
  • crates/biome_js_analyze/src/lint/correctness/no_unused_imports.rs
  • crates/biome_js_analyze/tests/specs/correctness/noUnusedImports/jsxFactoryPreact.js
  • crates/biome_js_analyze/tests/specs/correctness/noUnusedImports/jsxFactoryPreact.options.json
  • crates/biome_js_analyze/tests/spec_tests.rs
  • crates/biome_js_analyze/tests/quick_test.rs
  • crates/biome_js_analyze/src/lint/style/use_import_type.rs
**/tests/**

πŸ“„ CodeRabbit inference engine (CLAUDE.md)

Place test files under a tests/ directory in each crate

Files:

  • crates/biome_js_analyze/tests/specs/correctness/noUnusedImports/jsxFactoryPreact.tsconfig.json
  • crates/biome_js_analyze/tests/specs/correctness/noUnusedImports/jsxFactoryPreact.js
  • crates/biome_js_analyze/tests/specs/correctness/noUnusedImports/jsxFactoryPreact.options.json
  • crates/biome_js_analyze/tests/spec_tests.rs
  • crates/biome_js_analyze/tests/quick_test.rs
crates/biome_configuration/src/**

πŸ“„ CodeRabbit inference engine (CLAUDE.md)

Keep configuration sources under biome_configuration/src/

Files:

  • crates/biome_configuration/src/javascript/mod.rs
🧠 Learnings (3)
πŸ“š Learning: 2025-10-15T09:20:19.139Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-10-15T09:20:19.139Z
Learning: Applies to crates/biome_analyze/**/lib/src/{lint,assist}/**/*.rs : Retrieve rule options via ctx.options() inside rules; do not manually handle overrides/extends resolution

Applied to files:

  • crates/biome_analyze/src/registry.rs
πŸ“š Learning: 2025-10-15T09:20:19.139Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-10-15T09:20:19.139Z
Learning: Applies to crates/biome_analyze/**/lib/src/{lint,assist}/**/*.rs : Set the language field in declare_lint_rule! to the most specific applicable language (js, jsx, ts, or tsx)

Applied to files:

  • crates/biome_service/src/settings.rs
  • crates/biome_service/src/file_handlers/mod.rs
πŸ“š Learning: 2025-10-15T09:20:19.139Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-10-15T09:20:19.139Z
Learning: Applies to crates/biome_analyze/**/tests/quick_test.rs : Use the quick test at biome_js_analyze/tests/quick_test.rs by un-ignoring and adjusting SOURCE and RuleFilter for ad-hoc checks

Applied to files:

  • crates/biome_js_analyze/tests/quick_test.rs
🧬 Code graph analysis (10)
crates/biome_analyze/src/registry.rs (2)
crates/biome_analyze/src/context.rs (2)
  • jsx_factory (165-167)
  • jsx_fragment_factory (170-172)
crates/biome_analyze/src/options.rs (2)
  • jsx_factory (179-181)
  • jsx_fragment_factory (191-193)
crates/biome_service/src/settings.rs (2)
crates/biome_analyze/src/context.rs (3)
  • jsx_runtime (160-162)
  • jsx_factory (165-167)
  • jsx_fragment_factory (170-172)
crates/biome_analyze/src/options.rs (3)
  • jsx_runtime (175-177)
  • jsx_factory (179-181)
  • jsx_fragment_factory (191-193)
crates/biome_js_analyze/src/lint/correctness/no_unused_imports.rs (2)
crates/biome_js_analyze/src/react.rs (2)
  • is_global_react_import (305-336)
  • is_jsx_factory_import (341-345)
crates/biome_analyze/src/context.rs (2)
  • jsx_factory (165-167)
  • jsx_fragment_factory (170-172)
crates/biome_service/src/file_handlers/mod.rs (3)
crates/biome_service/src/settings.rs (1)
  • analyzer_options (1119-1139)
crates/biome_analyze/src/context.rs (1)
  • options (155-157)
packages/@biomejs/backend-jsonrpc/src/workspace.ts (1)
  • JsxRuntime (701-701)
crates/biome_js_analyze/tests/spec_tests.rs (2)
packages/@biomejs/backend-jsonrpc/src/workspace.ts (1)
  • JsxRuntime (701-701)
crates/biome_js_analyze/src/services/module_graph.rs (1)
  • project_layout (23-25)
crates/biome_js_analyze/tests/quick_test.rs (5)
packages/@biomejs/backend-jsonrpc/src/workspace.ts (4)
  • JsFileSource (9483-9492)
  • TextRange (9327-9327)
  • JsxRuntime (701-701)
  • Severity (9308-9308)
crates/biome_js_syntax/src/file_source.rs (1)
  • jsx (168-170)
crates/biome_analyze/src/context.rs (3)
  • file_path (187-189)
  • new (33-65)
  • options (155-157)
crates/biome_js_analyze/src/lib.rs (1)
  • analyze (188-209)
crates/biome_diagnostics/src/lib.rs (1)
  • print_diagnostic_to_string (85-103)
crates/biome_analyze/src/options.rs (1)
crates/biome_analyze/src/context.rs (2)
  • jsx_factory (165-167)
  • jsx_fragment_factory (170-172)
crates/biome_analyze/src/context.rs (1)
crates/biome_analyze/src/options.rs (2)
  • jsx_factory (179-181)
  • jsx_fragment_factory (191-193)
crates/biome_service/src/file_handlers/javascript.rs (3)
packages/@biomejs/backend-jsonrpc/src/workspace.ts (1)
  • JsxRuntime (701-701)
crates/biome_analyze/src/context.rs (3)
  • jsx_runtime (160-162)
  • jsx_factory (165-167)
  • jsx_fragment_factory (170-172)
crates/biome_analyze/src/options.rs (4)
  • jsx_runtime (175-177)
  • jsx_factory (179-181)
  • jsx_fragment_factory (191-193)
  • configuration (199-201)
crates/biome_js_analyze/src/lint/style/use_import_type.rs (3)
crates/biome_js_analyze/src/react.rs (2)
  • is_global_react_import (305-336)
  • is_jsx_factory_import (341-345)
packages/@biomejs/backend-jsonrpc/src/workspace.ts (1)
  • JsxRuntime (701-701)
crates/biome_analyze/src/context.rs (2)
  • jsx_factory (165-167)
  • jsx_fragment_factory (170-172)
πŸ”‡ Additional comments (13)
crates/biome_service/src/file_handlers/mod.rs (1)

1630-1647: Well-structured tsconfig integration.

The logic correctly queries tsconfig.json for JSX factory settings only when needed (ReactClassic runtime, factories not already set). The defensive checks and use of flatten() are appropriate.

crates/biome_analyze/src/registry.rs (2)

409-410: LGTM.

Consistent with the existing pattern for extracting options.


424-425: LGTM.

Correctly threads JSX factory options through to RuleContext.

crates/biome_js_analyze/tests/specs/correctness/noUnusedImports/jsxFactoryPreact.js (1)

1-10: Good test fixture for Preact JSX support.

The test case appropriately demonstrates custom JSX factory usage with Preact's h and Fragment.

crates/biome_js_analyze/tests/specs/correctness/noUnusedImports/jsxFactoryPreact.options.json (1)

1-6: LGTM.

Correctly configures ReactClassic runtime for the test scenario.

crates/biome_js_analyze/tests/specs/correctness/noUnusedImports/jsxFactoryPreact.tsconfig.json (1)

1-8: LGTM.

Standard Preact configuration demonstrating the feature.

crates/biome_analyze/src/signals.rs (3)

373-374: LGTM.

Correctly propagates JSX factory options to RuleContext in the diagnostic path.


412-413: LGTM.

Consistent with the diagnostic path.


479-480: LGTM.

Completes the JSX factory propagation across all execution paths.

crates/biome_js_analyze/tests/quick_test.rs (1)

99-157: Solid test coverage for JSX factory support.

The test clearly demonstrates that custom JSX factories (h, Fragment) are correctly recognised as used when configured via ReactClassic runtime options.

crates/biome_service/src/settings.rs (1)

500-510: Environment wiring for JSX factories looks right

The environment now carries jsx_runtime + factory fields; aligns with downstream usage. No blockers here.

crates/biome_analyze/src/options.rs (2)

78-82: LGTM!

The field declarations are well-commented and use appropriate types for optional JSX factory configuration.


104-112: LGTM!

The builder methods follow the established pattern and enable fluent configuration chaining.

@Jagget Jagget changed the title feat(6438): custom jsxFactory and jsxFragmentFactory feat(biome_js_analyze): custom jsxFactory and jsxFragmentFactory Oct 25, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-Linter Area: linter A-Project Area: project L-JavaScript Language: JavaScript and super languages

Projects

None yet

Development

Successfully merging this pull request may close these issues.

πŸ’… Biome 2.0 with JSX h factory that comes NOT from React

1 participant