Skip to content

Commit

Permalink
done
Browse files Browse the repository at this point in the history
  • Loading branch information
suxin2017 committed Jul 22, 2024
1 parent dadcb02 commit b1a9582
Show file tree
Hide file tree
Showing 9 changed files with 35 additions and 51 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ impl FormatNodeRule<JsImportAssertionEntry> for FormatJsImportAssertionEntry {
f,
[FormatLiteralStringToken::new(
&key,
StringLiteralParentKind::Expression
)]
StringLiteralParentKind::Member
),]
)?;
}
_ => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,9 @@ export {
lorem_lorem_lorem_lorem_lorem_ as ipsum_ipsum_ipsum_ipsum_ipsum_ipsum_,
} from "fancy" assert {
type: "json",
"type2": "json",
type2: "json",
type23: "json",
"type24": "json",
type24: "json",
};

export { loooooooooooooooooooooooooooooooooooooooooooooooooong } from "loooooooooooooooooooooooooooooooooooooooooooooong";
Expand Down Expand Up @@ -108,9 +108,9 @@ export {
lorem_lorem_lorem_lorem_lorem_ as ipsum_ipsum_ipsum_ipsum_ipsum_ipsum_,
} from "fancy" assert {
type: "json",
"type2": "json",
type2: "json",
type23: "json",
"type24": "json",
type24: "json",
};

export {loooooooooooooooooooooooooooooooooooooooooooooooooong} from "loooooooooooooooooooooooooooooooooooooooooooooong";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ export * from "hey";
export * as something_bad_will_happen from "something_bad_might_not_happen";

export * as something_bad_will_happen from "something_bad_might_not_happen" assert {
"type": "json",
"type2": "json3",
type: "json",
type2: "json3",
};
```

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,9 @@ export {
lorem_lorem_lorem_lorem_lorem_ as ipsum_ipsum_ipsum_ipsum_ipsum_ipsum_,
} from "fancy" assert {
type: "json",
"type2": "json",
type2: "json",
type23: "json",
"type24": "json",
type24: "json",
};

export { loooooooooooooooooooooooooooooooooooooooooooooooooong } from "loooooooooooooooooooooooooooooooooooooooooooooong";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,24 +63,24 @@ import "short" assert { type: "json" };

import "very_long_import_very_long_import_very" assert {
// something good is here
"type": /****/ "json",
type: /****/ "json",
};

import "very_long_import_very_long_import_very" assert {
// something good is here
"type": /****/ "json",
"type2": /****/ "json",
type: /****/ "json",
type2: /****/ "json",
/****/
/* dangling 1 */ /* danling 2 */ // line
"type4": "json",
type4: "json",
/****/
"typetypetypetypetypetypetypetypetypetypetype": /****/ "typetypetypetypetypetypetypetypetypetypetypetypetypetype",
typetypetypetypetypetypetypetypetypetypetype: /****/ "typetypetypetypetypetypetypetypetypetypetypetypetypetype",
};
```

# Lines exceeding max width of 80 characters
```
1: import "very_long_import_very_long_import_very_long_import_very_long_import_very_long_import_very_long_import_very_long_import_";
2: import "very_long_import_very_long_import_very_long_import_very_long_import_very_long_import_very_long" assert {
20: "typetypetypetypetypetypetypetypetypetypetype": /****/ "typetypetypetypetypetypetypetypetypetypetypetypetypetype",
20: typetypetypetypetypetypetypetypetypetypetype: /****/ "typetypetypetypetypetypetypetypetypetypetypetypetypetype",
```
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ import { named } from "foo" assert { type: "json" };

import "very_long_import_very_long_import_very" assert {
// something good is here
"type": /****/ "json",
type: /****/ "json",
};

// Single named alias import
Expand Down Expand Up @@ -119,7 +119,7 @@ import {named} from "foo" assert {type: "json"};

import "very_long_import_very_long_import_very" assert {
// something good is here
"type": /****/ "json",
type: /****/ "json",
};

