Skip to content

Commit

Permalink
revert: "feat(biome_js_parser): support defer attribute in import sta…
Browse files Browse the repository at this point in the history
…tements (#4301)"

This reverts commit 27ff2a7.
  • Loading branch information
Conaclos committed Oct 17, 2024
1 parent 75585cf commit 9d71150
Show file tree
Hide file tree
Showing 21 changed files with 36 additions and 267 deletions.
36 changes: 13 additions & 23 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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).

## v1.9.4 (2024-10-18)
## v1.9.4 (2024-10-17)

### Analyzer

Expand Down Expand Up @@ -189,28 +189,6 @@ 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)).
Expand All @@ -229,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
Expand Down
7 changes: 0 additions & 7 deletions crates/biome_js_factory/src/generated/node_factory.rs

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

9 changes: 1 addition & 8 deletions crates/biome_js_factory/src/generated/syntax_factory.rs

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

Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,13 @@ impl FormatNodeRule<JsImportNamespaceClause> for FormatJsImportNamespaceClause {
type_token,
namespace_specifier,
from_token,
defer_token,
source,
assertion,
} = node.as_fields();

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,
Expand Down

This file was deleted.

This file was deleted.

1 change: 0 additions & 1 deletion crates/biome_js_parser/src/lexer/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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],
}
}
Expand Down
9 changes: 0 additions & 9 deletions crates/biome_js_parser/src/syntax/module.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down
2 changes: 1 addition & 1 deletion crates/biome_js_parser/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

This file was deleted.

This file was deleted.

12 changes: 4 additions & 8 deletions crates/biome_js_parser/test_data/inline/err/import_err.rast
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand All @@ -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(" ")],
Expand Down Expand Up @@ -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(" ")]
Expand Down
10 changes: 4 additions & 6 deletions crates/biome_js_parser/test_data/inline/ok/import_decl.rast
Original file line number Diff line number Diff line change
Expand Up @@ -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(" ")],
Expand Down Expand Up @@ -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")] []

This file was deleted.

Loading

0 comments on commit 9d71150

Please sign in to comment.