Skip to content

Print null argument list item#9787

Merged
sosukesuzuki merged 4 commits intoprettier:masterfrom
sosukesuzuki:fix-9735
Dec 8, 2020
Merged

Print null argument list item#9787
sosukesuzuki merged 4 commits intoprettier:masterfrom
sosukesuzuki:fix-9735

Conversation

@sosukesuzuki
Copy link
Copy Markdown
Contributor

@sosukesuzuki sosukesuzuki commented Nov 28, 2020

Description

Fixes #9735

Checklist

  • I’ve added tests to confirm my change works.
  • (If the change is user-facing) I’ve added my changes to changelog_unreleased/*/XXXX.md file following changelog_unreleased/TEMPLATE.md.
  • I’ve read the contributing guidelines.

Try the playground for this PR

@fisker
Copy link
Copy Markdown
Member

fisker commented Nov 28, 2020

This error seems too generic, can we handle null in Call.arguments?

@sosukesuzuki
Copy link
Copy Markdown
Contributor Author

@fisker Should we throw error?

@fisker
Copy link
Copy Markdown
Member

fisker commented Nov 28, 2020

I think not, if not too hard to print.

Copy link
Copy Markdown
Member

@fisker fisker left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, better add some comments test

Prettier pr-9787
Playground link

--parser babel

Input:

foo("a",
    //1
    , "b");

Output:

foo(
  "a",
  ,
  //1
  "b"
);

And, don't forgot change title.

@sosukesuzuki sosukesuzuki changed the title Throw syntax error "Unexpected token ," Print null argument list item Dec 1, 2020
@sosukesuzuki sosukesuzuki merged commit aaa9363 into prettier:master Dec 8, 2020
@sosukesuzuki sosukesuzuki deleted the fix-9735 branch December 8, 2020 04:52
@thorn0
Copy link
Copy Markdown
Member

thorn0 commented Dec 8, 2020

These exceptions still happen: example 1, example 2

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

TypeError: Cannot read property 'type' of null

3 participants