Skip to content

Commit

Permalink
chore(formatter): ignore experimental syntaxes in JSX for reports
Browse files Browse the repository at this point in the history
  • Loading branch information
Conaclos committed Dec 1, 2023
1 parent e980f76 commit bc58aed
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 428 deletions.
7 changes: 7 additions & 0 deletions crates/biome_formatter_test/src/diff_report.rs
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ impl DiffReport {
// Experimental syntax: `do {}`
"js/async-do-expressions/",
"js/do/",
"jsx/do/",
// Experimental syntax: `export X from "mod"`
"js/export-default/export-default-from/",
"js/export-default/escaped/default-escaped.js",
Expand All @@ -130,6 +131,7 @@ impl DiffReport {
"js/comments/tuple-and-record.js",
"js/function-single-destructuring/tuple-and-record.js",
"js/method-chain/tuple-and-record.js",
"jsx/tuple/",
// Experimental syntax: pipeline operator `|>`
"js/comments-pipeline-own-line",
"js/partial-application",
Expand All @@ -147,6 +149,8 @@ impl DiffReport {
"js/source-phase-imports/",
// Experimental syntax: `import module`
"js/import-reflection/",
// Experimental syntax: `throw` expressions
"js/throw_expressions/",
// Embedded languages in template literals
"js/comments-closure-typecast/styled-components.js",
"js/multiparser-comments/",
Expand All @@ -162,9 +166,12 @@ impl DiffReport {
"js/template-literals/styled-jsx.js",
"js/range/issue-7082.js",
"js/last-argument-expansion/embed.js",
"jsx/template/styled-components.js",
"typescript/as/as-const-embedded.ts",
"js/last-argument-expansion/embed.js",
"typescript/as/as-const-embedded.ts",
// Syntax recovery
"typescript/error-recovery/",
/*// Experimental syntax: property and class decorators
"js/decorators",
"js/decorator-auto-accessors/",
Expand Down
216 changes: 2 additions & 214 deletions crates/biome_js_formatter/report.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
## Overall Metrics

**Average compatibility**: 96.35
**Average compatibility**: 96.58

<details>
<summary>Definition</summary>

$$average = \frac\{\sum_{file}^\{files}compatibility_\{file}}\{files}$$
</details>

**Compatible lines**: 97.33
**Compatible lines**: 97.53

<details>
<summary>Definition</summary>
Expand Down Expand Up @@ -5028,51 +5028,6 @@
**Prettier Similarity**: 100.00%


### js/throw_expressions/throw_expression.js
```diff
-function save(filename = throw new TypeError("Argument required")) {}
+function save(filename = throw new TypeError("Argument required")
+)
+{
+}

lint(ast, {
- with: () => throw new Error("avoid using 'with' statements."),
+ with: () => throw new Error("avoid using 'with' statements.")
});

function getEncoder(encoding) {
- const encoder =
- encoding === "utf8"
- ? new UTF8Encoder()
- : encoding === "utf16le"
- ? new UTF16Encoder(false)
- : encoding === "utf16be"
- ? new UTF16Encoder(true)
- : throw new Error("Unsupported encoding");
+ const encoder = encoding === "utf8" ? new UTF8Encoder()
+ : encoding === "utf16le" ? new UTF16Encoder(false)
+ : encoding === "utf16be" ? new UTF16Encoder(true)
+ :
+ throw new Error("Unsupported encoding");
}

class Product {
get id() {
return this._id;
}
set id(value) {
- this._id = value || throw new Error("Invalid value");
+ this._id = value ||
+ throw new Error("Invalid value");
}
}

```

**Prettier Similarity**: 53.85%


### js/throw_statement/binaryish.js

**Prettier Similarity**: 100.00%
Expand Down Expand Up @@ -5363,21 +5318,6 @@
**Prettier Similarity**: 100.00%


### jsx/do/do.js
```diff
<div>
{do {
- 1;
+ 1
}}
-</div>;
+</div>

```

**Prettier Similarity**: 60.00%


### jsx/escape/escape.js

**Prettier Similarity**: 100.00%
Expand Down Expand Up @@ -6038,36 +5978,6 @@
**Prettier Similarity**: 100.00%


### jsx/template/styled-components.js
```diff
<style jsx>{`
p {
color: red;
}
`}</style>;

<style jsx>{tpl`
p {
color: red;
}
`}</style>;

<style jsx>
- {`
- p {
- color: red;
- }
+ {`p {
+ color: red;
+ }
`}
</style>;

```

**Prettier Similarity**: 78.95%


### jsx/text-wrap/test.js
```diff
// Wrapping text
Expand Down Expand Up @@ -6652,19 +6562,6 @@
**Prettier Similarity**: 98.96%


### jsx/tuple/tuple.js
```diff
a = [<div />, <div />];

-a = #[<div />, <div />];
+a = #;
+[<div />, <div />];

```

**Prettier Similarity**: 50.00%


### typescript/abstract-class/export-default.ts

**Prettier Similarity**: 100.00%
Expand Down Expand Up @@ -8871,115 +8768,6 @@
**Prettier Similarity**: 100.00%


### typescript/error-recovery/generic.ts
```diff
f1<>();

new f2<>();

function f3<>() {}

class f4 {
constructor<>() {}
}

-const f5 = function <>() {};
+const f5 = function<>() {}

interface f6<> {
- test<>();
+ test<>();
}

class f7<> {
- test<>() {}
+ test<>() {}
}

```

**Prettier Similarity**: 84.21%


### typescript/error-recovery/index-signature.ts
```diff
type A = { [key: string] };

type TwoParams = {
[a: string, b: string]: string;
-};
+}
type ThreeParams = {
[a: string, b: string, c: string]: string;
-};
+}

type TooLong = {
- [
- loooooooooooooooooooooooooong: string,
- looooooooooooooooooooooooooooooooooooooong: string,
- ]: string;
-};
-type TooLong81 = {
- [
- loooooooooooooooooooooooooong: string,
- loooooooooooooooooong: string,
- ]: string;
-};
-type TooLong80 = {
- [loooooooooooooooooooooooooong: string, looooooooooooooooong: string]: string;
-};
+ [loooooooooooooooooooooooooong: string, looooooooooooooooooooooooooooooooooooooong: string]: string;
+}
+type TooLong81 =
+ { [loooooooooooooooooooooooooong: string, loooooooooooooooooong: string]: string;
+}
+type TooLong80 =
+ { [loooooooooooooooooooooooooong: string, looooooooooooooooong: string]: string;
+}

// note lack of trailing comma in the index signature
type TooLongSingleParam = {
[
looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong: string
]: string;
};

```

**Prettier Similarity**: 48.39%


### typescript/error-recovery/jsdoc_only_types.ts
```diff
-let a: *;
+let a:
+*
function b(x: ?) {}
-let c: ?string;
-let d: string?;
-let e: ?(string | number);
-let f: !string;
-let g: string!;
-let h: !(string | number);
+let c:
+?string
+let d: string;
+?
+let e:
+?(string | number)
+let f:
+!string;
+let g: string;
+!;
+let h:
+!(string | number);

```

**Prettier Similarity**: 6.67%


### typescript/explicit-resource-management/await-using-with-type-declaration.ts

**Prettier Similarity**: 100.00%
Expand Down
Loading

0 comments on commit bc58aed

Please sign in to comment.