fix(semantic): resolve Svelte $store references in semantic model#9286
fix(semantic): resolve Svelte $store references in semantic model#9286dyc3 merged 12 commits intobiomejs:mainfrom
Conversation
🦋 Changeset detectedLatest commit: 2f82602 The changes in this PR will be included in the next version bump. This PR includes changesets to release 13 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
1ae1ed3 to
0d2ff9b
Compare
|
(this is just some targetted tests for now, not ready for review, I'd prefer a real "semantic" resolution over the current monkey patch of this PR, trying to see how big a proper fix would be) |
0d2ff9b to
030813d
Compare
|
@dyc3 Also, as a side-note, running |
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
WalkthroughIntroduces a SemanticFlavor (Vanilla | Svelte) and threads it through semantic model construction, the semantic event extractor and builder, and document/snippet services. Adds Svelte-aware logic to resolve Possibly related PRs
Suggested labels
Suggested reviewers
🚥 Pre-merge checks | ✅ 4✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (4)
crates/biome_service/src/file_handlers/html.rs (1)
924-928: Recommended DRY pass: centralise flavour-aware JS service creation.Both blocks now do the same flavour derivation +
with_js_semantic_modeldance; a shared helper would reduce drift risk.Also applies to: 1010-1017
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@crates/biome_service/src/file_handlers/html.rs` around lines 924 - 928, Duplicate logic computing a SemanticFlavor and creating a JsDocumentServices with that flavor should be extracted into a single helper (e.g., a function like js_services_for or create_flavored_js_services) that takes the inputs used above (the file_source, path, and snippet/tree) and returns the JsDocumentServices instance; replace both usages that call SemanticFlavor::from_source_type_and_path(...) followed by JsDocumentServices::default().with_js_semantic_model(&snippet.tree(), flavor).into() with calls to the new helper to centralize flavor derivation and with_js_semantic_model invocation.crates/biome_service/src/file_handlers/javascript.rs (1)
864-872: Optional: extract a shared helper for flavour-awaresemantic_modelcreation.Both call sites build the same
SemanticModelOptionspattern; centralising it would keep future tweaks in one place.Also applies to: 1315-1327
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@crates/biome_service/src/file_handlers/javascript.rs` around lines 864 - 872, Extract a small helper (e.g., fn semantic_options_for_path(path: &BiomePath) -> SemanticModelOptions) that builds SemanticModelOptions with flavor set via SemanticFlavor::from_file_path(path.as_path().as_str()) and default for other fields, then replace the duplicated option construction in debug_semantic_model and the other call site (around the 1315-1327 block) to call this helper when invoking semantic_model; keep function name and visibility local/private to the module.crates/biome_js_semantic/src/semantic_model/tests.rs (1)
293-390: Optional tidy-up: extract a tiny Svelte-model test helper.The repeated
SemanticModelOptions { flavor: SemanticFlavor::Svelte, .. }setup could be centralised to keep these tests leaner as the matrix grows.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@crates/biome_js_semantic/src/semantic_model/tests.rs` around lines 293 - 390, Summarize repeated setup and add a small test helper: many tests repeatedly construct SemanticModelOptions { flavor: SemanticFlavor::Svelte, ..SemanticModelOptions::default() } before calling semantic_model; extract that into a helper like fn svelte_options() -> SemanticModelOptions (or svelte_options_with_globals(globals: impl IntoIterator<Item=String>) if needed) that returns the same configured SemanticModelOptions, then replace the inline constructions in tests such as ok_semantic_model_svelte_rune_is_not_normalized_as_store, ok_semantic_model_svelte_dollar_identifier_binding_uses_exact_name, ok_semantic_model_svelte_store_dereference_can_resolve_outer_value_binding, ok_semantic_model_svelte_store_dereference_resolves_configured_global, ok_semantic_model_svelte_double_dollar_reference_is_not_normalized with calls to svelte_options() (and add globals to the returned options where the test inserts into options.globals).crates/biome_cli/tests/cases/handle_svelte_files.rs (1)
560-637: Consider a small table-driven helper for these three tests.Same steps, different fixture payloads — a helper would trim duplication and keep future additions painless.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@crates/biome_cli/tests/cases/handle_svelte_files.rs` around lines 560 - 637, These three tests (no_undeclared_variables_handles_svelte_store_dereference, no_undeclared_variables_handles_svelte_module_store_dereference, no_undeclared_variables_handles_svelte_module_type_only_store_dereference) duplicate the same setup and assertions; refactor into a small table-driven helper that takes the fixture path/name and the fixture contents constant (SVELTE_STORE_DEREFERENCE_FILE, SVELTE_MODULE_STORE_DEREFERENCE_FILE, SVELTE_MODULE_TYPE_ONLY_STORE_DEREFERENCE_FILE), calls the common setup (MemoryFileSystem::default, BufferConsole::default, inserts the file, calls run_cli with Args::from([... "lint", "--only=noUndeclaredVariables", file.as_str()])), asserts result.is_err(), and calls assert_cli_snapshot with the expected snapshot name; then replace each test with a one-liner that invokes the helper (or iterate a vec of (snapshot_name, file_name, fixture_const) and run the same assertions) while keeping run_cli, Args, and assert_cli_snapshot usage identical.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@crates/biome_js_semantic/src/events.rs`:
- Around line 1114-1126: The branch detecting namespace imports used as types
(JsSyntaxKind::JS_NAMESPACE_IMPORT_SPECIFIER && matches!(&name,
BindingName::Type(_))) correctly pushes a SemanticEvent::UnresolvedReference but
then falls through and later also emits Read/HoistedRead for the same usage;
change the control flow in the loop handling references (the surrounding
iterator/loop where reference is processed) so that after calling
self.stash.push_back(SemanticEvent::UnresolvedReference { is_read:
!reference.is_write(), range: reference.range() }) you immediately skip further
processing for that reference (e.g., add a continue or otherwise return from
that branch) to avoid emitting duplicate/conflicting Read/HoistedRead events.
Ensure the short-circuit is placed within the same scope that contains the
existing push_back so only that reference is affected.
---
Nitpick comments:
In `@crates/biome_cli/tests/cases/handle_svelte_files.rs`:
- Around line 560-637: These three tests
(no_undeclared_variables_handles_svelte_store_dereference,
no_undeclared_variables_handles_svelte_module_store_dereference,
no_undeclared_variables_handles_svelte_module_type_only_store_dereference)
duplicate the same setup and assertions; refactor into a small table-driven
helper that takes the fixture path/name and the fixture contents constant
(SVELTE_STORE_DEREFERENCE_FILE, SVELTE_MODULE_STORE_DEREFERENCE_FILE,
SVELTE_MODULE_TYPE_ONLY_STORE_DEREFERENCE_FILE), calls the common setup
(MemoryFileSystem::default, BufferConsole::default, inserts the file, calls
run_cli with Args::from([... "lint", "--only=noUndeclaredVariables",
file.as_str()])), asserts result.is_err(), and calls assert_cli_snapshot with
the expected snapshot name; then replace each test with a one-liner that invokes
the helper (or iterate a vec of (snapshot_name, file_name, fixture_const) and
run the same assertions) while keeping run_cli, Args, and assert_cli_snapshot
usage identical.
In `@crates/biome_js_semantic/src/semantic_model/tests.rs`:
- Around line 293-390: Summarize repeated setup and add a small test helper:
many tests repeatedly construct SemanticModelOptions { flavor:
SemanticFlavor::Svelte, ..SemanticModelOptions::default() } before calling
semantic_model; extract that into a helper like fn svelte_options() ->
SemanticModelOptions (or svelte_options_with_globals(globals: impl
IntoIterator<Item=String>) if needed) that returns the same configured
SemanticModelOptions, then replace the inline constructions in tests such as
ok_semantic_model_svelte_rune_is_not_normalized_as_store,
ok_semantic_model_svelte_dollar_identifier_binding_uses_exact_name,
ok_semantic_model_svelte_store_dereference_can_resolve_outer_value_binding,
ok_semantic_model_svelte_store_dereference_resolves_configured_global,
ok_semantic_model_svelte_double_dollar_reference_is_not_normalized with calls to
svelte_options() (and add globals to the returned options where the test inserts
into options.globals).
In `@crates/biome_service/src/file_handlers/html.rs`:
- Around line 924-928: Duplicate logic computing a SemanticFlavor and creating a
JsDocumentServices with that flavor should be extracted into a single helper
(e.g., a function like js_services_for or create_flavored_js_services) that
takes the inputs used above (the file_source, path, and snippet/tree) and
returns the JsDocumentServices instance; replace both usages that call
SemanticFlavor::from_source_type_and_path(...) followed by
JsDocumentServices::default().with_js_semantic_model(&snippet.tree(),
flavor).into() with calls to the new helper to centralize flavor derivation and
with_js_semantic_model invocation.
In `@crates/biome_service/src/file_handlers/javascript.rs`:
- Around line 864-872: Extract a small helper (e.g., fn
semantic_options_for_path(path: &BiomePath) -> SemanticModelOptions) that builds
SemanticModelOptions with flavor set via
SemanticFlavor::from_file_path(path.as_path().as_str()) and default for other
fields, then replace the duplicated option construction in debug_semantic_model
and the other call site (around the 1315-1327 block) to call this helper when
invoking semantic_model; keep function name and visibility local/private to the
module.
ℹ️ Review info
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (9)
crates/biome_cli/tests/snapshots/main_cases_handle_svelte_files/no_undeclared_variables_handles_svelte_module_store_dereference.snapis excluded by!**/*.snapand included by**crates/biome_cli/tests/snapshots/main_cases_handle_svelte_files/no_undeclared_variables_handles_svelte_module_type_only_store_dereference.snapis excluded by!**/*.snapand included by**crates/biome_cli/tests/snapshots/main_cases_handle_svelte_files/no_undeclared_variables_handles_svelte_store_dereference.snapis excluded by!**/*.snapand included by**crates/biome_js_analyze/tests/specs/correctness/noUndeclaredVariables/invalidDoubleDollarStoreDereference.svelte.ts.snapis excluded by!**/*.snapand included by**crates/biome_js_analyze/tests/specs/correctness/noUndeclaredVariables/invalidStoreDereference.ts.snapis excluded by!**/*.snapand included by**crates/biome_js_analyze/tests/specs/correctness/noUndeclaredVariables/invalidTypeOnlyStoreDereference.svelte.ts.snapis excluded by!**/*.snapand included by**crates/biome_js_analyze/tests/specs/correctness/noUndeclaredVariables/validDollarPrefixedIdentifier.svelte.ts.snapis excluded by!**/*.snapand included by**crates/biome_js_analyze/tests/specs/correctness/noUndeclaredVariables/validStoreDereference.svelte.ts.snapis excluded by!**/*.snapand included by**crates/biome_js_analyze/tests/specs/correctness/noUndeclaredVariables/validSvelteGlobalStoreDereference.svelte.ts.snapis excluded by!**/*.snapand included by**
📒 Files selected for processing (22)
.changeset/tasty-wings-bake.mdcrates/biome_cli/tests/cases/handle_svelte_files.rscrates/biome_js_analyze/src/lint/correctness/no_undeclared_variables.rscrates/biome_js_analyze/src/services/semantic.rscrates/biome_js_analyze/src/utils/rename.rscrates/biome_js_analyze/tests/spec_tests.rscrates/biome_js_analyze/tests/specs/correctness/noUndeclaredVariables/invalidDoubleDollarStoreDereference.svelte.tscrates/biome_js_analyze/tests/specs/correctness/noUndeclaredVariables/invalidStoreDereference.tscrates/biome_js_analyze/tests/specs/correctness/noUndeclaredVariables/invalidTypeOnlyStoreDereference.svelte.tscrates/biome_js_analyze/tests/specs/correctness/noUndeclaredVariables/validDollarPrefixedIdentifier.svelte.tscrates/biome_js_analyze/tests/specs/correctness/noUndeclaredVariables/validStoreDereference.svelte.tscrates/biome_js_analyze/tests/specs/correctness/noUndeclaredVariables/validSvelteGlobalStoreDereference.svelte.options.jsoncrates/biome_js_analyze/tests/specs/correctness/noUndeclaredVariables/validSvelteGlobalStoreDereference.svelte.tscrates/biome_js_semantic/src/events.rscrates/biome_js_semantic/src/semantic_model.rscrates/biome_js_semantic/src/semantic_model/builder.rscrates/biome_js_semantic/src/semantic_model/tests.rscrates/biome_js_syntax/src/file_source.rscrates/biome_service/src/file_handlers/html.rscrates/biome_service/src/file_handlers/javascript.rscrates/biome_service/src/workspace/document/mod.rscrates/biome_service/src/workspace/server.rs
Merging this PR will not alter performance
Comparing Footnotes
|
239c0d5 to
cf1c3ca
Compare
| } | ||
| } | ||
|
|
||
| fn js_document_services_for_snippet( |
There was a problem hiding this comment.
I understand now, but this function shouldn't be here, it doesn' have anything to do with html
There was a problem hiding this comment.
🧹 Nitpick comments (1)
crates/biome_js_semantic/src/events.rs (1)
943-960: Nice flavour gate; consider removing the hard-coded$slice offset.The Svelte-only guard is solid. One small refactor: this still hard-codes
TextSize::from(1)after callingJsFileSource::svelte_store_reference_name, so extraction logic is split across two places again.Optional tidy-up
- JsFileSource::svelte_store_reference_name(name.text())?; - - let store_name_start = TextSize::from(1); + let store_name = JsFileSource::svelte_store_reference_name(name.text())?; + let store_name_start = + name.len() - TextSize::from(u32::try_from(store_name.len()).ok()?); Some(BindingName::Value( name.clone() .slice(TextRange::new(store_name_start, name.len())), ))🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@crates/biome_js_semantic/src/events.rs` around lines 943 - 960, In maybe_svelte_store_dereference_binding_name, avoid the hard-coded TextSize::from(1) by using the result from JsFileSource::svelte_store_reference_name instead of discarding it; update JsFileSource::svelte_store_reference_name to return the slice start (or a TextRange/offset) for the svelte `$` prefix and then use that returned value to build the new BindingName in maybe_svelte_store_dereference_binding_name (keep the SemanticFlavor::Svelte guard and BindingName::Value handling as-is, just replace the literal store_name_start with the value returned by JsFileSource::svelte_store_reference_name).
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@crates/biome_js_semantic/src/events.rs`:
- Around line 943-960: In maybe_svelte_store_dereference_binding_name, avoid the
hard-coded TextSize::from(1) by using the result from
JsFileSource::svelte_store_reference_name instead of discarding it; update
JsFileSource::svelte_store_reference_name to return the slice start (or a
TextRange/offset) for the svelte `$` prefix and then use that returned value to
build the new BindingName in maybe_svelte_store_dereference_binding_name (keep
the SemanticFlavor::Svelte guard and BindingName::Value handling as-is, just
replace the literal store_name_start with the value returned by
JsFileSource::svelte_store_reference_name).
ℹ️ Review info
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (5)
crates/biome_cli/tests/cases/handle_svelte_files.rscrates/biome_js_semantic/src/events.rscrates/biome_js_semantic/src/semantic_model/tests.rscrates/biome_service/src/file_handlers/html.rscrates/biome_service/src/file_handlers/javascript.rs
🚧 Files skipped from review as they are similar to previous changes (1)
- crates/biome_cli/tests/cases/handle_svelte_files.rs
| let svelte_store_name = if is_svelte_file { | ||
| JsFileSource::svelte_store_reference_name(text) | ||
| } else { | ||
| None | ||
| }; | ||
|
|
||
| let source_type = ctx.source_type::<JsFileSource>(); | ||
|
|
||
| if ctx.is_global(text) { | ||
| if ctx.is_global(text) | ||
| || svelte_store_name.is_some_and(|store_name| ctx.is_global(store_name)) | ||
| { | ||
| return None; | ||
| } | ||
|
|
||
| let embedded_bindings = ctx | ||
| .get_service::<EmbeddedBindings>() | ||
| .expect("embedded bindings service"); | ||
| if embedded_bindings.contains_binding(text) { | ||
| if embedded_bindings.contains_binding(text) | ||
| || svelte_store_name | ||
| .is_some_and(|store_name| embedded_bindings.contains_binding(store_name)) | ||
| { |
There was a problem hiding this comment.
It's not really clear to me why the changes to the rule are necessary if the fix is in the semantic model.
There was a problem hiding this comment.
the semantic fix covers the lexical case where $store resolves to an actual store binding in scope. But noUndeclaredVariables also has its own policy layer for things like javascript.globals config and embedded bindings, which don't flow through the semantic model end-to-end yet. So without the rule-side change those cases would misbehave
20cd81b to
4e09140
Compare
There was a problem hiding this comment.
Actionable comments posted: 2
🧹 Nitpick comments (2)
crates/biome_cli/tests/cases/handle_svelte_files.rs (1)
50-59: Deduplicate identical fixture payloads
SVELTE_MODULE_STORE_DEREFERENCE_FILEandSVELTE_JS_MODULE_STORE_DEREFERENCE_FILEare byte-for-byte identical; aliasing one to the other would keep future fixture edits in one place.Suggested diff
const SVELTE_MODULE_STORE_DEREFERENCE_FILE: &str = r#"const store = 1; $store; $missing;"#; @@ -const SVELTE_JS_MODULE_STORE_DEREFERENCE_FILE: &str = r#"const store = 1; -$store; -$missing;"#; +const SVELTE_JS_MODULE_STORE_DEREFERENCE_FILE: &str = + SVELTE_MODULE_STORE_DEREFERENCE_FILE;🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@crates/biome_cli/tests/cases/handle_svelte_files.rs` around lines 50 - 59, Two fixture constants SVELTE_MODULE_STORE_DEREFERENCE_FILE and SVELTE_JS_MODULE_STORE_DEREFERENCE_FILE contain the exact same payload; to deduplicate, replace the duplicate definition by aliasing SVELTE_JS_MODULE_STORE_DEREFERENCE_FILE to SVELTE_MODULE_STORE_DEREFERENCE_FILE (i.e., assign SVELTE_JS_MODULE_STORE_DEREFERENCE_FILE = SVELTE_MODULE_STORE_DEREFERENCE_FILE) so future edits live in one place and keep SVELTE_MODULE_TYPE_ONLY_STORE_DEREFERENCE_FILE unchanged.crates/biome_js_analyze/src/lint/correctness/no_undeclared_variables.rs (1)
73-93: Optional: computeSemanticFlavoronce per run.Tiny tidy-up: flavour is file-invariant, so you can hoist it outside
filter_mapfor readability and a small perf win.♻️ Suggested patch
fn run(ctx: &RuleContext<Self>) -> Self::Signals { let model = ctx.query(); let source_type = ctx.source_type::<JsFileSource>(); + let flavor = SemanticFlavor::from(source_type); let embedded_bindings = ctx .get_service::<EmbeddedBindings>() .expect("embedded bindings service"); @@ - let store_name = SemanticFlavor::from(source_type).store_reference_name(text); + let store_name = flavor.store_reference_name(text);🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@crates/biome_js_analyze/src/lint/correctness/no_undeclared_variables.rs` around lines 73 - 93, Compute SemanticFlavor::from(source_type) once before calling model.all_unresolved_references() and reuse that value inside the filter_map closure instead of calling SemanticFlavor::from(source_type) repeatedly; specifically, introduce a local variable (e.g., let semantic_flavor = SemanticFlavor::from(source_type)) above the model...all_unresolved_references() chain and replace the in-closure call to SemanticFlavor::from(source_type).store_reference_name(text) with semantic_flavor.store_reference_name(text) to hoist file-invariant work out of the loop.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@crates/biome_js_semantic/src/semantic_model/flavor.rs`:
- Around line 29-37: The function store_reference_name currently gates Svelte
handling incorrectly: change the early check to only proceed for Svelte flavor
by flipping the condition so that you return None when NOT
self.is_svelte_rune(reference_name); then perform strip_prefix('$') and the
existing emptiness/starts_with('$') checks as before. Update the if in
store_reference_name (and keep is_svelte_rune as the selector) so only Svelte
refs lose the leading '$' and Vanilla refs are left untouched.
---
Nitpick comments:
In `@crates/biome_cli/tests/cases/handle_svelte_files.rs`:
- Around line 50-59: Two fixture constants SVELTE_MODULE_STORE_DEREFERENCE_FILE
and SVELTE_JS_MODULE_STORE_DEREFERENCE_FILE contain the exact same payload; to
deduplicate, replace the duplicate definition by aliasing
SVELTE_JS_MODULE_STORE_DEREFERENCE_FILE to SVELTE_MODULE_STORE_DEREFERENCE_FILE
(i.e., assign SVELTE_JS_MODULE_STORE_DEREFERENCE_FILE =
SVELTE_MODULE_STORE_DEREFERENCE_FILE) so future edits live in one place and keep
SVELTE_MODULE_TYPE_ONLY_STORE_DEREFERENCE_FILE unchanged.
In `@crates/biome_js_analyze/src/lint/correctness/no_undeclared_variables.rs`:
- Around line 73-93: Compute SemanticFlavor::from(source_type) once before
calling model.all_unresolved_references() and reuse that value inside the
filter_map closure instead of calling SemanticFlavor::from(source_type)
repeatedly; specifically, introduce a local variable (e.g., let semantic_flavor
= SemanticFlavor::from(source_type)) above the
model...all_unresolved_references() chain and replace the in-closure call to
SemanticFlavor::from(source_type).store_reference_name(text) with
semantic_flavor.store_reference_name(text) to hoist file-invariant work out of
the loop.
ℹ️ Review info
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (14)
crates/biome_cli/tests/snapshots/main_cases_handle_svelte_files/no_undeclared_variables_check_types_handles_svelte_ts_script_globals.snapis excluded by!**/*.snapand included by**crates/biome_cli/tests/snapshots/main_cases_handle_svelte_files/no_undeclared_variables_handles_svelte_js_module_store_dereference.snapis excluded by!**/*.snapand included by**crates/biome_cli/tests/snapshots/main_cases_handle_svelte_files/no_undeclared_variables_handles_svelte_module_store_dereference.snapis excluded by!**/*.snapand included by**crates/biome_cli/tests/snapshots/main_cases_handle_svelte_files/no_undeclared_variables_handles_svelte_module_type_only_store_dereference.snapis excluded by!**/*.snapand included by**crates/biome_cli/tests/snapshots/main_cases_handle_svelte_files/no_undeclared_variables_handles_svelte_store_dereference.snapis excluded by!**/*.snapand included by**crates/biome_js_analyze/tests/specs/correctness/noConstAssign/validSvelteStoreWrite.svelte.ts.snapis excluded by!**/*.snapand included by**crates/biome_js_analyze/tests/specs/correctness/noUndeclaredVariables/invalidBuiltinGlobalStoreDereference.svelte.ts.snapis excluded by!**/*.snapand included by**crates/biome_js_analyze/tests/specs/correctness/noUndeclaredVariables/invalidDoubleDollarStoreDereference.svelte.ts.snapis excluded by!**/*.snapand included by**crates/biome_js_analyze/tests/specs/correctness/noUndeclaredVariables/invalidStoreDereference.ts.snapis excluded by!**/*.snapand included by**crates/biome_js_analyze/tests/specs/correctness/noUndeclaredVariables/invalidTypeOnlyStoreDereference.svelte.ts.snapis excluded by!**/*.snapand included by**crates/biome_js_analyze/tests/specs/correctness/noUndeclaredVariables/validDollarPrefixedIdentifier.svelte.ts.snapis excluded by!**/*.snapand included by**crates/biome_js_analyze/tests/specs/correctness/noUndeclaredVariables/validStoreDereference.svelte.ts.snapis excluded by!**/*.snapand included by**crates/biome_js_analyze/tests/specs/correctness/noUndeclaredVariables/validSvelteGlobalStoreDereference.svelte.ts.snapis excluded by!**/*.snapand included by**crates/biome_js_analyze/tests/specs/suspicious/noImportAssign/validSvelteStoreWrite.svelte.ts.snapis excluded by!**/*.snapand included by**
📒 Files selected for processing (31)
.changeset/tasty-wings-bake.mdcrates/biome_cli/tests/cases/handle_svelte_files.rscrates/biome_js_analyze/src/lint/correctness/no_undeclared_variables.rscrates/biome_js_analyze/src/services/semantic.rscrates/biome_js_analyze/src/utils/rename.rscrates/biome_js_analyze/tests/spec_tests.rscrates/biome_js_analyze/tests/specs/correctness/noConstAssign/validSvelteStoreWrite.svelte.tscrates/biome_js_analyze/tests/specs/correctness/noUndeclaredVariables/invalidBuiltinGlobalStoreDereference.svelte.tscrates/biome_js_analyze/tests/specs/correctness/noUndeclaredVariables/invalidDoubleDollarStoreDereference.svelte.tscrates/biome_js_analyze/tests/specs/correctness/noUndeclaredVariables/invalidStoreDereference.tscrates/biome_js_analyze/tests/specs/correctness/noUndeclaredVariables/invalidTypeOnlyStoreDereference.svelte.tscrates/biome_js_analyze/tests/specs/correctness/noUndeclaredVariables/validDollarPrefixedIdentifier.svelte.tscrates/biome_js_analyze/tests/specs/correctness/noUndeclaredVariables/validStoreDereference.svelte.tscrates/biome_js_analyze/tests/specs/correctness/noUndeclaredVariables/validSvelteGlobalStoreDereference.svelte.options.jsoncrates/biome_js_analyze/tests/specs/correctness/noUndeclaredVariables/validSvelteGlobalStoreDereference.svelte.tscrates/biome_js_analyze/tests/specs/suspicious/noImportAssign/validSvelteStoreWrite.svelte.tscrates/biome_js_semantic/src/events.rscrates/biome_js_semantic/src/semantic_model.rscrates/biome_js_semantic/src/semantic_model/builder.rscrates/biome_js_semantic/src/semantic_model/flavor.rscrates/biome_js_semantic/src/semantic_model/tests.rscrates/biome_js_syntax/src/file_source.rscrates/biome_service/src/file_handlers/css.rscrates/biome_service/src/file_handlers/graphql.rscrates/biome_service/src/file_handlers/html.rscrates/biome_service/src/file_handlers/javascript.rscrates/biome_service/src/file_handlers/json.rscrates/biome_service/src/file_handlers/mod.rscrates/biome_service/src/file_handlers/svelte.rscrates/biome_service/src/workspace/document/mod.rscrates/biome_service/src/workspace/server.rs
✅ Files skipped from review due to trivial changes (2)
- crates/biome_service/src/file_handlers/css.rs
- crates/biome_js_analyze/tests/specs/correctness/noUndeclaredVariables/invalidBuiltinGlobalStoreDereference.svelte.ts
🚧 Files skipped from review as they are similar to previous changes (11)
- crates/biome_js_analyze/tests/specs/correctness/noUndeclaredVariables/invalidStoreDereference.ts
- crates/biome_js_syntax/src/file_source.rs
- crates/biome_js_analyze/tests/specs/correctness/noUndeclaredVariables/validSvelteGlobalStoreDereference.svelte.options.json
- .changeset/tasty-wings-bake.md
- crates/biome_js_semantic/src/semantic_model/tests.rs
- crates/biome_js_semantic/src/semantic_model.rs
- crates/biome_js_analyze/tests/specs/correctness/noUndeclaredVariables/validStoreDereference.svelte.ts
- crates/biome_js_analyze/tests/spec_tests.rs
- crates/biome_service/src/workspace/document/mod.rs
- crates/biome_js_analyze/tests/specs/correctness/noUndeclaredVariables/validSvelteGlobalStoreDereference.svelte.ts
- crates/biome_service/src/file_handlers/html.rs
hey so i've reworked this from the ground up and it ended up getting pretty big. I had to add some pretty important new internal plumbing, that is for now tentatively named SemanticFlavor (so that we can interpret .svelte.js and .svelte.ts modules properly) |
1ce9220 to
df95ffd
Compare
900d20f to
a7abbb9
Compare
ematipico
left a comment
There was a problem hiding this comment.
I think we're getting somewhere, and it's taking a good shape. There are still a few things to address
26316b8 to
cfa91db
Compare
Absolutely no pressing matter, but I wanted to ensure we were in the same page, I think I've addressed all the existing concerns, but if you still need any follow-up from me I'm ready :) |
8b1030f to
93a52b4
Compare
|
Hey @Hugo-Polloli, I rebased the branch to resolve the merge conflicts, and because we recently improved our testing infra. I believe we no longer need the CLI tests for this, we can use our normal per-rule snapshot infra to help verify this. I've added a commit 93a52b4 to explain what i mean |
|
This PR should be ready to merge @dyc3 |
dyc3
left a comment
There was a problem hiding this comment.
Sorry for the delay. Looks good.
This PR contains the following updates: | Package | Type | Update | Change | |---|---|---|---| | [@biomejs/biome](https://biomejs.dev) ([source](https://github.com/biomejs/biome/tree/HEAD/packages/@biomejs/biome)) | imports | patch | [`2.4.13` -> `2.4.14`](https://renovatebot.com/diffs/npm/@biomejs%2fbiome/2.4.13/2.4.14) | --- ### Release Notes <details> <summary>biomejs/biome (@​biomejs/biome)</summary> ### [`v2.4.14`](https://github.com/biomejs/biome/blob/HEAD/packages/@​biomejs/biome/CHANGELOG.md#2414) [Compare Source](https://github.com/biomejs/biome/compare/@biomejs/biome@2.4.13...@biomejs/biome@2.4.14) ##### Patch Changes - [#​9393](biomejs/biome#9393) [`491b171`](biomejs/biome@491b171) Thanks [@​dyc3](https://github.com/dyc3)! - Added the nursery rule [`useTestHooksOnTop`](https://biomejs.dev/linter/rules/use-test-hooks-on-top) in the `test` domain. The rule flags lifecycle hooks (`beforeEach`, `beforeAll`, `afterEach`, `afterAll`) that appear after test cases in the same block, enforcing that hooks are defined before any test case. - [#​10157](biomejs/biome#10157) [`eefc5ab`](biomejs/biome@eefc5ab) Thanks [@​dyc3](https://github.com/dyc3)! - Fixed [#​7882](biomejs/biome#7882): The HTML parser will now emit better diagnostics when it encounters a void element with a closing tag, such as `<br></br>`. Previously, the parser would emit multiple diagnostics with conflicting advice. Now it emits a single diagnostic that clearly states that void elements should not have closing tags. - [#​10054](biomejs/biome#10054) [`0e9f569`](biomejs/biome@0e9f569) Thanks [@​minseong0324](https://github.com/minseong0324)! - [`noMisleadingReturnType`](https://biomejs.dev/linter/rules/no-misleading-return-type/) no longer misses widening from concrete object types, class instances, object literals, tuples, functions, and regular expressions to `: object`. A function annotated `: object` returning an object literal: ```ts function f(): object { return { retry: true }; } ``` - [#​10116](biomejs/biome#10116) [`53269eb`](biomejs/biome@53269eb) Thanks [@​jiwon79](https://github.com/jiwon79)! - Fixed [#​6201](biomejs/biome#6201): [`noUselessEscapeInRegex`](https://biomejs.dev/linter/rules/no-useless-escape-in-regex/) no longer flags an escaped backslash followed by `-` as a useless escape. Patterns like `/[\\-]/` are now considered valid because the second `\` is the escaped backslash, not an unnecessary escape of the trailing dash. - [#​10092](biomejs/biome#10092) [`33d8543`](biomejs/biome@33d8543) Thanks [@​Conaclos](https://github.com/Conaclos)! - Fixed [#​9097](biomejs/biome#9097): [`organizeImports`](https://biomejs.dev/assist/actions/organize-imports/) no longer adds a blank line between a never-matched group and a matched group. Given the following `organizeImports` options: ```json { "groups": [":NODE:", ":BLANK_LINE:", ":PACKAGE:", ":BLANK_LINE:", ":PATH:"] } ``` The following code... ```js // Comment import "package"; import "./file.js"; ``` ...was organized as: ```diff + // Comment import "package"; + import "./file.js"; ``` A blank line was added even though the group ':NODE:' doesn't match any imports here. `:BLANK_LINE:` between never-matched groups and matched groups are now ignored. The code is now organized as: ```diff // Comment import "package"; + import "./file.js"; ``` - [#​10138](biomejs/biome#10138) [`a10b6c1`](biomejs/biome@a10b6c1) Thanks [@​dyc3](https://github.com/dyc3)! - Fixed Vue `v-for` handling for [`noUndeclaredVariables`](https://biomejs.dev/linter/rules/no-undeclared-variables/) and [`noUnusedVariables`](https://biomejs.dev/linter/rules/no-unused-variables/). Biome now recognizes variables declared by `v-for` directives and references to iterated values in Vue templates. - [#​10115](biomejs/biome#10115) [`d428d76`](biomejs/biome@d428d76) Thanks [@​minseong0324](https://github.com/minseong0324)! - [`noMisleadingReturnType`](https://biomejs.dev/linter/rules/no-misleading-return-type/) no longer reports false positives when a union return type's `boolean` variant is covered by both `true` and `false` returns. - [#​9922](biomejs/biome#9922) [`7acf1e0`](biomejs/biome@7acf1e0) Thanks [@​dyc3](https://github.com/dyc3)! - Added the new nursery rule [`noReactStringRefs`](https://biomejs.dev/linter/rules/no-react-string-refs/), which disallows legacy React string refs such as `ref="hello"` and `this.refs.hello`. Biome also reports template-literal refs such as ``ref={`hello`}``, so React code can consistently migrate to callback refs, `createRef()`, or `useRef()`. - [#​10010](biomejs/biome#10010) [`f3e76ab`](biomejs/biome@f3e76ab) Thanks [@​dyc3](https://github.com/dyc3)! - Fixed a bug in the LSP file watcher registration so Biome now watches `.biome.json` and `.biome.jsonc` configuration files and reloads workspace settings when they change. - [#​10176](biomejs/biome#10176) [`8a40ef8`](biomejs/biome@8a40ef8) Thanks [@​dyc3](https://github.com/dyc3)! - Fixed [#​10011](biomejs/biome#10011): The [`noThisInStatic`](https://biomejs.dev/linter/rules/no-this-in-static/) rule no longer reports `this` when it is used as the constructor target in `new this(...)`, which is required for inherited static factory methods. - [#​10163](biomejs/biome#10163) [`6867e96`](biomejs/biome@6867e96) Thanks [@​jiwon79](https://github.com/jiwon79)! - Fixed [#​9884](biomejs/biome#9884): The [`useSortedAttributes`](https://biomejs.dev/assist/actions/use-sorted-attributes/) auto-fix no longer corrupts source code when both an outer JSX element and a nested JSX-valued attribute have unsorted attributes in the same pass. Multiple unsorted groups separated by spread or shorthand attributes within the same JSX element are now reported as a single diagnostic. - [#​10079](biomejs/biome#10079) [`d29dd19`](biomejs/biome@d29dd19) Thanks [@​Damix48](https://github.com/Damix48)! - Fixed false positive in `noAssignInExpressions` for Svelte `{@​const}` blocks. Assignments in `{@​const name = value}` are now correctly recognized as declarations rather than accidental assignments in expressions. - [#​10080](biomejs/biome#10080) [`5d8fdac`](biomejs/biome@5d8fdac) Thanks [@​Damix48](https://github.com/Damix48)! - Fixed parsing of closing parentheses in Svelte `{#each}` block key expressions. Biome now correctly parses method calls and other parenthesised expressions used as keys. For example, the following snippets are now parsed correctly: ```svelte {#each numbers as number, index (number.toString())} <p>{number}</p> {/each} {#each numbers as number (key(number))} <p>{number}</p> {/each} ``` - [#​10140](biomejs/biome#10140) [`e7024b9`](biomejs/biome@e7024b9) Thanks [@​solithcy](https://github.com/solithcy)! - Fixed [#​10135](biomejs/biome#10135): Biome no longer crashes on missing Svelte template expressions. The following code snippet longer panics: ```svelte {#if } <p>^ this would previously crash</p> {/if} {@​const } <p> ^ this would also crash</p> ``` - [#​10111](biomejs/biome#10111) [`7818009`](biomejs/biome@7818009) Thanks [@​jiwon79](https://github.com/jiwon79)! - Fixed [#​9997](biomejs/biome#9997): [`noDuplicateSelectors`](https://biomejs.dev/linter/rules/no-duplicate-selectors/) no longer reports false positives for selectors inside `@scope` queries. Biome now treats `@scope` as a separate at-rule context, like `@media`, `@supports`, `@container`, and `@starting-style`. The following snippet is no longer flagged as a duplicate: ```css .Example { padding: 0; } @​scope (.theme-dark) { .Example { color: white; } } ``` - [#​9926](biomejs/biome#9926) [`d62b331`](biomejs/biome@d62b331) Thanks [@​dyc3](https://github.com/dyc3)! - Added the nursery lint rule [`useMathMinMax`](https://biomejs.dev/linter/rules/use-math-min-max/), which prefers `Math.min()` and `Math.max()` over equivalent ternary comparisons. For example, this code: ```js const min = a < b ? a : b; ``` is much more readable when rewritten as: ```js const min = Math.min(a, b); ``` - [#​10115](biomejs/biome#10115) [`d428d76`](biomejs/biome@d428d76) Thanks [@​minseong0324](https://github.com/minseong0324)! - [`useExhaustiveSwitchCases`](https://biomejs.dev/linter/rules/use-exhaustive-switch-cases/) now flags missing `true`/`false` cases for `boolean` discriminants, including when `boolean` is a union variant. - [#​10125](biomejs/biome#10125) [`a55a0b6`](biomejs/biome@a55a0b6) Thanks [@​bmish](https://github.com/bmish)! - Fixed a resolver bug where packages that define a typed entry point through `package.json`'s `main` field but omit `types` were ignored during type-aware resolution. Type-aware rules such as [`noFloatingPromises`](https://biomejs.dev/linter/rules/no-floating-promises/) can now inspect imports from those packages. - [#​10117](biomejs/biome#10117) [`895e809`](biomejs/biome@895e809) Thanks [@​denizdogan](https://github.com/denizdogan)! - Added support for the `corner-shape` family of CSS properties and the `superellipse()`/`squircle()` value functions, so [`noUnknownProperty`](https://biomejs.dev/linter/rules/no-unknown-property/) and [`noUnknownFunction`](https://biomejs.dev/linter/rules/no-unknown-function/) no longer flag them as unknown. New known properties: `corner-shape`, `corner-block-end-shape`, `corner-block-start-shape`, `corner-bottom-left-shape`, `corner-bottom-right-shape`, `corner-bottom-shape`, `corner-end-end-shape`, `corner-end-start-shape`, `corner-inline-end-shape`, `corner-inline-start-shape`, `corner-left-shape`, `corner-right-shape`, `corner-start-end-shape`, `corner-start-start-shape`, `corner-top-left-shape`, `corner-top-right-shape`, `corner-top-shape`. New known value functions: `superellipse()`, `squircle()`. - [#​8620](biomejs/biome#8620) [`8df8f73`](biomejs/biome@8df8f73) Thanks [@​dyc3](https://github.com/dyc3)! - Fixed [#​8062](biomejs/biome#8062): Added support for parsing Vue `v-for` directives more accurately. - [#​10191](biomejs/biome#10191) [`aa055cd`](biomejs/biome@aa055cd) Thanks [@​guney](https://github.com/guney)! - Now the rule [`noStaticElementInteractions`](https://biomejs.dev/linter/rules/no-static-element-interactions/) doesn't trigger custom elements. - [#​9757](biomejs/biome#9757) [`2c62594`](biomejs/biome@2c62594) Thanks [@​dyc3](https://github.com/dyc3)! - Fixed [#​9099](biomejs/biome#9099): the HTML formatter collapsing non-text children (inline elements, Svelte expressions, comments) onto a single line when the source had them on separate lines. Biome now preserves the user's intended line breaks for exclusively non-text children. For example, the following Svelte snippet is now preserved instead of being collapsed to `<div>{name}<!-- comment --></div>`: ```svelte <div> {name}<!-- comment --> </div> ``` Similarly, HTML elements like `<span>` inside a `<div>` are now preserved when written on their own line: ```html <div> <span>text</span> </div> ``` - [#​10105](biomejs/biome#10105) [`e7c1a6d`](biomejs/biome@e7c1a6d) Thanks [@​jiwon79](https://github.com/jiwon79)! - Fixed [#​10039](biomejs/biome#10039): [`useReadonlyClassProperties`](https://biomejs.dev/linter/rules/use-readonly-class-properties/) now detects unreassigned private members in class expressions and export default classes, not only in class declarations. The following patterns are now correctly flagged: ```ts const AnonClass = class { #prop = 123; constructor() { console.log(this.#prop); } }; export default class { #prop = 123; constructor() { console.log(this.#prop); } } ``` - [#​10141](biomejs/biome#10141) [`46a77d0`](biomejs/biome@46a77d0) Thanks [@​minseong0324](https://github.com/minseong0324)! - Improved [`noUnnecessaryConditions`](https://biomejs.dev/linter/rules/no-unnecessary-conditions/) to detect conditions that are always truthy because they check built-in global class instances such as `Date`, `Map`, `Set`, `WeakMap`, and `Error`. - [#​10178](biomejs/biome#10178) [`7b05a89`](biomejs/biome@7b05a89) Thanks [@​dyc3](https://github.com/dyc3)! - Fixed [#​10177](biomejs/biome#10177): The HTML parser no longer reports lowercase `html` or `doctype` text as invalid after void elements such as `<br>`. - [#​10155](biomejs/biome#10155) [`0d4595d`](biomejs/biome@0d4595d) Thanks [@​jiwon79](https://github.com/jiwon79)! - Fixed [#​10045](biomejs/biome#10045): the CSS formatter no longer compounds indentation inside nested functional pseudo-classes such as `:not(:where(...))`, `:is(:where(...))`, and similar combinations. The same fix also removes one level of unnecessary indentation that was added inside any pseudo-class function whose argument list wrapped onto multiple lines, including `:nth-child(... of ...)`, `::part(...)`, and `:active-view-transition-type(...)`. The following snippet is now correctly formatted, matching Prettier. ```css input:not( :where( [type="submit"], [type="checkbox"], [type="radio"], [type="button"], [type="reset"] ) ) { inline-size: 100%; } ``` - [#​10112](biomejs/biome#10112) [`6f0251e`](biomejs/biome@6f0251e) Thanks [@​dyc3](https://github.com/dyc3)! - Fixed [#​10110](biomejs/biome#10110): Biome's parser now accepts surrogate code points in JavaScript string `\u{...}` escapes. - [#​10141](biomejs/biome#10141) [`46a77d0`](biomejs/biome@46a77d0) Thanks [@​minseong0324](https://github.com/minseong0324)! - Improved [`noMisleadingReturnType`](https://biomejs.dev/linter/rules/no-misleading-return-type/) to detect `object` return annotations that hide built-in global class instances such as `Date`, `Map`, `Set`, `WeakMap`, and `Error`. - [#​10083](biomejs/biome#10083) [`4a664c1`](biomejs/biome@4a664c1) Thanks [@​ematipico](https://github.com/ematipico)! - Added two new options to [`noShadow`](https://biomejs.dev/linter/rules/no-shadow/), both defaulting to `true` to match typescript-eslint's behavior. Fixed [#​9482](biomejs/biome#9482): Added `ignoreFunctionTypeParameterNameValueShadow` option. When enabled, parameter names inside function type annotations (e.g. `(options: unknown) => void`) are not flagged as shadowing outer variables. Fixed [#​7812](biomejs/biome#7812): Added `ignoreTypeValueShadow` option. When enabled, a value binding that shares its name with a type-only declaration (type alias or interface) is not flagged, since types and values occupy separate namespaces in TypeScript. - [#​9286](biomejs/biome#9286) [`52695cf`](biomejs/biome@52695cf) Thanks [@​Hugo-Polloli](https://github.com/Hugo-Polloli)! - Fixed [#​6316](biomejs/biome#6316): Biome now resolves Svelte `$store` references to the underlying `store` binding in semantic analysis, preventing false `noUndeclaredVariables` diagnostics when the store is declared. - [#​10188](biomejs/biome#10188) [`ae659dd`](biomejs/biome@ae659dd) Thanks [@​dyc3](https://github.com/dyc3)! - Added a new nursery rule [`noExcessiveNestedCallbacks`](https://biomejs.dev/linter/rules/no-excessive-nested-callbacks/), which disallows callbacks nested deeper than the configured maximum. - [#​9757](biomejs/biome#9757) [`2c62594`](biomejs/biome@2c62594) Thanks [@​dyc3](https://github.com/dyc3)! - Fixed [#​9450](biomejs/biome#9450): the HTML formatter now correctly preserves multiline formatting for nested `<template>` elements (e.g. `<template #body>`) when the source has children on separate lines. Previously, the children were collapsed onto a single line. ```diff <template> <UModal> - <template #body> <p>content</p> </template> + <template #body> + <p>content</p> + </template> </UModal> </template> ``` - [#​10118](biomejs/biome#10118) [`c6edcb4`](biomejs/biome@c6edcb4) Thanks [@​Netail](https://github.com/Netail)! - Fixed [#​10024](biomejs/biome#10024): `biome migrate eslint` correctly migrates `eslint` rules that belong to multiple Biome rules. </details> --- ### Configuration 📅 **Schedule**: (UTC) - Branch creation - At any time (no schedule defined) - Automerge - At any time (no schedule defined) 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR has been generated by [Mend Renovate](https://github.com/renovatebot/renovate). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0My4xNjAuMiIsInVwZGF0ZWRJblZlciI6IjQzLjE2MC4yIiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6W119--> Reviewed-on: https://git.oirnoir.dev/OIRNOIR/YouTube-Helper-Client/pulls/2
This PR contains the following updates: | Package | Type | Update | Change | |---|---|---|---| | [@biomejs/biome](https://biomejs.dev) ([source](https://github.com/biomejs/biome/tree/HEAD/packages/@biomejs/biome)) | imports | patch | [`2.4.13` -> `2.4.14`](https://renovatebot.com/diffs/npm/@biomejs%2fbiome/2.4.13/2.4.14) | --- ### Release Notes <details> <summary>biomejs/biome (@​biomejs/biome)</summary> ### [`v2.4.14`](https://github.com/biomejs/biome/blob/HEAD/packages/@​biomejs/biome/CHANGELOG.md#2414) [Compare Source](https://github.com/biomejs/biome/compare/@biomejs/biome@2.4.13...@biomejs/biome@2.4.14) ##### Patch Changes - [#​9393](biomejs/biome#9393) [`491b171`](biomejs/biome@491b171) Thanks [@​dyc3](https://github.com/dyc3)! - Added the nursery rule [`useTestHooksOnTop`](https://biomejs.dev/linter/rules/use-test-hooks-on-top) in the `test` domain. The rule flags lifecycle hooks (`beforeEach`, `beforeAll`, `afterEach`, `afterAll`) that appear after test cases in the same block, enforcing that hooks are defined before any test case. - [#​10157](biomejs/biome#10157) [`eefc5ab`](biomejs/biome@eefc5ab) Thanks [@​dyc3](https://github.com/dyc3)! - Fixed [#​7882](biomejs/biome#7882): The HTML parser will now emit better diagnostics when it encounters a void element with a closing tag, such as `<br></br>`. Previously, the parser would emit multiple diagnostics with conflicting advice. Now it emits a single diagnostic that clearly states that void elements should not have closing tags. - [#​10054](biomejs/biome#10054) [`0e9f569`](biomejs/biome@0e9f569) Thanks [@​minseong0324](https://github.com/minseong0324)! - [`noMisleadingReturnType`](https://biomejs.dev/linter/rules/no-misleading-return-type/) no longer misses widening from concrete object types, class instances, object literals, tuples, functions, and regular expressions to `: object`. A function annotated `: object` returning an object literal: ```ts function f(): object { return { retry: true }; } ``` - [#​10116](biomejs/biome#10116) [`53269eb`](biomejs/biome@53269eb) Thanks [@​jiwon79](https://github.com/jiwon79)! - Fixed [#​6201](biomejs/biome#6201): [`noUselessEscapeInRegex`](https://biomejs.dev/linter/rules/no-useless-escape-in-regex/) no longer flags an escaped backslash followed by `-` as a useless escape. Patterns like `/[\\-]/` are now considered valid because the second `\` is the escaped backslash, not an unnecessary escape of the trailing dash. - [#​10092](biomejs/biome#10092) [`33d8543`](biomejs/biome@33d8543) Thanks [@​Conaclos](https://github.com/Conaclos)! - Fixed [#​9097](biomejs/biome#9097): [`organizeImports`](https://biomejs.dev/assist/actions/organize-imports/) no longer adds a blank line between a never-matched group and a matched group. Given the following `organizeImports` options: ```json { "groups": [":NODE:", ":BLANK_LINE:", ":PACKAGE:", ":BLANK_LINE:", ":PATH:"] } ``` The following code... ```js // Comment import "package"; import "./file.js"; ``` ...was organized as: ```diff + // Comment import "package"; + import "./file.js"; ``` A blank line was added even though the group ':NODE:' doesn't match any imports here. `:BLANK_LINE:` between never-matched groups and matched groups are now ignored. The code is now organized as: ```diff // Comment import "package"; + import "./file.js"; ``` - [#​10138](biomejs/biome#10138) [`a10b6c1`](biomejs/biome@a10b6c1) Thanks [@​dyc3](https://github.com/dyc3)! - Fixed Vue `v-for` handling for [`noUndeclaredVariables`](https://biomejs.dev/linter/rules/no-undeclared-variables/) and [`noUnusedVariables`](https://biomejs.dev/linter/rules/no-unused-variables/). Biome now recognizes variables declared by `v-for` directives and references to iterated values in Vue templates. - [#​10115](biomejs/biome#10115) [`d428d76`](biomejs/biome@d428d76) Thanks [@​minseong0324](https://github.com/minseong0324)! - [`noMisleadingReturnType`](https://biomejs.dev/linter/rules/no-misleading-return-type/) no longer reports false positives when a union return type's `boolean` variant is covered by both `true` and `false` returns. - [#​9922](biomejs/biome#9922) [`7acf1e0`](biomejs/biome@7acf1e0) Thanks [@​dyc3](https://github.com/dyc3)! - Added the new nursery rule [`noReactStringRefs`](https://biomejs.dev/linter/rules/no-react-string-refs/), which disallows legacy React string refs such as `ref="hello"` and `this.refs.hello`. Biome also reports template-literal refs such as ``ref={`hello`}``, so React code can consistently migrate to callback refs, `createRef()`, or `useRef()`. - [#​10010](biomejs/biome#10010) [`f3e76ab`](biomejs/biome@f3e76ab) Thanks [@​dyc3](https://github.com/dyc3)! - Fixed a bug in the LSP file watcher registration so Biome now watches `.biome.json` and `.biome.jsonc` configuration files and reloads workspace settings when they change. - [#​10176](biomejs/biome#10176) [`8a40ef8`](biomejs/biome@8a40ef8) Thanks [@​dyc3](https://github.com/dyc3)! - Fixed [#​10011](biomejs/biome#10011): The [`noThisInStatic`](https://biomejs.dev/linter/rules/no-this-in-static/) rule no longer reports `this` when it is used as the constructor target in `new this(...)`, which is required for inherited static factory methods. - [#​10163](biomejs/biome#10163) [`6867e96`](biomejs/biome@6867e96) Thanks [@​jiwon79](https://github.com/jiwon79)! - Fixed [#​9884](biomejs/biome#9884): The [`useSortedAttributes`](https://biomejs.dev/assist/actions/use-sorted-attributes/) auto-fix no longer corrupts source code when both an outer JSX element and a nested JSX-valued attribute have unsorted attributes in the same pass. Multiple unsorted groups separated by spread or shorthand attributes within the same JSX element are now reported as a single diagnostic. - [#​10079](biomejs/biome#10079) [`d29dd19`](biomejs/biome@d29dd19) Thanks [@​Damix48](https://github.com/Damix48)! - Fixed false positive in `noAssignInExpressions` for Svelte `{@​const}` blocks. Assignments in `{@​const name = value}` are now correctly recognized as declarations rather than accidental assignments in expressions. - [#​10080](biomejs/biome#10080) [`5d8fdac`](biomejs/biome@5d8fdac) Thanks [@​Damix48](https://github.com/Damix48)! - Fixed parsing of closing parentheses in Svelte `{#each}` block key expressions. Biome now correctly parses method calls and other parenthesised expressions used as keys. For example, the following snippets are now parsed correctly: ```svelte {#each numbers as number, index (number.toString())} <p>{number}</p> {/each} {#each numbers as number (key(number))} <p>{number}</p> {/each} ``` - [#​10140](biomejs/biome#10140) [`e7024b9`](biomejs/biome@e7024b9) Thanks [@​solithcy](https://github.com/solithcy)! - Fixed [#​10135](biomejs/biome#10135): Biome no longer crashes on missing Svelte template expressions. The following code snippet longer panics: ```svelte {#if } <p>^ this would previously crash</p> {/if} {@​const } <p> ^ this would also crash</p> ``` - [#​10111](biomejs/biome#10111) [`7818009`](biomejs/biome@7818009) Thanks [@​jiwon79](https://github.com/jiwon79)! - Fixed [#​9997](biomejs/biome#9997): [`noDuplicateSelectors`](https://biomejs.dev/linter/rules/no-duplicate-selectors/) no longer reports false positives for selectors inside `@scope` queries. Biome now treats `@scope` as a separate at-rule context, like `@media`, `@supports`, `@container`, and `@starting-style`. The following snippet is no longer flagged as a duplicate: ```css .Example { padding: 0; } @​scope (.theme-dark) { .Example { color: white; } } ``` - [#​9926](biomejs/biome#9926) [`d62b331`](biomejs/biome@d62b331) Thanks [@​dyc3](https://github.com/dyc3)! - Added the nursery lint rule [`useMathMinMax`](https://biomejs.dev/linter/rules/use-math-min-max/), which prefers `Math.min()` and `Math.max()` over equivalent ternary comparisons. For example, this code: ```js const min = a < b ? a : b; ``` is much more readable when rewritten as: ```js const min = Math.min(a, b); ``` - [#​10115](biomejs/biome#10115) [`d428d76`](biomejs/biome@d428d76) Thanks [@​minseong0324](https://github.com/minseong0324)! - [`useExhaustiveSwitchCases`](https://biomejs.dev/linter/rules/use-exhaustive-switch-cases/) now flags missing `true`/`false` cases for `boolean` discriminants, including when `boolean` is a union variant. - [#​10125](biomejs/biome#10125) [`a55a0b6`](biomejs/biome@a55a0b6) Thanks [@​bmish](https://github.com/bmish)! - Fixed a resolver bug where packages that define a typed entry point through `package.json`'s `main` field but omit `types` were ignored during type-aware resolution. Type-aware rules such as [`noFloatingPromises`](https://biomejs.dev/linter/rules/no-floating-promises/) can now inspect imports from those packages. - [#​10117](biomejs/biome#10117) [`895e809`](biomejs/biome@895e809) Thanks [@​denizdogan](https://github.com/denizdogan)! - Added support for the `corner-shape` family of CSS properties and the `superellipse()`/`squircle()` value functions, so [`noUnknownProperty`](https://biomejs.dev/linter/rules/no-unknown-property/) and [`noUnknownFunction`](https://biomejs.dev/linter/rules/no-unknown-function/) no longer flag them as unknown. New known properties: `corner-shape`, `corner-block-end-shape`, `corner-block-start-shape`, `corner-bottom-left-shape`, `corner-bottom-right-shape`, `corner-bottom-shape`, `corner-end-end-shape`, `corner-end-start-shape`, `corner-inline-end-shape`, `corner-inline-start-shape`, `corner-left-shape`, `corner-right-shape`, `corner-start-end-shape`, `corner-start-start-shape`, `corner-top-left-shape`, `corner-top-right-shape`, `corner-top-shape`. New known value functions: `superellipse()`, `squircle()`. - [#​8620](biomejs/biome#8620) [`8df8f73`](biomejs/biome@8df8f73) Thanks [@​dyc3](https://github.com/dyc3)! - Fixed [#​8062](biomejs/biome#8062): Added support for parsing Vue `v-for` directives more accurately. - [#​10191](biomejs/biome#10191) [`aa055cd`](biomejs/biome@aa055cd) Thanks [@​guney](https://github.com/guney)! - Now the rule [`noStaticElementInteractions`](https://biomejs.dev/linter/rules/no-static-element-interactions/) doesn't trigger custom elements. - [#​9757](biomejs/biome#9757) [`2c62594`](biomejs/biome@2c62594) Thanks [@​dyc3](https://github.com/dyc3)! - Fixed [#​9099](biomejs/biome#9099): the HTML formatter collapsing non-text children (inline elements, Svelte expressions, comments) onto a single line when the source had them on separate lines. Biome now preserves the user's intended line breaks for exclusively non-text children. For example, the following Svelte snippet is now preserved instead of being collapsed to `<div>{name}<!-- comment --></div>`: ```svelte <div> {name}<!-- comment --> </div> ``` Similarly, HTML elements like `<span>` inside a `<div>` are now preserved when written on their own line: ```html <div> <span>text</span> </div> ``` - [#​10105](biomejs/biome#10105) [`e7c1a6d`](biomejs/biome@e7c1a6d) Thanks [@​jiwon79](https://github.com/jiwon79)! - Fixed [#​10039](biomejs/biome#10039): [`useReadonlyClassProperties`](https://biomejs.dev/linter/rules/use-readonly-class-properties/) now detects unreassigned private members in class expressions and export default classes, not only in class declarations. The following patterns are now correctly flagged: ```ts const AnonClass = class { #prop = 123; constructor() { console.log(this.#prop); } }; export default class { #prop = 123; constructor() { console.log(this.#prop); } } ``` - [#​10141](biomejs/biome#10141) [`46a77d0`](biomejs/biome@46a77d0) Thanks [@​minseong0324](https://github.com/minseong0324)! - Improved [`noUnnecessaryConditions`](https://biomejs.dev/linter/rules/no-unnecessary-conditions/) to detect conditions that are always truthy because they check built-in global class instances such as `Date`, `Map`, `Set`, `WeakMap`, and `Error`. - [#​10178](biomejs/biome#10178) [`7b05a89`](biomejs/biome@7b05a89) Thanks [@​dyc3](https://github.com/dyc3)! - Fixed [#​10177](biomejs/biome#10177): The HTML parser no longer reports lowercase `html` or `doctype` text as invalid after void elements such as `<br>`. - [#​10155](biomejs/biome#10155) [`0d4595d`](biomejs/biome@0d4595d) Thanks [@​jiwon79](https://github.com/jiwon79)! - Fixed [#​10045](biomejs/biome#10045): the CSS formatter no longer compounds indentation inside nested functional pseudo-classes such as `:not(:where(...))`, `:is(:where(...))`, and similar combinations. The same fix also removes one level of unnecessary indentation that was added inside any pseudo-class function whose argument list wrapped onto multiple lines, including `:nth-child(... of ...)`, `::part(...)`, and `:active-view-transition-type(...)`. The following snippet is now correctly formatted, matching Prettier. ```css input:not( :where( [type="submit"], [type="checkbox"], [type="radio"], [type="button"], [type="reset"] ) ) { inline-size: 100%; } ``` - [#​10112](biomejs/biome#10112) [`6f0251e`](biomejs/biome@6f0251e) Thanks [@​dyc3](https://github.com/dyc3)! - Fixed [#​10110](biomejs/biome#10110): Biome's parser now accepts surrogate code points in JavaScript string `\u{...}` escapes. - [#​10141](biomejs/biome#10141) [`46a77d0`](biomejs/biome@46a77d0) Thanks [@​minseong0324](https://github.com/minseong0324)! - Improved [`noMisleadingReturnType`](https://biomejs.dev/linter/rules/no-misleading-return-type/) to detect `object` return annotations that hide built-in global class instances such as `Date`, `Map`, `Set`, `WeakMap`, and `Error`. - [#​10083](biomejs/biome#10083) [`4a664c1`](biomejs/biome@4a664c1) Thanks [@​ematipico](https://github.com/ematipico)! - Added two new options to [`noShadow`](https://biomejs.dev/linter/rules/no-shadow/), both defaulting to `true` to match typescript-eslint's behavior. Fixed [#​9482](biomejs/biome#9482): Added `ignoreFunctionTypeParameterNameValueShadow` option. When enabled, parameter names inside function type annotations (e.g. `(options: unknown) => void`) are not flagged as shadowing outer variables. Fixed [#​7812](biomejs/biome#7812): Added `ignoreTypeValueShadow` option. When enabled, a value binding that shares its name with a type-only declaration (type alias or interface) is not flagged, since types and values occupy separate namespaces in TypeScript. - [#​9286](biomejs/biome#9286) [`52695cf`](biomejs/biome@52695cf) Thanks [@​Hugo-Polloli](https://github.com/Hugo-Polloli)! - Fixed [#​6316](biomejs/biome#6316): Biome now resolves Svelte `$store` references to the underlying `store` binding in semantic analysis, preventing false `noUndeclaredVariables` diagnostics when the store is declared. - [#​10188](biomejs/biome#10188) [`ae659dd`](biomejs/biome@ae659dd) Thanks [@​dyc3](https://github.com/dyc3)! - Added a new nursery rule [`noExcessiveNestedCallbacks`](https://biomejs.dev/linter/rules/no-excessive-nested-callbacks/), which disallows callbacks nested deeper than the configured maximum. - [#​9757](biomejs/biome#9757) [`2c62594`](biomejs/biome@2c62594) Thanks [@​dyc3](https://github.com/dyc3)! - Fixed [#​9450](biomejs/biome#9450): the HTML formatter now correctly preserves multiline formatting for nested `<template>` elements (e.g. `<template #body>`) when the source has children on separate lines. Previously, the children were collapsed onto a single line. ```diff <template> <UModal> - <template #body> <p>content</p> </template> + <template #body> + <p>content</p> + </template> </UModal> </template> ``` - [#​10118](biomejs/biome#10118) [`c6edcb4`](biomejs/biome@c6edcb4) Thanks [@​Netail](https://github.com/Netail)! - Fixed [#​10024](biomejs/biome#10024): `biome migrate eslint` correctly migrates `eslint` rules that belong to multiple Biome rules. </details> --- ### Configuration 📅 **Schedule**: (UTC) - Branch creation - At any time (no schedule defined) - Automerge - At any time (no schedule defined) 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR has been generated by [Mend Renovate](https://github.com/renovatebot/renovate). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0My4xNjAuMiIsInVwZGF0ZWRJblZlciI6IjQzLjE2MC4yIiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6W119--> Reviewed-on: https://git.oirnoir.dev/OIRNOIR/Cloudflared-Runner/pulls/7
This PR contains the following updates: | Package | Type | Update | Change | |---|---|---|---| | [@biomejs/biome](https://biomejs.dev) ([source](https://github.com/biomejs/biome/tree/HEAD/packages/@biomejs/biome)) | imports | patch | [`2.4.13` -> `2.4.14`](https://renovatebot.com/diffs/npm/@biomejs%2fbiome/2.4.13/2.4.14) | --- ### Release Notes <details> <summary>biomejs/biome (@​biomejs/biome)</summary> ### [`v2.4.14`](https://github.com/biomejs/biome/blob/HEAD/packages/@​biomejs/biome/CHANGELOG.md#2414) [Compare Source](https://github.com/biomejs/biome/compare/@biomejs/biome@2.4.13...@biomejs/biome@2.4.14) ##### Patch Changes - [#​9393](biomejs/biome#9393) [`491b171`](biomejs/biome@491b171) Thanks [@​dyc3](https://github.com/dyc3)! - Added the nursery rule [`useTestHooksOnTop`](https://biomejs.dev/linter/rules/use-test-hooks-on-top) in the `test` domain. The rule flags lifecycle hooks (`beforeEach`, `beforeAll`, `afterEach`, `afterAll`) that appear after test cases in the same block, enforcing that hooks are defined before any test case. - [#​10157](biomejs/biome#10157) [`eefc5ab`](biomejs/biome@eefc5ab) Thanks [@​dyc3](https://github.com/dyc3)! - Fixed [#​7882](biomejs/biome#7882): The HTML parser will now emit better diagnostics when it encounters a void element with a closing tag, such as `<br></br>`. Previously, the parser would emit multiple diagnostics with conflicting advice. Now it emits a single diagnostic that clearly states that void elements should not have closing tags. - [#​10054](biomejs/biome#10054) [`0e9f569`](biomejs/biome@0e9f569) Thanks [@​minseong0324](https://github.com/minseong0324)! - [`noMisleadingReturnType`](https://biomejs.dev/linter/rules/no-misleading-return-type/) no longer misses widening from concrete object types, class instances, object literals, tuples, functions, and regular expressions to `: object`. A function annotated `: object` returning an object literal: ```ts function f(): object { return { retry: true }; } ``` - [#​10116](biomejs/biome#10116) [`53269eb`](biomejs/biome@53269eb) Thanks [@​jiwon79](https://github.com/jiwon79)! - Fixed [#​6201](biomejs/biome#6201): [`noUselessEscapeInRegex`](https://biomejs.dev/linter/rules/no-useless-escape-in-regex/) no longer flags an escaped backslash followed by `-` as a useless escape. Patterns like `/[\\-]/` are now considered valid because the second `\` is the escaped backslash, not an unnecessary escape of the trailing dash. - [#​10092](biomejs/biome#10092) [`33d8543`](biomejs/biome@33d8543) Thanks [@​Conaclos](https://github.com/Conaclos)! - Fixed [#​9097](biomejs/biome#9097): [`organizeImports`](https://biomejs.dev/assist/actions/organize-imports/) no longer adds a blank line between a never-matched group and a matched group. Given the following `organizeImports` options: ```json { "groups": [":NODE:", ":BLANK_LINE:", ":PACKAGE:", ":BLANK_LINE:", ":PATH:"] } ``` The following code... ```js // Comment import "package"; import "./file.js"; ``` ...was organized as: ```diff + // Comment import "package"; + import "./file.js"; ``` A blank line was added even though the group ':NODE:' doesn't match any imports here. `:BLANK_LINE:` between never-matched groups and matched groups are now ignored. The code is now organized as: ```diff // Comment import "package"; + import "./file.js"; ``` - [#​10138](biomejs/biome#10138) [`a10b6c1`](biomejs/biome@a10b6c1) Thanks [@​dyc3](https://github.com/dyc3)! - Fixed Vue `v-for` handling for [`noUndeclaredVariables`](https://biomejs.dev/linter/rules/no-undeclared-variables/) and [`noUnusedVariables`](https://biomejs.dev/linter/rules/no-unused-variables/). Biome now recognizes variables declared by `v-for` directives and references to iterated values in Vue templates. - [#​10115](biomejs/biome#10115) [`d428d76`](biomejs/biome@d428d76) Thanks [@​minseong0324](https://github.com/minseong0324)! - [`noMisleadingReturnType`](https://biomejs.dev/linter/rules/no-misleading-return-type/) no longer reports false positives when a union return type's `boolean` variant is covered by both `true` and `false` returns. - [#​9922](biomejs/biome#9922) [`7acf1e0`](biomejs/biome@7acf1e0) Thanks [@​dyc3](https://github.com/dyc3)! - Added the new nursery rule [`noReactStringRefs`](https://biomejs.dev/linter/rules/no-react-string-refs/), which disallows legacy React string refs such as `ref="hello"` and `this.refs.hello`. Biome also reports template-literal refs such as ``ref={`hello`}``, so React code can consistently migrate to callback refs, `createRef()`, or `useRef()`. - [#​10010](biomejs/biome#10010) [`f3e76ab`](biomejs/biome@f3e76ab) Thanks [@​dyc3](https://github.com/dyc3)! - Fixed a bug in the LSP file watcher registration so Biome now watches `.biome.json` and `.biome.jsonc` configuration files and reloads workspace settings when they change. - [#​10176](biomejs/biome#10176) [`8a40ef8`](biomejs/biome@8a40ef8) Thanks [@​dyc3](https://github.com/dyc3)! - Fixed [#​10011](biomejs/biome#10011): The [`noThisInStatic`](https://biomejs.dev/linter/rules/no-this-in-static/) rule no longer reports `this` when it is used as the constructor target in `new this(...)`, which is required for inherited static factory methods. - [#​10163](biomejs/biome#10163) [`6867e96`](biomejs/biome@6867e96) Thanks [@​jiwon79](https://github.com/jiwon79)! - Fixed [#​9884](biomejs/biome#9884): The [`useSortedAttributes`](https://biomejs.dev/assist/actions/use-sorted-attributes/) auto-fix no longer corrupts source code when both an outer JSX element and a nested JSX-valued attribute have unsorted attributes in the same pass. Multiple unsorted groups separated by spread or shorthand attributes within the same JSX element are now reported as a single diagnostic. - [#​10079](biomejs/biome#10079) [`d29dd19`](biomejs/biome@d29dd19) Thanks [@​Damix48](https://github.com/Damix48)! - Fixed false positive in `noAssignInExpressions` for Svelte `{@​const}` blocks. Assignments in `{@​const name = value}` are now correctly recognized as declarations rather than accidental assignments in expressions. - [#​10080](biomejs/biome#10080) [`5d8fdac`](biomejs/biome@5d8fdac) Thanks [@​Damix48](https://github.com/Damix48)! - Fixed parsing of closing parentheses in Svelte `{#each}` block key expressions. Biome now correctly parses method calls and other parenthesised expressions used as keys. For example, the following snippets are now parsed correctly: ```svelte {#each numbers as number, index (number.toString())} <p>{number}</p> {/each} {#each numbers as number (key(number))} <p>{number}</p> {/each} ``` - [#​10140](biomejs/biome#10140) [`e7024b9`](biomejs/biome@e7024b9) Thanks [@​solithcy](https://github.com/solithcy)! - Fixed [#​10135](biomejs/biome#10135): Biome no longer crashes on missing Svelte template expressions. The following code snippet longer panics: ```svelte {#if } <p>^ this would previously crash</p> {/if} {@​const } <p> ^ this would also crash</p> ``` - [#​10111](biomejs/biome#10111) [`7818009`](biomejs/biome@7818009) Thanks [@​jiwon79](https://github.com/jiwon79)! - Fixed [#​9997](biomejs/biome#9997): [`noDuplicateSelectors`](https://biomejs.dev/linter/rules/no-duplicate-selectors/) no longer reports false positives for selectors inside `@scope` queries. Biome now treats `@scope` as a separate at-rule context, like `@media`, `@supports`, `@container`, and `@starting-style`. The following snippet is no longer flagged as a duplicate: ```css .Example { padding: 0; } @​scope (.theme-dark) { .Example { color: white; } } ``` - [#​9926](biomejs/biome#9926) [`d62b331`](biomejs/biome@d62b331) Thanks [@​dyc3](https://github.com/dyc3)! - Added the nursery lint rule [`useMathMinMax`](https://biomejs.dev/linter/rules/use-math-min-max/), which prefers `Math.min()` and `Math.max()` over equivalent ternary comparisons. For example, this code: ```js const min = a < b ? a : b; ``` is much more readable when rewritten as: ```js const min = Math.min(a, b); ``` - [#​10115](biomejs/biome#10115) [`d428d76`](biomejs/biome@d428d76) Thanks [@​minseong0324](https://github.com/minseong0324)! - [`useExhaustiveSwitchCases`](https://biomejs.dev/linter/rules/use-exhaustive-switch-cases/) now flags missing `true`/`false` cases for `boolean` discriminants, including when `boolean` is a union variant. - [#​10125](biomejs/biome#10125) [`a55a0b6`](biomejs/biome@a55a0b6) Thanks [@​bmish](https://github.com/bmish)! - Fixed a resolver bug where packages that define a typed entry point through `package.json`'s `main` field but omit `types` were ignored during type-aware resolution. Type-aware rules such as [`noFloatingPromises`](https://biomejs.dev/linter/rules/no-floating-promises/) can now inspect imports from those packages. - [#​10117](biomejs/biome#10117) [`895e809`](biomejs/biome@895e809) Thanks [@​denizdogan](https://github.com/denizdogan)! - Added support for the `corner-shape` family of CSS properties and the `superellipse()`/`squircle()` value functions, so [`noUnknownProperty`](https://biomejs.dev/linter/rules/no-unknown-property/) and [`noUnknownFunction`](https://biomejs.dev/linter/rules/no-unknown-function/) no longer flag them as unknown. New known properties: `corner-shape`, `corner-block-end-shape`, `corner-block-start-shape`, `corner-bottom-left-shape`, `corner-bottom-right-shape`, `corner-bottom-shape`, `corner-end-end-shape`, `corner-end-start-shape`, `corner-inline-end-shape`, `corner-inline-start-shape`, `corner-left-shape`, `corner-right-shape`, `corner-start-end-shape`, `corner-start-start-shape`, `corner-top-left-shape`, `corner-top-right-shape`, `corner-top-shape`. New known value functions: `superellipse()`, `squircle()`. - [#​8620](biomejs/biome#8620) [`8df8f73`](biomejs/biome@8df8f73) Thanks [@​dyc3](https://github.com/dyc3)! - Fixed [#​8062](biomejs/biome#8062): Added support for parsing Vue `v-for` directives more accurately. - [#​10191](biomejs/biome#10191) [`aa055cd`](biomejs/biome@aa055cd) Thanks [@​guney](https://github.com/guney)! - Now the rule [`noStaticElementInteractions`](https://biomejs.dev/linter/rules/no-static-element-interactions/) doesn't trigger custom elements. - [#​9757](biomejs/biome#9757) [`2c62594`](biomejs/biome@2c62594) Thanks [@​dyc3](https://github.com/dyc3)! - Fixed [#​9099](biomejs/biome#9099): the HTML formatter collapsing non-text children (inline elements, Svelte expressions, comments) onto a single line when the source had them on separate lines. Biome now preserves the user's intended line breaks for exclusively non-text children. For example, the following Svelte snippet is now preserved instead of being collapsed to `<div>{name}<!-- comment --></div>`: ```svelte <div> {name}<!-- comment --> </div> ``` Similarly, HTML elements like `<span>` inside a `<div>` are now preserved when written on their own line: ```html <div> <span>text</span> </div> ``` - [#​10105](biomejs/biome#10105) [`e7c1a6d`](biomejs/biome@e7c1a6d) Thanks [@​jiwon79](https://github.com/jiwon79)! - Fixed [#​10039](biomejs/biome#10039): [`useReadonlyClassProperties`](https://biomejs.dev/linter/rules/use-readonly-class-properties/) now detects unreassigned private members in class expressions and export default classes, not only in class declarations. The following patterns are now correctly flagged: ```ts const AnonClass = class { #prop = 123; constructor() { console.log(this.#prop); } }; export default class { #prop = 123; constructor() { console.log(this.#prop); } } ``` - [#​10141](biomejs/biome#10141) [`46a77d0`](biomejs/biome@46a77d0) Thanks [@​minseong0324](https://github.com/minseong0324)! - Improved [`noUnnecessaryConditions`](https://biomejs.dev/linter/rules/no-unnecessary-conditions/) to detect conditions that are always truthy because they check built-in global class instances such as `Date`, `Map`, `Set`, `WeakMap`, and `Error`. - [#​10178](biomejs/biome#10178) [`7b05a89`](biomejs/biome@7b05a89) Thanks [@​dyc3](https://github.com/dyc3)! - Fixed [#​10177](biomejs/biome#10177): The HTML parser no longer reports lowercase `html` or `doctype` text as invalid after void elements such as `<br>`. - [#​10155](biomejs/biome#10155) [`0d4595d`](biomejs/biome@0d4595d) Thanks [@​jiwon79](https://github.com/jiwon79)! - Fixed [#​10045](biomejs/biome#10045): the CSS formatter no longer compounds indentation inside nested functional pseudo-classes such as `:not(:where(...))`, `:is(:where(...))`, and similar combinations. The same fix also removes one level of unnecessary indentation that was added inside any pseudo-class function whose argument list wrapped onto multiple lines, including `:nth-child(... of ...)`, `::part(...)`, and `:active-view-transition-type(...)`. The following snippet is now correctly formatted, matching Prettier. ```css input:not( :where( [type="submit"], [type="checkbox"], [type="radio"], [type="button"], [type="reset"] ) ) { inline-size: 100%; } ``` - [#​10112](biomejs/biome#10112) [`6f0251e`](biomejs/biome@6f0251e) Thanks [@​dyc3](https://github.com/dyc3)! - Fixed [#​10110](biomejs/biome#10110): Biome's parser now accepts surrogate code points in JavaScript string `\u{...}` escapes. - [#​10141](biomejs/biome#10141) [`46a77d0`](biomejs/biome@46a77d0) Thanks [@​minseong0324](https://github.com/minseong0324)! - Improved [`noMisleadingReturnType`](https://biomejs.dev/linter/rules/no-misleading-return-type/) to detect `object` return annotations that hide built-in global class instances such as `Date`, `Map`, `Set`, `WeakMap`, and `Error`. - [#​10083](biomejs/biome#10083) [`4a664c1`](biomejs/biome@4a664c1) Thanks [@​ematipico](https://github.com/ematipico)! - Added two new options to [`noShadow`](https://biomejs.dev/linter/rules/no-shadow/), both defaulting to `true` to match typescript-eslint's behavior. Fixed [#​9482](biomejs/biome#9482): Added `ignoreFunctionTypeParameterNameValueShadow` option. When enabled, parameter names inside function type annotations (e.g. `(options: unknown) => void`) are not flagged as shadowing outer variables. Fixed [#​7812](biomejs/biome#7812): Added `ignoreTypeValueShadow` option. When enabled, a value binding that shares its name with a type-only declaration (type alias or interface) is not flagged, since types and values occupy separate namespaces in TypeScript. - [#​9286](biomejs/biome#9286) [`52695cf`](biomejs/biome@52695cf) Thanks [@​Hugo-Polloli](https://github.com/Hugo-Polloli)! - Fixed [#​6316](biomejs/biome#6316): Biome now resolves Svelte `$store` references to the underlying `store` binding in semantic analysis, preventing false `noUndeclaredVariables` diagnostics when the store is declared. - [#​10188](biomejs/biome#10188) [`ae659dd`](biomejs/biome@ae659dd) Thanks [@​dyc3](https://github.com/dyc3)! - Added a new nursery rule [`noExcessiveNestedCallbacks`](https://biomejs.dev/linter/rules/no-excessive-nested-callbacks/), which disallows callbacks nested deeper than the configured maximum. - [#​9757](biomejs/biome#9757) [`2c62594`](biomejs/biome@2c62594) Thanks [@​dyc3](https://github.com/dyc3)! - Fixed [#​9450](biomejs/biome#9450): the HTML formatter now correctly preserves multiline formatting for nested `<template>` elements (e.g. `<template #body>`) when the source has children on separate lines. Previously, the children were collapsed onto a single line. ```diff <template> <UModal> - <template #body> <p>content</p> </template> + <template #body> + <p>content</p> + </template> </UModal> </template> ``` - [#​10118](biomejs/biome#10118) [`c6edcb4`](biomejs/biome@c6edcb4) Thanks [@​Netail](https://github.com/Netail)! - Fixed [#​10024](biomejs/biome#10024): `biome migrate eslint` correctly migrates `eslint` rules that belong to multiple Biome rules. </details> --- ### Configuration 📅 **Schedule**: (UTC) - Branch creation - At any time (no schedule defined) - Automerge - At any time (no schedule defined) 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR has been generated by [Mend Renovate](https://github.com/renovatebot/renovate). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0My4xNjAuMiIsInVwZGF0ZWRJblZlciI6IjQzLjE2MC4yIiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6W119--> Reviewed-on: https://git.oirnoir.dev/OIRNOIR/YouTube-Helper-Server/pulls/10
Fixes #6316
Summary
This PR enforces one invariant across the pipeline: in Svelte-flavored code,
$storemust resolve consistently to the backingstorebinding (or report consistently when missing).The fix spans semantic extraction, analyzer policy, rename, and service routing because the bug crossed those layers. Keeping any layer on old behavior reintroduced mismatches.
SemanticFlavorso Svelte-specific identifier behavior is modeled in semantic extraction/builder paths.$storeread behavior semantically while preserving unresolved diagnostics for real misses.$store = ...) in rules relying on semantic writes.noUndeclaredVariablesfallback policy:$name -> namefallback applies to configured globals and embedded bindings, but not generic env globals (for example avoids$locationfalse negatives).$and collision checks validate the effective transformed name..svelte.jsand.svelte.ts) so they use JS capabilities, while.sveltecomponent documents keep Svelte handler behavior.This also establishes reusable Svelte semantic infrastructure (flavor + routing/plumbing consistency) that future Svelte 5 rune semantics can build on without another cross-layer refactor.
Test Plan
$storeresolves to declaredstorebindings,$edge cases remain diagnostic,.svelte,.svelte.ts, and.svelte.jsstore dereference scenarios,$locationnow reports undeclared unless explicitly backed by policy/binding).noConstAssign/noImportAssignfalse positives.$prefix,.svelte.jsand.svelte.tssource modules expose JS capabilities (including rename and pull diagnostics/actions),.sveltecomponent files keep Svelte capability behavior.Docs