diff --git a/crates/biome_configuration/src/generated/linter_options_check.rs b/crates/biome_configuration/src/generated/linter_options_check.rs index 33b0ac669c79..1617cf8c2269 100644 --- a/crates/biome_configuration/src/generated/linter_options_check.rs +++ b/crates/biome_configuration/src/generated/linter_options_check.rs @@ -380,6 +380,11 @@ pub fn config_side_rule_options_types() -> Vec<(&'static str, &'static str, Type "noDuplicateProperties", TypeId::of::(), )); + result.push(( + "nursery", + "noDuplicateSelectors", + TypeId::of::(), + )); result.push(("suspicious", "noDuplicateSelectorsKeyframeBlock", TypeId::of::())); result.push(( "suspicious", diff --git a/crates/biome_html_parser/src/lexer/mod.rs b/crates/biome_html_parser/src/lexer/mod.rs index b7af4a76391c..6ef828130134 100644 --- a/crates/biome_html_parser/src/lexer/mod.rs +++ b/crates/biome_html_parser/src/lexer/mod.rs @@ -1327,6 +1327,7 @@ impl<'src> Lexer<'src> for HtmlLexer<'src> { self.current_kind } + #[inline] fn current_start(&self) -> TextSize { self.current_start } @@ -1428,11 +1429,13 @@ impl<'src> Lexer<'src> for HtmlLexer<'src> { self.diagnostics.push(diagnostic); } + #[inline] fn advance_char_unchecked(&mut self) { let c = self.current_char_unchecked(); self.position += c.len_utf8(); } + #[inline] fn advance(&mut self, n: usize) { self.position += n; } diff --git a/crates/biome_html_parser/src/syntax/astro.rs b/crates/biome_html_parser/src/syntax/astro.rs index 9ef7e6b1af4e..d90190e80f0a 100644 --- a/crates/biome_html_parser/src/syntax/astro.rs +++ b/crates/biome_html_parser/src/syntax/astro.rs @@ -163,10 +163,12 @@ pub const ASTRO_DIRECTIVE_TOKEN_SET: TokenSet = token_set![ T![define], ]; +#[inline] pub(crate) fn is_at_astro_directive_keyword(p: &mut HtmlParser) -> bool { p.at_ts(ASTRO_DIRECTIVE_TOKEN_SET) } +#[inline] pub(crate) fn is_astro_directive_keyword(token: HtmlSyntaxKind) -> bool { ASTRO_DIRECTIVE_TOKEN_SET.contains(token) } diff --git a/crates/biome_html_parser/src/syntax/mod.rs b/crates/biome_html_parser/src/syntax/mod.rs index 94fce7549b03..ed3d955b4cd2 100644 --- a/crates/biome_html_parser/src/syntax/mod.rs +++ b/crates/biome_html_parser/src/syntax/mod.rs @@ -158,6 +158,7 @@ fn inside_tag_context(p: &HtmlParser) -> HtmlLexContext { } } +#[inline] fn is_possible_component(p: &HtmlParser, tag_name: &str) -> bool { tag_name .chars() @@ -352,6 +353,7 @@ fn parse_closing_tag(p: &mut HtmlParser) -> ParsedSyntax { Present(m.complete(p, HTML_CLOSING_ELEMENT)) } +#[inline] pub(crate) fn parse_html_element(p: &mut HtmlParser) -> ParsedSyntax { match p.cur() { T![" parse_cdata_section(p), @@ -540,6 +542,7 @@ fn parse_attribute(p: &mut HtmlParser) -> ParsedSyntax { } } +#[inline] fn is_at_attribute_start(p: &mut HtmlParser) -> bool { p.at_ts(token_set![ HTML_LITERAL, @@ -552,6 +555,7 @@ fn is_at_attribute_start(p: &mut HtmlParser) -> bool { || (Astro.is_supported(p) && is_at_astro_directive_keyword(p)) } +#[inline] fn parse_literal(p: &mut HtmlParser, kind: HtmlSyntaxKind) -> ParsedSyntax { if !is_at_start_literal(p) { return Absent; @@ -596,6 +600,7 @@ fn parse_literal(p: &mut HtmlParser, kind: HtmlSyntaxKind) -> ParsedSyntax { Present(m.complete(p, kind)) } +#[inline] fn is_at_start_literal(p: &mut HtmlParser) -> bool { p.at(HTML_LITERAL) || p.at(T!["{{"]) || p.at(T!["}}"]) } @@ -720,6 +725,7 @@ fn parse_double_text_expression(p: &mut HtmlParser, context: HtmlLexContext) -> } } +#[inline] pub(crate) fn is_at_opening_double_expression(p: &mut HtmlParser) -> bool { p.at(T!["{{"]) } @@ -840,10 +846,12 @@ impl TextExpression { } } +#[inline] fn is_at_keyword(p: &mut HtmlParser) -> bool { is_at_svelte_keyword(p) || is_at_html_keyword(p) } +#[inline] fn is_at_html_keyword(p: &mut HtmlParser) -> bool { matches!(p.cur(), T![html] | T![doctype]) } diff --git a/crates/biome_html_parser/src/syntax/svelte.rs b/crates/biome_html_parser/src/syntax/svelte.rs index 3bb7738faf07..1c774e4f1fcb 100644 --- a/crates/biome_html_parser/src/syntax/svelte.rs +++ b/crates/biome_html_parser/src/syntax/svelte.rs @@ -1255,18 +1255,22 @@ const SVELTE_DIRECTIVE_KEYWORDS: TokenSet = token_set!( T![animate] ); +#[inline] pub(crate) fn is_at_svelte_keyword(p: &HtmlParser) -> bool { p.at_ts(SVELTE_KEYWORDS) } +#[inline] fn is_at_svelte_directive_keyword(token: HtmlSyntaxKind) -> bool { SVELTE_DIRECTIVE_KEYWORDS.contains(token) } +#[inline] fn is_at_else_opening_block(p: &mut HtmlParser) -> bool { p.at(T!["{:"]) && p.nth_at(1, T![else]) } +#[inline] fn is_at_then_or_catch_block(p: &mut HtmlParser) -> bool { p.at(T!["{:"]) && (p.nth_at(1, T![then]) || p.nth_at(1, T![catch])) }