From a2815f468db7f8aeadff2d705021958ecd4fe1e0 Mon Sep 17 00:00:00 2001 From: Victorien Elvinger Date: Thu, 17 Oct 2024 19:24:01 +0200 Subject: [PATCH] release: v1.9.4 (#4320) --- CHANGELOG.md | 69 ++++++++--------- .../lint/nursery/no_duplicate_properties.rs | 2 +- .../lint/nursery/no_unknown_type_selector.rs | 2 +- .../src/lint/nursery/no_document_cookie.rs | 2 +- .../nursery/no_document_import_in_page.rs | 2 +- .../src/lint/nursery/no_head_element.rs | 2 +- .../nursery/no_head_import_in_document.rs | 2 +- .../src/lint/nursery/no_img_element.rs | 2 +- .../src/lint/nursery/no_useless_string_raw.rs | 2 +- .../src/lint/nursery/use_at_index.rs | 2 +- .../src/lint/nursery/use_collapsed_if.rs | 2 +- .../lint/nursery/use_google_font_display.rs | 2 +- .../src/lint/nursery/use_guard_for_in.rs | 2 +- .../src/generated/node_factory.rs | 7 -- .../src/generated/syntax_factory.rs | 9 +-- .../src/js/module/import_namespace_clause.rs | 4 - .../module/import/import_defer_attribute.js | 1 - .../import/import_defer_attribute.js.snap | 36 --------- crates/biome_js_parser/src/lexer/mod.rs | 1 - crates/biome_js_parser/src/syntax/module.rs | 9 --- crates/biome_js_parser/src/tests.rs | 2 +- .../inline/err/import_defer_clause.js | 1 - .../inline/err/import_defer_clause.rast | 76 ------------------- .../test_data/inline/err/import_err.rast | 12 +-- .../test_data/inline/ok/import_decl.rast | 10 +-- .../inline/ok/import_defer_clause.js | 1 - .../inline/ok/import_defer_clause.rast | 50 ------------ .../inline/ok/ts_import_clause_types.rast | 10 +-- crates/biome_js_syntax/src/generated/kind.rs | 5 +- crates/biome_js_syntax/src/generated/nodes.rs | 17 +---- .../src/generated/nodes_mut.rs | 14 +--- packages/@biomejs/biome/package.json | 2 +- xtask/codegen/js.ungram | 1 - xtask/codegen/src/js_kinds_src.rs | 1 - 34 files changed, 68 insertions(+), 294 deletions(-) delete mode 100644 crates/biome_js_formatter/tests/specs/js/module/import/import_defer_attribute.js delete mode 100644 crates/biome_js_formatter/tests/specs/js/module/import/import_defer_attribute.js.snap delete mode 100644 crates/biome_js_parser/test_data/inline/err/import_defer_clause.js delete mode 100644 crates/biome_js_parser/test_data/inline/err/import_defer_clause.rast delete mode 100644 crates/biome_js_parser/test_data/inline/ok/import_defer_clause.js delete mode 100644 crates/biome_js_parser/test_data/inline/ok/import_defer_clause.rast diff --git a/CHANGELOG.md b/CHANGELOG.md index b10b13a1f18b..b9cebcfd8066 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,7 +9,7 @@ New entries must be placed in a section entitled `Unreleased`. Read our [guidelines for writing a good changelog entry](https://github.com/biomejs/biome/blob/main/CONTRIBUTING.md#changelog). -## Unreleased +## v1.9.4 (2024-10-17) ### Analyzer @@ -17,8 +17,9 @@ our [guidelines for writing a good changelog entry](https://github.com/biomejs/b - Improved the message for unused suppression comments. Contributed by @dyc3 -- Fix [#4228](https://github.com/biomejs/biome/issues/4228), where the rule `a11y/noInteractiveElementToNoninteractiveRole` incorrectlly reports a `role` for non interactive elements. Contributed by @eryue0220 -- Catch suspicious semicolon in react fragment in `noSuspiciousSemicolonInJsx`. Contributed by @vasucp1207 +- Fix [#4228](https://github.com/biomejs/biome/issues/4228), where the rule `a11y/noInteractiveElementToNoninteractiveRole` incorrectly reports a `role` for non-interactive elements. Contributed by @eryue0220 + +- `noSuspiciousSemicolonInJsx` now catches suspicious semicolons in React fragments. Contributed by @vasucp1207 ### CLI @@ -48,13 +49,17 @@ our [guidelines for writing a good changelog entry](https://github.com/biomejs/b #### New features +- Add [useGuardForIn](https://biomejs.dev/linter/rules/use-guard-for-in/). Contributed by @fireairforce - Add [noDocumentCookie](https://biomejs.dev/linter/rules/no-document-cookie/). Contributed by @tunamaguro - Add [noDocumentImportInPage](https://biomejs.dev/linter/rules/no-document-import-in-page/). Contributed by @kaioduarte +- Add [noDuplicateProperties](https://biomejs.dev/linter/rules/no-duplicate-properties/). Contributed by @togami2864 - Add [noHeadElement](https://biomejs.dev/linter/rules/no-head-element/). Contributed by @kaioduarte - Add [noHeadImportInDocument](https://biomejs.dev/linter/rules/no-head-import-in-document/). Contributed by @kaioduarte - Add [noImgElement](https://biomejs.dev/linter/rules/no-img-element/). Contributed by @kaioduarte -- Add [guardForIn](https://biomejs.dev/linter/rules/guard-for-in/). Contributed by @fireairforce -- Add [noUselessStringRaw](https://github.com/biomejs/biome/pull/4263). Contributed by @fireairforce +- Add [noUnknownTypeSelector](https://biomejs.dev/linter/rules/no-unknown-type-selector/). Contributed by @Kazuhiro-Mimaki +- Add [useAtIndex](https://biomejs.dev/linter/rules/use-at-index/). Contributed by @GunseiKPaseri +- Add [noUselessStringRaw](https://biomejs.dev/linter/rules/no-useless-string-raw/). Contributed by @fireairforce +- Add [nursery/useCollapsedIf](https://biomejs.dev/linter/rules/use-collapsed-if/). Contributed by @siketyan - Add [useGoogleFontDisplay](https://biomejs.dev/linter/rules/use-google-font-display/). Contributed by @kaioduarte #### Bug Fixes @@ -64,10 +69,10 @@ our [guidelines for writing a good changelog entry](https://github.com/biomejs/b This fixes a regression introduced in Biome 1.9.3 The regression affected the following linter rules: - - nursery/useSortedClasses - - nursery/useTrimStartEnd - - style/useTemplate - - suspicious/noMisleadingCharacterClass + - `nursery/useSortedClasses` + - `nursery/useTrimStartEnd` + - `style/useTemplate` + - `suspicious/noMisleadingCharacterClass` Contributed by @Conaclos @@ -167,13 +172,13 @@ our [guidelines for writing a good changelog entry](https://github.com/biomejs/b - [noUnknownFunction](https://biomejs.dev/linter/rules/no-unknown-function/) correctly handles `calc-size` function ([#4212](https://github.com/biomejs/biome/issues/4212)). - The following code `calc-size` is no longer reported as unknown: + The following code `calc-size` is no longer reported as unknown: - ```css - .a { height: calc-size(0px); } - ``` + ```css + .a { height: calc-size(0px); } + ``` - Contributed by @fireairforce + Contributed by @fireairforce - [useNamingConvention](https://biomejs.dev/linter/rules/use-naming-convention/) now allows configuring conventions for readonly index signatures. @@ -184,34 +189,12 @@ our [guidelines for writing a good changelog entry](https://github.com/biomejs/b ### Parser -#### New features - -- Add support for parsing the defer attribute in import statements ([#4215](https://github.com/biomejs/biome/issues/4215)). - - ```js - import defer * as myModule from "my-module"; - ``` - - Contributed by @fireairforce - -- Add support for parsing typescript's `resolution-mode` in Import Types([#2115](https://github.com/biomejs/biome/issues/2115)) - - ```ts - export type Fs = typeof import('fs', { with: { 'resolution-mode': 'import' } }); - export type TypeFromRequire = - import("pkg", { with: { "resolution-mode": "require" } }).TypeFromRequire; - export type TypeFromImport = - import("pkg", { with: { "resolution-mode": "import" } }).TypeFromImport; - ``` - - Contributed by @fireairforce - #### Bug Fixes - The CSS parser now accepts more emoji in identifiers ([#3627](https://github.com/biomejs/biome/issues/3627#issuecomment-2392388022)). Browsers accept more emoji than the standard allows. - Biome now accepts these additional emoji. + Biome now accepts these additional emojis. The following code is now correctly parsed: @@ -224,6 +207,18 @@ our [guidelines for writing a good changelog entry](https://github.com/biomejs/b Contributed by @Conaclos +- Add support for parsing typescript's `resolution-mode` in Import Types([#2115](https://github.com/biomejs/biome/issues/2115)) + + ```ts + export type Fs = typeof import('fs', { with: { 'resolution-mode': 'import' } }); + export type TypeFromRequire = + import("pkg", { with: { "resolution-mode": "require" } }).TypeFromRequire; + export type TypeFromImport = + import("pkg", { with: { "resolution-mode": "import" } }).TypeFromImport; + ``` + + Contributed by @fireairforce + ## v1.9.3 (2024-10-01) ### CLI diff --git a/crates/biome_css_analyze/src/lint/nursery/no_duplicate_properties.rs b/crates/biome_css_analyze/src/lint/nursery/no_duplicate_properties.rs index e0595b1fac44..743e964a3d52 100644 --- a/crates/biome_css_analyze/src/lint/nursery/no_duplicate_properties.rs +++ b/crates/biome_css_analyze/src/lint/nursery/no_duplicate_properties.rs @@ -35,7 +35,7 @@ declare_lint_rule! { /// ``` /// pub NoDuplicateProperties { - version: "next", + version: "1.9.4", name: "noDuplicateProperties", language: "css", recommended: true, diff --git a/crates/biome_css_analyze/src/lint/nursery/no_unknown_type_selector.rs b/crates/biome_css_analyze/src/lint/nursery/no_unknown_type_selector.rs index 16f521723d54..17427c32929e 100644 --- a/crates/biome_css_analyze/src/lint/nursery/no_unknown_type_selector.rs +++ b/crates/biome_css_analyze/src/lint/nursery/no_unknown_type_selector.rs @@ -50,7 +50,7 @@ declare_lint_rule! { /// ``` /// pub NoUnknownTypeSelector { - version: "next", + version: "1.9.4", name: "noUnknownTypeSelector", language: "css", recommended: true, diff --git a/crates/biome_js_analyze/src/lint/nursery/no_document_cookie.rs b/crates/biome_js_analyze/src/lint/nursery/no_document_cookie.rs index 7aa8b22d4fc7..ef5d5dcbf866 100644 --- a/crates/biome_js_analyze/src/lint/nursery/no_document_cookie.rs +++ b/crates/biome_js_analyze/src/lint/nursery/no_document_cookie.rs @@ -50,7 +50,7 @@ declare_lint_rule! { /// ``` /// pub NoDocumentCookie { - version: "next", + version: "1.9.4", name: "noDocumentCookie", language: "js", recommended: false, diff --git a/crates/biome_js_analyze/src/lint/nursery/no_document_import_in_page.rs b/crates/biome_js_analyze/src/lint/nursery/no_document_import_in_page.rs index 08c02cc656fb..246f0766b877 100644 --- a/crates/biome_js_analyze/src/lint/nursery/no_document_import_in_page.rs +++ b/crates/biome_js_analyze/src/lint/nursery/no_document_import_in_page.rs @@ -30,7 +30,7 @@ declare_lint_rule! { /// ``` /// pub NoDocumentImportInPage { - version: "next", + version: "1.9.4", name: "noDocumentImportInPage", language: "jsx", sources: &[RuleSource::EslintNext("no-document-import-in-page")], diff --git a/crates/biome_js_analyze/src/lint/nursery/no_head_element.rs b/crates/biome_js_analyze/src/lint/nursery/no_head_element.rs index 8384ae9f9368..ebd0adfe918e 100644 --- a/crates/biome_js_analyze/src/lint/nursery/no_head_element.rs +++ b/crates/biome_js_analyze/src/lint/nursery/no_head_element.rs @@ -44,7 +44,7 @@ declare_lint_rule! { /// } /// ``` pub NoHeadElement { - version: "next", + version: "1.9.4", name: "noHeadElement", language: "jsx", sources: &[RuleSource::EslintNext("no-head-element")], diff --git a/crates/biome_js_analyze/src/lint/nursery/no_head_import_in_document.rs b/crates/biome_js_analyze/src/lint/nursery/no_head_import_in_document.rs index ffc1ea7e40c8..27c3f5c70819 100644 --- a/crates/biome_js_analyze/src/lint/nursery/no_head_import_in_document.rs +++ b/crates/biome_js_analyze/src/lint/nursery/no_head_import_in_document.rs @@ -43,7 +43,7 @@ declare_lint_rule! { /// ``` /// pub NoHeadImportInDocument { - version: "next", + version: "1.9.4", name: "noHeadImportInDocument", language: "jsx", sources: &[RuleSource::EslintNext("no-head-import-in-document")], diff --git a/crates/biome_js_analyze/src/lint/nursery/no_img_element.rs b/crates/biome_js_analyze/src/lint/nursery/no_img_element.rs index 6164b9409f98..109fe9fe462f 100644 --- a/crates/biome_js_analyze/src/lint/nursery/no_img_element.rs +++ b/crates/biome_js_analyze/src/lint/nursery/no_img_element.rs @@ -52,7 +52,7 @@ declare_lint_rule! { /// ``` /// pub NoImgElement { - version: "next", + version: "1.9.4", name: "noImgElement", language: "jsx", sources: &[RuleSource::EslintNext("no-img-element")], diff --git a/crates/biome_js_analyze/src/lint/nursery/no_useless_string_raw.rs b/crates/biome_js_analyze/src/lint/nursery/no_useless_string_raw.rs index 85f30f6578d9..82b1cde4ef42 100644 --- a/crates/biome_js_analyze/src/lint/nursery/no_useless_string_raw.rs +++ b/crates/biome_js_analyze/src/lint/nursery/no_useless_string_raw.rs @@ -30,7 +30,7 @@ declare_lint_rule! { /// String.raw`\n`; /// ``` pub NoUselessStringRaw { - version: "next", + version: "1.9.4", name: "noUselessStringRaw", language: "js", recommended: false, diff --git a/crates/biome_js_analyze/src/lint/nursery/use_at_index.rs b/crates/biome_js_analyze/src/lint/nursery/use_at_index.rs index f2299963c7e9..d7a6ecb4ae54 100644 --- a/crates/biome_js_analyze/src/lint/nursery/use_at_index.rs +++ b/crates/biome_js_analyze/src/lint/nursery/use_at_index.rs @@ -73,7 +73,7 @@ declare_lint_rule! { /// array[array.length - 1] = foo; /// ``` pub UseAtIndex { - version: "next", + version: "1.9.4", name: "useAtIndex", language: "js", recommended: false, diff --git a/crates/biome_js_analyze/src/lint/nursery/use_collapsed_if.rs b/crates/biome_js_analyze/src/lint/nursery/use_collapsed_if.rs index 6e1b337538d7..f5707629c673 100644 --- a/crates/biome_js_analyze/src/lint/nursery/use_collapsed_if.rs +++ b/crates/biome_js_analyze/src/lint/nursery/use_collapsed_if.rs @@ -64,7 +64,7 @@ declare_lint_rule! { /// ``` /// pub UseCollapsedIf { - version: "next", + version: "1.9.4", name: "useCollapsedIf", language: "js", sources: &[ diff --git a/crates/biome_js_analyze/src/lint/nursery/use_google_font_display.rs b/crates/biome_js_analyze/src/lint/nursery/use_google_font_display.rs index d790a3237d88..5c4e6f1cc494 100644 --- a/crates/biome_js_analyze/src/lint/nursery/use_google_font_display.rs +++ b/crates/biome_js_analyze/src/lint/nursery/use_google_font_display.rs @@ -49,7 +49,7 @@ declare_lint_rule! { /// /// ``` pub UseGoogleFontDisplay { - version: "next", + version: "1.9.4", name: "useGoogleFontDisplay", language: "jsx", sources: &[RuleSource::EslintNext("google-font-display")], diff --git a/crates/biome_js_analyze/src/lint/nursery/use_guard_for_in.rs b/crates/biome_js_analyze/src/lint/nursery/use_guard_for_in.rs index 85ff1a57cb61..2d27c36ac9b5 100644 --- a/crates/biome_js_analyze/src/lint/nursery/use_guard_for_in.rs +++ b/crates/biome_js_analyze/src/lint/nursery/use_guard_for_in.rs @@ -52,7 +52,7 @@ declare_lint_rule! { /// ``` /// pub UseGuardForIn { - version: "next", + version: "1.9.4", name: "useGuardForIn", language: "js", sources: &[RuleSource::Eslint("guard-for-in")], diff --git a/crates/biome_js_factory/src/generated/node_factory.rs b/crates/biome_js_factory/src/generated/node_factory.rs index 99ae9e84c5be..2ba91fb3c91d 100644 --- a/crates/biome_js_factory/src/generated/node_factory.rs +++ b/crates/biome_js_factory/src/generated/node_factory.rs @@ -2209,7 +2209,6 @@ pub fn js_import_namespace_clause( from_token, source, type_token: None, - defer_token: None, assertion: None, } } @@ -2218,7 +2217,6 @@ pub struct JsImportNamespaceClauseBuilder { from_token: SyntaxToken, source: AnyJsModuleSource, type_token: Option, - defer_token: Option, assertion: Option, } impl JsImportNamespaceClauseBuilder { @@ -2226,10 +2224,6 @@ impl JsImportNamespaceClauseBuilder { self.type_token = Some(type_token); self } - pub fn with_defer_token(mut self, defer_token: SyntaxToken) -> Self { - self.defer_token = Some(defer_token); - self - } pub fn with_assertion(mut self, assertion: JsImportAssertion) -> Self { self.assertion = Some(assertion); self @@ -2239,7 +2233,6 @@ impl JsImportNamespaceClauseBuilder { JsSyntaxKind::JS_IMPORT_NAMESPACE_CLAUSE, [ self.type_token.map(|token| SyntaxElement::Token(token)), - self.defer_token.map(|token| SyntaxElement::Token(token)), Some(SyntaxElement::Node(self.namespace_specifier.into_syntax())), Some(SyntaxElement::Token(self.from_token)), Some(SyntaxElement::Node(self.source.into_syntax())), diff --git a/crates/biome_js_factory/src/generated/syntax_factory.rs b/crates/biome_js_factory/src/generated/syntax_factory.rs index 5fb242724f30..76d89689529f 100644 --- a/crates/biome_js_factory/src/generated/syntax_factory.rs +++ b/crates/biome_js_factory/src/generated/syntax_factory.rs @@ -3107,7 +3107,7 @@ impl SyntaxFactory for JsSyntaxFactory { } JS_IMPORT_NAMESPACE_CLAUSE => { let mut elements = (&children).into_iter(); - let mut slots: RawNodeSlots<6usize> = RawNodeSlots::default(); + let mut slots: RawNodeSlots<5usize> = RawNodeSlots::default(); let mut current_element = elements.next(); if let Some(element) = ¤t_element { if element.kind() == T![type] { @@ -3116,13 +3116,6 @@ impl SyntaxFactory for JsSyntaxFactory { } } slots.next_slot(); - if let Some(element) = ¤t_element { - if element.kind() == T![defer] { - slots.mark_present(); - current_element = elements.next(); - } - } - slots.next_slot(); if let Some(element) = ¤t_element { if JsNamespaceImportSpecifier::can_cast(element.kind()) { slots.mark_present(); diff --git a/crates/biome_js_formatter/src/js/module/import_namespace_clause.rs b/crates/biome_js_formatter/src/js/module/import_namespace_clause.rs index 8610daed6752..0ddc63937025 100644 --- a/crates/biome_js_formatter/src/js/module/import_namespace_clause.rs +++ b/crates/biome_js_formatter/src/js/module/import_namespace_clause.rs @@ -13,7 +13,6 @@ impl FormatNodeRule for FormatJsImportNamespaceClause { type_token, namespace_specifier, from_token, - defer_token, source, assertion, } = node.as_fields(); @@ -21,9 +20,6 @@ impl FormatNodeRule for FormatJsImportNamespaceClause { if let Some(type_token) = type_token { write!(f, [type_token.format(), space()])?; } - if let Some(defer_token) = defer_token { - write!(f, [defer_token.format(), space()])?; - } write![ f, diff --git a/crates/biome_js_formatter/tests/specs/js/module/import/import_defer_attribute.js b/crates/biome_js_formatter/tests/specs/js/module/import/import_defer_attribute.js deleted file mode 100644 index 5ba99b257a53..000000000000 --- a/crates/biome_js_formatter/tests/specs/js/module/import/import_defer_attribute.js +++ /dev/null @@ -1 +0,0 @@ -import defer * as ns from "x"; \ No newline at end of file diff --git a/crates/biome_js_formatter/tests/specs/js/module/import/import_defer_attribute.js.snap b/crates/biome_js_formatter/tests/specs/js/module/import/import_defer_attribute.js.snap deleted file mode 100644 index 0f73db00de05..000000000000 --- a/crates/biome_js_formatter/tests/specs/js/module/import/import_defer_attribute.js.snap +++ /dev/null @@ -1,36 +0,0 @@ ---- -source: crates/biome_formatter_test/src/snapshot_builder.rs -info: js/module/import/import_defer_attribute.js ---- -# Input - -```js -import defer * as ns from "x"; -``` - - -============================= - -# Outputs - -## Output 1 - ------ -Indent style: Tab -Indent width: 2 -Line ending: LF -Line width: 80 -Quote style: Double Quotes -JSX quote style: Double Quotes -Quote properties: As needed -Trailing commas: All -Semicolons: Always -Arrow parentheses: Always -Bracket spacing: true -Bracket same line: false -Attribute Position: Auto ------ - -```js -import defer * as ns from "x"; -``` diff --git a/crates/biome_js_parser/src/lexer/mod.rs b/crates/biome_js_parser/src/lexer/mod.rs index a75cbf86b677..500e1914fcff 100644 --- a/crates/biome_js_parser/src/lexer/mod.rs +++ b/crates/biome_js_parser/src/lexer/mod.rs @@ -1034,7 +1034,6 @@ impl<'src> JsLexer<'src> { b"of" => OF_KW, b"out" => OUT_KW, b"using" => USING_KW, - b"defer" => DEFER_KW, _ => T![ident], } } diff --git a/crates/biome_js_parser/src/syntax/module.rs b/crates/biome_js_parser/src/syntax/module.rs index e99eb9bbeac9..8e85b8b1cb4e 100644 --- a/crates/biome_js_parser/src/syntax/module.rs +++ b/crates/biome_js_parser/src/syntax/module.rs @@ -294,15 +294,6 @@ fn parse_import_clause(p: &mut JsParser) -> ParsedSyntax { p.eat(T![type]); } - // test js import_defer_clause - // import defer * as yNamespace from "y"; - // - // test_err js import_defer_clause - // import type defer * as yNamespace from "y"; - if p.at(T![defer]) && p.nth_at(1, T![*]) { - p.eat(T![defer]); - } - let clause = match p.cur() { T![*] => parse_import_namespace_clause_rest(p, m), T!['{'] => parse_import_named_clause_rest(p, m), diff --git a/crates/biome_js_parser/src/tests.rs b/crates/biome_js_parser/src/tests.rs index d01317e65b08..5df6860aef3b 100644 --- a/crates/biome_js_parser/src/tests.rs +++ b/crates/biome_js_parser/src/tests.rs @@ -408,7 +408,7 @@ fn diagnostics_print_correctly() { #[test] pub fn quick_test() { let code = r#" - type A = typeof import("test"); + type Equals = A extends (x: B extends C ? D : E) => 0 ? F : G; "#; let root = parse( code, diff --git a/crates/biome_js_parser/test_data/inline/err/import_defer_clause.js b/crates/biome_js_parser/test_data/inline/err/import_defer_clause.js deleted file mode 100644 index 4ca3d7cef0c0..000000000000 --- a/crates/biome_js_parser/test_data/inline/err/import_defer_clause.js +++ /dev/null @@ -1 +0,0 @@ -import type defer * as yNamespace from "y"; diff --git a/crates/biome_js_parser/test_data/inline/err/import_defer_clause.rast b/crates/biome_js_parser/test_data/inline/err/import_defer_clause.rast deleted file mode 100644 index a5b321eaf9b0..000000000000 --- a/crates/biome_js_parser/test_data/inline/err/import_defer_clause.rast +++ /dev/null @@ -1,76 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsImport { - import_token: IMPORT_KW@0..7 "import" [] [Whitespace(" ")], - import_clause: JsImportDefaultClause { - type_token: missing (optional), - default_specifier: JsDefaultImportSpecifier { - local_name: JsIdentifierBinding { - name_token: IDENT@7..12 "type" [] [Whitespace(" ")], - }, - }, - from_token: missing (required), - source: missing (required), - assertion: missing (optional), - }, - semicolon_token: missing (optional), - }, - JsBogusStatement { - items: [ - DEFER_KW@12..18 "defer" [] [Whitespace(" ")], - STAR@18..20 "*" [] [Whitespace(" ")], - AS_KW@20..23 "as" [] [Whitespace(" ")], - IDENT@23..34 "yNamespace" [] [Whitespace(" ")], - FROM_KW@34..39 "from" [] [Whitespace(" ")], - JS_STRING_LITERAL@39..42 "\"y\"" [] [], - ], - }, - JsEmptyStatement { - semicolon_token: SEMICOLON@42..43 ";" [] [], - }, - ], - eof_token: EOF@43..44 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..44 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..43 - 0: JS_IMPORT@0..12 - 0: IMPORT_KW@0..7 "import" [] [Whitespace(" ")] - 1: JS_IMPORT_DEFAULT_CLAUSE@7..12 - 0: (empty) - 1: JS_DEFAULT_IMPORT_SPECIFIER@7..12 - 0: JS_IDENTIFIER_BINDING@7..12 - 0: IDENT@7..12 "type" [] [Whitespace(" ")] - 2: (empty) - 3: (empty) - 4: (empty) - 2: (empty) - 1: JS_BOGUS_STATEMENT@12..42 - 0: DEFER_KW@12..18 "defer" [] [Whitespace(" ")] - 1: STAR@18..20 "*" [] [Whitespace(" ")] - 2: AS_KW@20..23 "as" [] [Whitespace(" ")] - 3: IDENT@23..34 "yNamespace" [] [Whitespace(" ")] - 4: FROM_KW@34..39 "from" [] [Whitespace(" ")] - 5: JS_STRING_LITERAL@39..42 "\"y\"" [] [] - 2: JS_EMPTY_STATEMENT@42..43 - 0: SEMICOLON@42..43 ";" [] [] - 4: EOF@43..44 "" [Newline("\n")] [] --- -import_defer_clause.js:1:13 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × expected `from` but instead found `defer` - - > 1 │ import type defer * as yNamespace from "y"; - │ ^^^^^ - 2 │ - - i Remove defer - --- -import type defer * as yNamespace from "y"; diff --git a/crates/biome_js_parser/test_data/inline/err/import_err.rast b/crates/biome_js_parser/test_data/inline/err/import_err.rast index eb0e675b4b18..33550b72d731 100644 --- a/crates/biome_js_parser/test_data/inline/err/import_err.rast +++ b/crates/biome_js_parser/test_data/inline/err/import_err.rast @@ -12,7 +12,6 @@ JsModule { import_token: IMPORT_KW@7..15 "import" [Newline("\n")] [Whitespace(" ")], import_clause: JsImportNamespaceClause { type_token: missing (optional), - defer_token: missing (optional), namespace_specifier: JsNamespaceImportSpecifier { star_token: STAR@15..16 "*" [] [], as_token: missing (required), @@ -28,7 +27,6 @@ JsModule { import_token: IMPORT_KW@17..25 "import" [Newline("\n")] [Whitespace(" ")], import_clause: JsImportNamespaceClause { type_token: missing (optional), - defer_token: missing (optional), namespace_specifier: JsNamespaceImportSpecifier { star_token: STAR@25..27 "*" [] [Whitespace(" ")], as_token: AS_KW@27..30 "as" [] [Whitespace(" ")], @@ -293,28 +291,26 @@ JsModule { 0: IMPORT_KW@7..15 "import" [Newline("\n")] [Whitespace(" ")] 1: JS_IMPORT_NAMESPACE_CLAUSE@15..16 0: (empty) - 1: (empty) - 2: JS_NAMESPACE_IMPORT_SPECIFIER@15..16 + 1: JS_NAMESPACE_IMPORT_SPECIFIER@15..16 0: STAR@15..16 "*" [] [] 1: (empty) 2: (empty) + 2: (empty) 3: (empty) 4: (empty) - 5: (empty) 2: SEMICOLON@16..17 ";" [] [] 2: JS_IMPORT@17..31 0: IMPORT_KW@17..25 "import" [Newline("\n")] [Whitespace(" ")] 1: JS_IMPORT_NAMESPACE_CLAUSE@25..31 0: (empty) - 1: (empty) - 2: JS_NAMESPACE_IMPORT_SPECIFIER@25..31 + 1: JS_NAMESPACE_IMPORT_SPECIFIER@25..31 0: STAR@25..27 "*" [] [Whitespace(" ")] 1: AS_KW@27..30 "as" [] [Whitespace(" ")] 2: JS_IDENTIFIER_BINDING@30..31 0: IDENT@30..31 "c" [] [] + 2: (empty) 3: (empty) 4: (empty) - 5: (empty) 2: (empty) 3: JS_BOGUS_STATEMENT@31..33 0: COMMA@31..33 "," [] [Whitespace(" ")] diff --git a/crates/biome_js_parser/test_data/inline/ok/import_decl.rast b/crates/biome_js_parser/test_data/inline/ok/import_decl.rast index 5c15ee42e7c4..7b59b6d531a6 100644 --- a/crates/biome_js_parser/test_data/inline/ok/import_decl.rast +++ b/crates/biome_js_parser/test_data/inline/ok/import_decl.rast @@ -7,7 +7,6 @@ JsModule { import_token: IMPORT_KW@0..7 "import" [] [Whitespace(" ")], import_clause: JsImportNamespaceClause { type_token: missing (optional), - defer_token: missing (optional), namespace_specifier: JsNamespaceImportSpecifier { star_token: STAR@7..9 "*" [] [Whitespace(" ")], as_token: AS_KW@9..12 "as" [] [Whitespace(" ")], @@ -36,15 +35,14 @@ JsModule { 0: IMPORT_KW@0..7 "import" [] [Whitespace(" ")] 1: JS_IMPORT_NAMESPACE_CLAUSE@7..26 0: (empty) - 1: (empty) - 2: JS_NAMESPACE_IMPORT_SPECIFIER@7..16 + 1: JS_NAMESPACE_IMPORT_SPECIFIER@7..16 0: STAR@7..9 "*" [] [Whitespace(" ")] 1: AS_KW@9..12 "as" [] [Whitespace(" ")] 2: JS_IDENTIFIER_BINDING@12..16 0: IDENT@12..16 "foo" [] [Whitespace(" ")] - 3: FROM_KW@16..21 "from" [] [Whitespace(" ")] - 4: JS_MODULE_SOURCE@21..26 + 2: FROM_KW@16..21 "from" [] [Whitespace(" ")] + 3: JS_MODULE_SOURCE@21..26 0: JS_STRING_LITERAL@21..26 "\"bla\"" [] [] - 5: (empty) + 4: (empty) 2: SEMICOLON@26..27 ";" [] [] 4: EOF@27..28 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/import_defer_clause.js b/crates/biome_js_parser/test_data/inline/ok/import_defer_clause.js deleted file mode 100644 index c83d0dfdd36e..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/import_defer_clause.js +++ /dev/null @@ -1 +0,0 @@ -import defer * as yNamespace from "y"; diff --git a/crates/biome_js_parser/test_data/inline/ok/import_defer_clause.rast b/crates/biome_js_parser/test_data/inline/ok/import_defer_clause.rast deleted file mode 100644 index 7069a6ebaaf3..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/import_defer_clause.rast +++ /dev/null @@ -1,50 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsImport { - import_token: IMPORT_KW@0..7 "import" [] [Whitespace(" ")], - import_clause: JsImportNamespaceClause { - type_token: missing (optional), - defer_token: DEFER_KW@7..13 "defer" [] [Whitespace(" ")], - namespace_specifier: JsNamespaceImportSpecifier { - star_token: STAR@13..15 "*" [] [Whitespace(" ")], - as_token: AS_KW@15..18 "as" [] [Whitespace(" ")], - local_name: JsIdentifierBinding { - name_token: IDENT@18..29 "yNamespace" [] [Whitespace(" ")], - }, - }, - from_token: FROM_KW@29..34 "from" [] [Whitespace(" ")], - source: JsModuleSource { - value_token: JS_STRING_LITERAL@34..37 "\"y\"" [] [], - }, - assertion: missing (optional), - }, - semicolon_token: SEMICOLON@37..38 ";" [] [], - }, - ], - eof_token: EOF@38..39 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..39 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..38 - 0: JS_IMPORT@0..38 - 0: IMPORT_KW@0..7 "import" [] [Whitespace(" ")] - 1: JS_IMPORT_NAMESPACE_CLAUSE@7..37 - 0: (empty) - 1: DEFER_KW@7..13 "defer" [] [Whitespace(" ")] - 2: JS_NAMESPACE_IMPORT_SPECIFIER@13..29 - 0: STAR@13..15 "*" [] [Whitespace(" ")] - 1: AS_KW@15..18 "as" [] [Whitespace(" ")] - 2: JS_IDENTIFIER_BINDING@18..29 - 0: IDENT@18..29 "yNamespace" [] [Whitespace(" ")] - 3: FROM_KW@29..34 "from" [] [Whitespace(" ")] - 4: JS_MODULE_SOURCE@34..37 - 0: JS_STRING_LITERAL@34..37 "\"y\"" [] [] - 5: (empty) - 2: SEMICOLON@37..38 ";" [] [] - 4: EOF@38..39 "" [Newline("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_import_clause_types.rast b/crates/biome_js_parser/test_data/inline/ok/ts_import_clause_types.rast index 30949b8643dc..379f48b097a6 100644 --- a/crates/biome_js_parser/test_data/inline/ok/ts_import_clause_types.rast +++ b/crates/biome_js_parser/test_data/inline/ok/ts_import_clause_types.rast @@ -41,7 +41,6 @@ JsModule { import_token: IMPORT_KW@69..77 "import" [Newline("\n")] [Whitespace(" ")], import_clause: JsImportNamespaceClause { type_token: TYPE_KW@77..82 "type" [] [Whitespace(" ")], - defer_token: missing (optional), namespace_specifier: JsNamespaceImportSpecifier { star_token: STAR@82..84 "*" [] [Whitespace(" ")], as_token: AS_KW@84..87 "as" [] [Whitespace(" ")], @@ -135,16 +134,15 @@ JsModule { 0: IMPORT_KW@69..77 "import" [Newline("\n")] [Whitespace(" ")] 1: JS_IMPORT_NAMESPACE_CLAUSE@77..104 0: TYPE_KW@77..82 "type" [] [Whitespace(" ")] - 1: (empty) - 2: JS_NAMESPACE_IMPORT_SPECIFIER@82..92 + 1: JS_NAMESPACE_IMPORT_SPECIFIER@82..92 0: STAR@82..84 "*" [] [Whitespace(" ")] 1: AS_KW@84..87 "as" [] [Whitespace(" ")] 2: JS_IDENTIFIER_BINDING@87..92 0: IDENT@87..92 "foo2" [] [Whitespace(" ")] - 3: FROM_KW@92..97 "from" [] [Whitespace(" ")] - 4: JS_MODULE_SOURCE@97..104 + 2: FROM_KW@92..97 "from" [] [Whitespace(" ")] + 3: JS_MODULE_SOURCE@97..104 0: JS_STRING_LITERAL@97..104 "\"./mod\"" [] [] - 5: (empty) + 4: (empty) 2: SEMICOLON@104..105 ";" [] [] 3: JS_IMPORT@105..138 0: IMPORT_KW@105..113 "import" [Newline("\n")] [Whitespace(" ")] diff --git a/crates/biome_js_syntax/src/generated/kind.rs b/crates/biome_js_syntax/src/generated/kind.rs index e2a38ce8c517..febf32803792 100644 --- a/crates/biome_js_syntax/src/generated/kind.rs +++ b/crates/biome_js_syntax/src/generated/kind.rs @@ -154,7 +154,6 @@ pub enum JsSyntaxKind { OF_KW, OUT_KW, USING_KW, - DEFER_KW, JS_NUMBER_LITERAL, JS_BIGINT_LITERAL, JS_STRING_LITERAL, @@ -666,7 +665,6 @@ impl JsSyntaxKind { "of" => OF_KW, "out" => OUT_KW, "using" => USING_KW, - "defer" => DEFER_KW, _ => return None, }; Some(kw) @@ -814,7 +812,6 @@ impl JsSyntaxKind { OF_KW => "of", OUT_KW => "out", USING_KW => "using", - DEFER_KW => "defer", JS_STRING_LITERAL => "string literal", _ => return None, }; @@ -823,4 +820,4 @@ impl JsSyntaxKind { } #[doc = r" Utility macro for creating a SyntaxKind through simple macro syntax"] #[macro_export] -macro_rules ! T { [;] => { $ crate :: JsSyntaxKind :: SEMICOLON } ; [,] => { $ crate :: JsSyntaxKind :: COMMA } ; ['('] => { $ crate :: JsSyntaxKind :: L_PAREN } ; [')'] => { $ crate :: JsSyntaxKind :: R_PAREN } ; ['{'] => { $ crate :: JsSyntaxKind :: L_CURLY } ; ['}'] => { $ crate :: JsSyntaxKind :: R_CURLY } ; ['['] => { $ crate :: JsSyntaxKind :: L_BRACK } ; [']'] => { $ crate :: JsSyntaxKind :: R_BRACK } ; [<] => { $ crate :: JsSyntaxKind :: L_ANGLE } ; [>] => { $ crate :: JsSyntaxKind :: R_ANGLE } ; [~] => { $ crate :: JsSyntaxKind :: TILDE } ; [?] => { $ crate :: JsSyntaxKind :: QUESTION } ; [??] => { $ crate :: JsSyntaxKind :: QUESTION2 } ; [?.] => { $ crate :: JsSyntaxKind :: QUESTIONDOT } ; [&] => { $ crate :: JsSyntaxKind :: AMP } ; [|] => { $ crate :: JsSyntaxKind :: PIPE } ; [+] => { $ crate :: JsSyntaxKind :: PLUS } ; [++] => { $ crate :: JsSyntaxKind :: PLUS2 } ; [*] => { $ crate :: JsSyntaxKind :: STAR } ; [**] => { $ crate :: JsSyntaxKind :: STAR2 } ; [/] => { $ crate :: JsSyntaxKind :: SLASH } ; [^] => { $ crate :: JsSyntaxKind :: CARET } ; [%] => { $ crate :: JsSyntaxKind :: PERCENT } ; [.] => { $ crate :: JsSyntaxKind :: DOT } ; [...] => { $ crate :: JsSyntaxKind :: DOT3 } ; [:] => { $ crate :: JsSyntaxKind :: COLON } ; [=] => { $ crate :: JsSyntaxKind :: EQ } ; [==] => { $ crate :: JsSyntaxKind :: EQ2 } ; [===] => { $ crate :: JsSyntaxKind :: EQ3 } ; [=>] => { $ crate :: JsSyntaxKind :: FAT_ARROW } ; [!] => { $ crate :: JsSyntaxKind :: BANG } ; [!=] => { $ crate :: JsSyntaxKind :: NEQ } ; [!==] => { $ crate :: JsSyntaxKind :: NEQ2 } ; [-] => { $ crate :: JsSyntaxKind :: MINUS } ; [--] => { $ crate :: JsSyntaxKind :: MINUS2 } ; [<=] => { $ crate :: JsSyntaxKind :: LTEQ } ; [>=] => { $ crate :: JsSyntaxKind :: GTEQ } ; [+=] => { $ crate :: JsSyntaxKind :: PLUSEQ } ; [-=] => { $ crate :: JsSyntaxKind :: MINUSEQ } ; [|=] => { $ crate :: JsSyntaxKind :: PIPEEQ } ; [&=] => { $ crate :: JsSyntaxKind :: AMPEQ } ; [^=] => { $ crate :: JsSyntaxKind :: CARETEQ } ; [/=] => { $ crate :: JsSyntaxKind :: SLASHEQ } ; [*=] => { $ crate :: JsSyntaxKind :: STAREQ } ; [%=] => { $ crate :: JsSyntaxKind :: PERCENTEQ } ; [&&] => { $ crate :: JsSyntaxKind :: AMP2 } ; [||] => { $ crate :: JsSyntaxKind :: PIPE2 } ; [<<] => { $ crate :: JsSyntaxKind :: SHL } ; [>>] => { $ crate :: JsSyntaxKind :: SHR } ; [>>>] => { $ crate :: JsSyntaxKind :: USHR } ; [<<=] => { $ crate :: JsSyntaxKind :: SHLEQ } ; [>>=] => { $ crate :: JsSyntaxKind :: SHREQ } ; [>>>=] => { $ crate :: JsSyntaxKind :: USHREQ } ; [&&=] => { $ crate :: JsSyntaxKind :: AMP2EQ } ; [||=] => { $ crate :: JsSyntaxKind :: PIPE2EQ } ; [**=] => { $ crate :: JsSyntaxKind :: STAR2EQ } ; [??=] => { $ crate :: JsSyntaxKind :: QUESTION2EQ } ; [@] => { $ crate :: JsSyntaxKind :: AT } ; ['`'] => { $ crate :: JsSyntaxKind :: BACKTICK } ; [break] => { $ crate :: JsSyntaxKind :: BREAK_KW } ; [case] => { $ crate :: JsSyntaxKind :: CASE_KW } ; [catch] => { $ crate :: JsSyntaxKind :: CATCH_KW } ; [class] => { $ crate :: JsSyntaxKind :: CLASS_KW } ; [const] => { $ crate :: JsSyntaxKind :: CONST_KW } ; [continue] => { $ crate :: JsSyntaxKind :: CONTINUE_KW } ; [debugger] => { $ crate :: JsSyntaxKind :: DEBUGGER_KW } ; [default] => { $ crate :: JsSyntaxKind :: DEFAULT_KW } ; [delete] => { $ crate :: JsSyntaxKind :: DELETE_KW } ; [do] => { $ crate :: JsSyntaxKind :: DO_KW } ; [else] => { $ crate :: JsSyntaxKind :: ELSE_KW } ; [enum] => { $ crate :: JsSyntaxKind :: ENUM_KW } ; [export] => { $ crate :: JsSyntaxKind :: EXPORT_KW } ; [extends] => { $ crate :: JsSyntaxKind :: EXTENDS_KW } ; [false] => { $ crate :: JsSyntaxKind :: FALSE_KW } ; [finally] => { $ crate :: JsSyntaxKind :: FINALLY_KW } ; [for] => { $ crate :: JsSyntaxKind :: FOR_KW } ; [function] => { $ crate :: JsSyntaxKind :: FUNCTION_KW } ; [if] => { $ crate :: JsSyntaxKind :: IF_KW } ; [in] => { $ crate :: JsSyntaxKind :: IN_KW } ; [instanceof] => { $ crate :: JsSyntaxKind :: INSTANCEOF_KW } ; [import] => { $ crate :: JsSyntaxKind :: IMPORT_KW } ; [new] => { $ crate :: JsSyntaxKind :: NEW_KW } ; [null] => { $ crate :: JsSyntaxKind :: NULL_KW } ; [return] => { $ crate :: JsSyntaxKind :: RETURN_KW } ; [super] => { $ crate :: JsSyntaxKind :: SUPER_KW } ; [switch] => { $ crate :: JsSyntaxKind :: SWITCH_KW } ; [this] => { $ crate :: JsSyntaxKind :: THIS_KW } ; [throw] => { $ crate :: JsSyntaxKind :: THROW_KW } ; [try] => { $ crate :: JsSyntaxKind :: TRY_KW } ; [true] => { $ crate :: JsSyntaxKind :: TRUE_KW } ; [typeof] => { $ crate :: JsSyntaxKind :: TYPEOF_KW } ; [var] => { $ crate :: JsSyntaxKind :: VAR_KW } ; [void] => { $ crate :: JsSyntaxKind :: VOID_KW } ; [while] => { $ crate :: JsSyntaxKind :: WHILE_KW } ; [with] => { $ crate :: JsSyntaxKind :: WITH_KW } ; [implements] => { $ crate :: JsSyntaxKind :: IMPLEMENTS_KW } ; [interface] => { $ crate :: JsSyntaxKind :: INTERFACE_KW } ; [let] => { $ crate :: JsSyntaxKind :: LET_KW } ; [package] => { $ crate :: JsSyntaxKind :: PACKAGE_KW } ; [private] => { $ crate :: JsSyntaxKind :: PRIVATE_KW } ; [protected] => { $ crate :: JsSyntaxKind :: PROTECTED_KW } ; [public] => { $ crate :: JsSyntaxKind :: PUBLIC_KW } ; [static] => { $ crate :: JsSyntaxKind :: STATIC_KW } ; [yield] => { $ crate :: JsSyntaxKind :: YIELD_KW } ; [abstract] => { $ crate :: JsSyntaxKind :: ABSTRACT_KW } ; [accessor] => { $ crate :: JsSyntaxKind :: ACCESSOR_KW } ; [as] => { $ crate :: JsSyntaxKind :: AS_KW } ; [satisfies] => { $ crate :: JsSyntaxKind :: SATISFIES_KW } ; [asserts] => { $ crate :: JsSyntaxKind :: ASSERTS_KW } ; [assert] => { $ crate :: JsSyntaxKind :: ASSERT_KW } ; [any] => { $ crate :: JsSyntaxKind :: ANY_KW } ; [async] => { $ crate :: JsSyntaxKind :: ASYNC_KW } ; [await] => { $ crate :: JsSyntaxKind :: AWAIT_KW } ; [boolean] => { $ crate :: JsSyntaxKind :: BOOLEAN_KW } ; [constructor] => { $ crate :: JsSyntaxKind :: CONSTRUCTOR_KW } ; [declare] => { $ crate :: JsSyntaxKind :: DECLARE_KW } ; [get] => { $ crate :: JsSyntaxKind :: GET_KW } ; [infer] => { $ crate :: JsSyntaxKind :: INFER_KW } ; [is] => { $ crate :: JsSyntaxKind :: IS_KW } ; [keyof] => { $ crate :: JsSyntaxKind :: KEYOF_KW } ; [module] => { $ crate :: JsSyntaxKind :: MODULE_KW } ; [namespace] => { $ crate :: JsSyntaxKind :: NAMESPACE_KW } ; [never] => { $ crate :: JsSyntaxKind :: NEVER_KW } ; [readonly] => { $ crate :: JsSyntaxKind :: READONLY_KW } ; [require] => { $ crate :: JsSyntaxKind :: REQUIRE_KW } ; [number] => { $ crate :: JsSyntaxKind :: NUMBER_KW } ; [object] => { $ crate :: JsSyntaxKind :: OBJECT_KW } ; [set] => { $ crate :: JsSyntaxKind :: SET_KW } ; [string] => { $ crate :: JsSyntaxKind :: STRING_KW } ; [symbol] => { $ crate :: JsSyntaxKind :: SYMBOL_KW } ; [type] => { $ crate :: JsSyntaxKind :: TYPE_KW } ; [undefined] => { $ crate :: JsSyntaxKind :: UNDEFINED_KW } ; [unique] => { $ crate :: JsSyntaxKind :: UNIQUE_KW } ; [unknown] => { $ crate :: JsSyntaxKind :: UNKNOWN_KW } ; [from] => { $ crate :: JsSyntaxKind :: FROM_KW } ; [global] => { $ crate :: JsSyntaxKind :: GLOBAL_KW } ; [bigint] => { $ crate :: JsSyntaxKind :: BIGINT_KW } ; [override] => { $ crate :: JsSyntaxKind :: OVERRIDE_KW } ; [of] => { $ crate :: JsSyntaxKind :: OF_KW } ; [out] => { $ crate :: JsSyntaxKind :: OUT_KW } ; [using] => { $ crate :: JsSyntaxKind :: USING_KW } ; [defer] => { $ crate :: JsSyntaxKind :: DEFER_KW } ; [ident] => { $ crate :: JsSyntaxKind :: IDENT } ; [EOF] => { $ crate :: JsSyntaxKind :: EOF } ; [UNICODE_BOM] => { $ crate :: JsSyntaxKind :: UNICODE_BOM } ; [#] => { $ crate :: JsSyntaxKind :: HASH } ; } +macro_rules ! T { [;] => { $ crate :: JsSyntaxKind :: SEMICOLON } ; [,] => { $ crate :: JsSyntaxKind :: COMMA } ; ['('] => { $ crate :: JsSyntaxKind :: L_PAREN } ; [')'] => { $ crate :: JsSyntaxKind :: R_PAREN } ; ['{'] => { $ crate :: JsSyntaxKind :: L_CURLY } ; ['}'] => { $ crate :: JsSyntaxKind :: R_CURLY } ; ['['] => { $ crate :: JsSyntaxKind :: L_BRACK } ; [']'] => { $ crate :: JsSyntaxKind :: R_BRACK } ; [<] => { $ crate :: JsSyntaxKind :: L_ANGLE } ; [>] => { $ crate :: JsSyntaxKind :: R_ANGLE } ; [~] => { $ crate :: JsSyntaxKind :: TILDE } ; [?] => { $ crate :: JsSyntaxKind :: QUESTION } ; [??] => { $ crate :: JsSyntaxKind :: QUESTION2 } ; [?.] => { $ crate :: JsSyntaxKind :: QUESTIONDOT } ; [&] => { $ crate :: JsSyntaxKind :: AMP } ; [|] => { $ crate :: JsSyntaxKind :: PIPE } ; [+] => { $ crate :: JsSyntaxKind :: PLUS } ; [++] => { $ crate :: JsSyntaxKind :: PLUS2 } ; [*] => { $ crate :: JsSyntaxKind :: STAR } ; [**] => { $ crate :: JsSyntaxKind :: STAR2 } ; [/] => { $ crate :: JsSyntaxKind :: SLASH } ; [^] => { $ crate :: JsSyntaxKind :: CARET } ; [%] => { $ crate :: JsSyntaxKind :: PERCENT } ; [.] => { $ crate :: JsSyntaxKind :: DOT } ; [...] => { $ crate :: JsSyntaxKind :: DOT3 } ; [:] => { $ crate :: JsSyntaxKind :: COLON } ; [=] => { $ crate :: JsSyntaxKind :: EQ } ; [==] => { $ crate :: JsSyntaxKind :: EQ2 } ; [===] => { $ crate :: JsSyntaxKind :: EQ3 } ; [=>] => { $ crate :: JsSyntaxKind :: FAT_ARROW } ; [!] => { $ crate :: JsSyntaxKind :: BANG } ; [!=] => { $ crate :: JsSyntaxKind :: NEQ } ; [!==] => { $ crate :: JsSyntaxKind :: NEQ2 } ; [-] => { $ crate :: JsSyntaxKind :: MINUS } ; [--] => { $ crate :: JsSyntaxKind :: MINUS2 } ; [<=] => { $ crate :: JsSyntaxKind :: LTEQ } ; [>=] => { $ crate :: JsSyntaxKind :: GTEQ } ; [+=] => { $ crate :: JsSyntaxKind :: PLUSEQ } ; [-=] => { $ crate :: JsSyntaxKind :: MINUSEQ } ; [|=] => { $ crate :: JsSyntaxKind :: PIPEEQ } ; [&=] => { $ crate :: JsSyntaxKind :: AMPEQ } ; [^=] => { $ crate :: JsSyntaxKind :: CARETEQ } ; [/=] => { $ crate :: JsSyntaxKind :: SLASHEQ } ; [*=] => { $ crate :: JsSyntaxKind :: STAREQ } ; [%=] => { $ crate :: JsSyntaxKind :: PERCENTEQ } ; [&&] => { $ crate :: JsSyntaxKind :: AMP2 } ; [||] => { $ crate :: JsSyntaxKind :: PIPE2 } ; [<<] => { $ crate :: JsSyntaxKind :: SHL } ; [>>] => { $ crate :: JsSyntaxKind :: SHR } ; [>>>] => { $ crate :: JsSyntaxKind :: USHR } ; [<<=] => { $ crate :: JsSyntaxKind :: SHLEQ } ; [>>=] => { $ crate :: JsSyntaxKind :: SHREQ } ; [>>>=] => { $ crate :: JsSyntaxKind :: USHREQ } ; [&&=] => { $ crate :: JsSyntaxKind :: AMP2EQ } ; [||=] => { $ crate :: JsSyntaxKind :: PIPE2EQ } ; [**=] => { $ crate :: JsSyntaxKind :: STAR2EQ } ; [??=] => { $ crate :: JsSyntaxKind :: QUESTION2EQ } ; [@] => { $ crate :: JsSyntaxKind :: AT } ; ['`'] => { $ crate :: JsSyntaxKind :: BACKTICK } ; [break] => { $ crate :: JsSyntaxKind :: BREAK_KW } ; [case] => { $ crate :: JsSyntaxKind :: CASE_KW } ; [catch] => { $ crate :: JsSyntaxKind :: CATCH_KW } ; [class] => { $ crate :: JsSyntaxKind :: CLASS_KW } ; [const] => { $ crate :: JsSyntaxKind :: CONST_KW } ; [continue] => { $ crate :: JsSyntaxKind :: CONTINUE_KW } ; [debugger] => { $ crate :: JsSyntaxKind :: DEBUGGER_KW } ; [default] => { $ crate :: JsSyntaxKind :: DEFAULT_KW } ; [delete] => { $ crate :: JsSyntaxKind :: DELETE_KW } ; [do] => { $ crate :: JsSyntaxKind :: DO_KW } ; [else] => { $ crate :: JsSyntaxKind :: ELSE_KW } ; [enum] => { $ crate :: JsSyntaxKind :: ENUM_KW } ; [export] => { $ crate :: JsSyntaxKind :: EXPORT_KW } ; [extends] => { $ crate :: JsSyntaxKind :: EXTENDS_KW } ; [false] => { $ crate :: JsSyntaxKind :: FALSE_KW } ; [finally] => { $ crate :: JsSyntaxKind :: FINALLY_KW } ; [for] => { $ crate :: JsSyntaxKind :: FOR_KW } ; [function] => { $ crate :: JsSyntaxKind :: FUNCTION_KW } ; [if] => { $ crate :: JsSyntaxKind :: IF_KW } ; [in] => { $ crate :: JsSyntaxKind :: IN_KW } ; [instanceof] => { $ crate :: JsSyntaxKind :: INSTANCEOF_KW } ; [import] => { $ crate :: JsSyntaxKind :: IMPORT_KW } ; [new] => { $ crate :: JsSyntaxKind :: NEW_KW } ; [null] => { $ crate :: JsSyntaxKind :: NULL_KW } ; [return] => { $ crate :: JsSyntaxKind :: RETURN_KW } ; [super] => { $ crate :: JsSyntaxKind :: SUPER_KW } ; [switch] => { $ crate :: JsSyntaxKind :: SWITCH_KW } ; [this] => { $ crate :: JsSyntaxKind :: THIS_KW } ; [throw] => { $ crate :: JsSyntaxKind :: THROW_KW } ; [try] => { $ crate :: JsSyntaxKind :: TRY_KW } ; [true] => { $ crate :: JsSyntaxKind :: TRUE_KW } ; [typeof] => { $ crate :: JsSyntaxKind :: TYPEOF_KW } ; [var] => { $ crate :: JsSyntaxKind :: VAR_KW } ; [void] => { $ crate :: JsSyntaxKind :: VOID_KW } ; [while] => { $ crate :: JsSyntaxKind :: WHILE_KW } ; [with] => { $ crate :: JsSyntaxKind :: WITH_KW } ; [implements] => { $ crate :: JsSyntaxKind :: IMPLEMENTS_KW } ; [interface] => { $ crate :: JsSyntaxKind :: INTERFACE_KW } ; [let] => { $ crate :: JsSyntaxKind :: LET_KW } ; [package] => { $ crate :: JsSyntaxKind :: PACKAGE_KW } ; [private] => { $ crate :: JsSyntaxKind :: PRIVATE_KW } ; [protected] => { $ crate :: JsSyntaxKind :: PROTECTED_KW } ; [public] => { $ crate :: JsSyntaxKind :: PUBLIC_KW } ; [static] => { $ crate :: JsSyntaxKind :: STATIC_KW } ; [yield] => { $ crate :: JsSyntaxKind :: YIELD_KW } ; [abstract] => { $ crate :: JsSyntaxKind :: ABSTRACT_KW } ; [accessor] => { $ crate :: JsSyntaxKind :: ACCESSOR_KW } ; [as] => { $ crate :: JsSyntaxKind :: AS_KW } ; [satisfies] => { $ crate :: JsSyntaxKind :: SATISFIES_KW } ; [asserts] => { $ crate :: JsSyntaxKind :: ASSERTS_KW } ; [assert] => { $ crate :: JsSyntaxKind :: ASSERT_KW } ; [any] => { $ crate :: JsSyntaxKind :: ANY_KW } ; [async] => { $ crate :: JsSyntaxKind :: ASYNC_KW } ; [await] => { $ crate :: JsSyntaxKind :: AWAIT_KW } ; [boolean] => { $ crate :: JsSyntaxKind :: BOOLEAN_KW } ; [constructor] => { $ crate :: JsSyntaxKind :: CONSTRUCTOR_KW } ; [declare] => { $ crate :: JsSyntaxKind :: DECLARE_KW } ; [get] => { $ crate :: JsSyntaxKind :: GET_KW } ; [infer] => { $ crate :: JsSyntaxKind :: INFER_KW } ; [is] => { $ crate :: JsSyntaxKind :: IS_KW } ; [keyof] => { $ crate :: JsSyntaxKind :: KEYOF_KW } ; [module] => { $ crate :: JsSyntaxKind :: MODULE_KW } ; [namespace] => { $ crate :: JsSyntaxKind :: NAMESPACE_KW } ; [never] => { $ crate :: JsSyntaxKind :: NEVER_KW } ; [readonly] => { $ crate :: JsSyntaxKind :: READONLY_KW } ; [require] => { $ crate :: JsSyntaxKind :: REQUIRE_KW } ; [number] => { $ crate :: JsSyntaxKind :: NUMBER_KW } ; [object] => { $ crate :: JsSyntaxKind :: OBJECT_KW } ; [set] => { $ crate :: JsSyntaxKind :: SET_KW } ; [string] => { $ crate :: JsSyntaxKind :: STRING_KW } ; [symbol] => { $ crate :: JsSyntaxKind :: SYMBOL_KW } ; [type] => { $ crate :: JsSyntaxKind :: TYPE_KW } ; [undefined] => { $ crate :: JsSyntaxKind :: UNDEFINED_KW } ; [unique] => { $ crate :: JsSyntaxKind :: UNIQUE_KW } ; [unknown] => { $ crate :: JsSyntaxKind :: UNKNOWN_KW } ; [from] => { $ crate :: JsSyntaxKind :: FROM_KW } ; [global] => { $ crate :: JsSyntaxKind :: GLOBAL_KW } ; [bigint] => { $ crate :: JsSyntaxKind :: BIGINT_KW } ; [override] => { $ crate :: JsSyntaxKind :: OVERRIDE_KW } ; [of] => { $ crate :: JsSyntaxKind :: OF_KW } ; [out] => { $ crate :: JsSyntaxKind :: OUT_KW } ; [using] => { $ crate :: JsSyntaxKind :: USING_KW } ; [ident] => { $ crate :: JsSyntaxKind :: IDENT } ; [EOF] => { $ crate :: JsSyntaxKind :: EOF } ; [UNICODE_BOM] => { $ crate :: JsSyntaxKind :: UNICODE_BOM } ; [#] => { $ crate :: JsSyntaxKind :: HASH } ; } diff --git a/crates/biome_js_syntax/src/generated/nodes.rs b/crates/biome_js_syntax/src/generated/nodes.rs index 4851f0c32239..25ab455b9216 100644 --- a/crates/biome_js_syntax/src/generated/nodes.rs +++ b/crates/biome_js_syntax/src/generated/nodes.rs @@ -3900,7 +3900,6 @@ impl JsImportNamespaceClause { pub fn as_fields(&self) -> JsImportNamespaceClauseFields { JsImportNamespaceClauseFields { type_token: self.type_token(), - defer_token: self.defer_token(), namespace_specifier: self.namespace_specifier(), from_token: self.from_token(), source: self.source(), @@ -3910,20 +3909,17 @@ impl JsImportNamespaceClause { pub fn type_token(&self) -> Option { support::token(&self.syntax, 0usize) } - pub fn defer_token(&self) -> Option { - support::token(&self.syntax, 1usize) - } pub fn namespace_specifier(&self) -> SyntaxResult { - support::required_node(&self.syntax, 2usize) + support::required_node(&self.syntax, 1usize) } pub fn from_token(&self) -> SyntaxResult { - support::required_token(&self.syntax, 3usize) + support::required_token(&self.syntax, 2usize) } pub fn source(&self) -> SyntaxResult { - support::required_node(&self.syntax, 4usize) + support::required_node(&self.syntax, 3usize) } pub fn assertion(&self) -> Option { - support::node(&self.syntax, 5usize) + support::node(&self.syntax, 4usize) } } impl Serialize for JsImportNamespaceClause { @@ -3937,7 +3933,6 @@ impl Serialize for JsImportNamespaceClause { #[derive(Serialize)] pub struct JsImportNamespaceClauseFields { pub type_token: Option, - pub defer_token: Option, pub namespace_specifier: SyntaxResult, pub from_token: SyntaxResult, pub source: SyntaxResult, @@ -19949,10 +19944,6 @@ impl std::fmt::Debug for JsImportNamespaceClause { "type_token", &support::DebugOptionalElement(self.type_token()), ) - .field( - "defer_token", - &support::DebugOptionalElement(self.defer_token()), - ) .field( "namespace_specifier", &support::DebugSyntaxResult(self.namespace_specifier()), diff --git a/crates/biome_js_syntax/src/generated/nodes_mut.rs b/crates/biome_js_syntax/src/generated/nodes_mut.rs index 42e90d00fa41..86138e8d5f6d 100644 --- a/crates/biome_js_syntax/src/generated/nodes_mut.rs +++ b/crates/biome_js_syntax/src/generated/nodes_mut.rs @@ -1961,33 +1961,27 @@ impl JsImportNamespaceClause { .splice_slots(0usize..=0usize, once(element.map(|element| element.into()))), ) } - pub fn with_defer_token(self, element: Option) -> Self { - Self::unwrap_cast( - self.syntax - .splice_slots(1usize..=1usize, once(element.map(|element| element.into()))), - ) - } pub fn with_namespace_specifier(self, element: JsNamespaceImportSpecifier) -> Self { Self::unwrap_cast( self.syntax - .splice_slots(2usize..=2usize, once(Some(element.into_syntax().into()))), + .splice_slots(1usize..=1usize, once(Some(element.into_syntax().into()))), ) } pub fn with_from_token(self, element: SyntaxToken) -> Self { Self::unwrap_cast( self.syntax - .splice_slots(3usize..=3usize, once(Some(element.into()))), + .splice_slots(2usize..=2usize, once(Some(element.into()))), ) } pub fn with_source(self, element: AnyJsModuleSource) -> Self { Self::unwrap_cast( self.syntax - .splice_slots(4usize..=4usize, once(Some(element.into_syntax().into()))), + .splice_slots(3usize..=3usize, once(Some(element.into_syntax().into()))), ) } pub fn with_assertion(self, element: Option) -> Self { Self::unwrap_cast(self.syntax.splice_slots( - 5usize..=5usize, + 4usize..=4usize, once(element.map(|element| element.into_syntax().into())), )) } diff --git a/packages/@biomejs/biome/package.json b/packages/@biomejs/biome/package.json index 3c1d2bd25e61..8f89bb875f5d 100644 --- a/packages/@biomejs/biome/package.json +++ b/packages/@biomejs/biome/package.json @@ -1,6 +1,6 @@ { "name": "@biomejs/biome", - "version": "1.9.3", + "version": "1.9.4", "bin": { "biome": "bin/biome" }, diff --git a/xtask/codegen/js.ungram b/xtask/codegen/js.ungram index a9ca2339abe4..73d284490220 100644 --- a/xtask/codegen/js.ungram +++ b/xtask/codegen/js.ungram @@ -1252,7 +1252,6 @@ JsImportDefaultClause = // import type * as foo from "mod"; JsImportNamespaceClause = 'type'? - 'defer'? namespace_specifier: JsNamespaceImportSpecifier 'from' source: AnyJsModuleSource diff --git a/xtask/codegen/src/js_kinds_src.rs b/xtask/codegen/src/js_kinds_src.rs index 362eb4889a6d..09f05a304392 100644 --- a/xtask/codegen/src/js_kinds_src.rs +++ b/xtask/codegen/src/js_kinds_src.rs @@ -155,7 +155,6 @@ pub const JS_KINDS_SRC: KindsSrc = KindsSrc { "of", "out", "using", - "defer", ], literals: &[ "JS_NUMBER_LITERAL",