Unstable formatting of GraphQL comments at end of argument list
Open
Nobody has claimed this yet.
area:comments
area:idempotency
help wanted
lang:graphql
- Dominant language
- JavaScript
- Stars
- 52.3k
- Forks
- 5k
- Avg merge
- 19h 2m
- Merged PRs (30d)
- 117
Description
Prettier 2.0.5
Playground link
--parser graphql
Input:
# Input1: the original input
query Browse(
$offset: Int
$limit: Int
$categories: [String!]
$search: String
# $foo: Int
# $bar: Int
) {
t
}
# prettier(Input1): this is the result of formatting Input1, but
# note the output differs. Formatting should be stable.
query Browse(
$offset: Int
$limit: Int
$categories: [String!]
$search: String
) # $foo: Int
# $bar: Int
{
t
}
# prettier(prettier(Input1)): this is the result of formatting the
# formatted output of Input1. This *should* be the same as
# `prettier(Input1)` but isn't.
query Browse(
$offset: Int
$limit: Int
$categories: [String!]
$search: String # $foo: Int
) # $bar: Int
{
t
}
Output:
# Input1: the original input
query Browse(
$offset: Int
$limit: Int
$categories: [String!]
$search: String
) # $foo: Int
# $bar: Int
{
t
}
# prettier(Input1): this is the result of formatting Input1, but
# note the output differs. Formatting should be stable.
query Browse(
$offset: Int
$limit: Int
$categories: [String!]
$search: String # $foo: Int
) # $bar: Int
{
t
}
# prettier(prettier(Input1)): this is the result of formatting the
# formatted output of Input1. This *should* be the same as
# `prettier(Input1)` but isn't.
query Browse(
$offset: Int
$limit: Int
$categories: [String!]
$search: String # $foo: Int # $bar: Int
) {
t
}
Expected behavior:
prettier(prettier(graphql)) should be the same as prettier(graphql); formatting should be stable.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Use the linked GraphQL Playground reproduction with the graphql parser as the starting point. Format the provided input twice and compare both outputs; done means prettier(prettier(graphql)) matches prettier(graphql), with the comment placement stable.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- graphql, javascript
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 45/100