// Single named alias import
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,9 @@ Attribute Position: Auto
import hey from "hey";
import hey from "hey";
import "x" assert { type: "json" };
import "foo" assert { "type": "json" };
import "foo" assert { type: "json" };
import foo from "foo.json" assert { type: "json" };
import foo from "foo.json" assert { type: "json" };
import foo2 from "foo.json" assert {
"type": "json",
type: "html",
"type": "js",
};
import foo2 from "foo.json" assert { type: "json", type: "html", "type": "js" };
import a, * as b from "foo";
```
Original file line number Diff line number Diff line change
Expand Up @@ -92,14 +92,10 @@ Attribute Position: Auto
import hey from "hey";
import hey from "hey";
import "x" assert { type: "json" };
import "foo" assert { "type": "json" };
import "foo" assert { type: "json" };
import foo from "foo.json" assert { type: "json" };
import foo from "foo.json" assert { type: "json" };
import foo2 from "foo.json" assert {
"type": "json",
type: "html",
"type": "js",
};
import foo2 from "foo.json" assert { type: "json", type: "html", "type": "js" };
import a, * as b from "foo";

const foo = {};
Expand Down Expand Up @@ -137,8 +133,8 @@ export * from "hey";
export * as something_bad_will_happen from "something_bad_might_not_happen";

export * as something_bad_will_happen from "something_bad_might_not_happen" assert {
"type": "json",
"type2": "json3",
type: "json",
type2: "json3",
};

// this one should switch to use single quotes
Expand All @@ -156,7 +152,7 @@ export * as something_bad_will_happen from "something_bad_might_not_happen" asse
# Lines exceeding max width of 80 characters
```
48: export * as something_bad_will_happen from "something_bad_might_not_happen" assert {
44: export * as something_bad_will_happen from "something_bad_might_not_happen" assert {
```

## Output 1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,14 +92,10 @@ Attribute Position: Auto
import hey from "hey";
import hey from "hey";
import "x" assert { type: "json" };
import "foo" assert { "type": "json" };
import "foo" assert { type: "json" };
import foo from "foo.json" assert { type: "json" };
import foo from "foo.json" assert { type: "json" };
import foo2 from "foo.json" assert {
"type": "json",
type: "html",
"type": "js",
};
import foo2 from "foo.json" assert { type: "json", type: "html", "type": "js" };
import a, * as b from "foo";

const foo = {};
Expand Down Expand Up @@ -137,8 +133,8 @@ export * from "hey";
export * as something_bad_will_happen from "something_bad_might_not_happen";

export * as something_bad_will_happen from "something_bad_might_not_happen" assert {
"type": "json",
"type2": "json3",
type: "json",
type2: "json3",
};

// this one should switch to use single quotes
Expand All @@ -156,7 +152,7 @@ export * as something_bad_will_happen from "something_bad_might_not_happen" asse
# Lines exceeding max width of 80 characters
```
48: export * as something_bad_will_happen from "something_bad_might_not_happen" assert {
44: export * as something_bad_will_happen from "something_bad_might_not_happen" assert {
```

## Output 1
Expand All @@ -181,14 +177,10 @@ Attribute Position: Auto
import hey from 'hey';
import hey from 'hey';
import 'x' assert { type: 'json' };
import 'foo' assert { 'type': 'json' };
import 'foo' assert { type: 'json' };
import foo from 'foo.json' assert { type: 'json' };
import foo from 'foo.json' assert { type: 'json' };
import foo2 from 'foo.json' assert {
'type': 'json',
type: "html",
"type": "js",
};
import foo2 from 'foo.json' assert { type: 'json', type: "html", "type": "js" };
import a, * as b from 'foo';

const foo = {};
Expand Down Expand Up @@ -226,8 +218,8 @@ export * from 'hey';
export * as something_bad_will_happen from 'something_bad_might_not_happen';

export * as something_bad_will_happen from 'something_bad_might_not_happen' assert {
'type': 'json',
'type2': 'json3',
type: 'json',
type2: 'json3',
};

// this one should switch to use single quotes
Expand All @@ -245,5 +237,5 @@ export * as something_bad_will_happen from 'something_bad_might_not_happen' asse
# Lines exceeding max width of 80 characters
```
48: export * as something_bad_will_happen from 'something_bad_might_not_happen' assert {
44: export * as something_bad_will_happen from 'something_bad_might_not_happen' assert {
```

0 comments on commit b1a9582

Please sign in to comment.