dotansimha / dotansimha/graphql-code-generator

Remove trailing whitespace from comments

Open
#3,922 0 comments 0 reactions 0 assignees View on GitHub
core kind/enhancement plugins
Dominant language
TypeScript
Stars
11.3k
Forks
1.4k
Avg merge
1d 1h
Merged PRs (30d)
23

Description

**Describe the bug**

A recent version of the code generator started adding comments to the fields, this is great!

However, if the comment contained a blank line, the generator will add a single space at the end of that line. This is probably because every line is indented by a single space.

This leads to the following warnings when adding the file with git:

```text
:201: trailing whitespace.
*
:221: trailing whitespace.
*
:224: trailing whitespace.
*
warning: 3 lines add whitespace errors.
```

**To Reproduce**
Steps to reproduce the behavior:

1. My GraphQL schema:

```graphql
type Foo {
"""
This is the first line of the documentation, it will be followed by an empty line.

Here is the last line, there is an empty line in between.
"""
bar: String
}
```

2. My GraphQL operations:

```graphql
n/a
```

3. My `codegen.yml` config file:

```yml
overwrite: true
schema: http://localhost:4000/graphql
generates:
src/types.ts:
plugins:
- "typescript"
```

**Expected behavior**

I expected there to not be a trailing space on those lines.

**Environment:**

- OS: macOS 10.15.4
- `@graphql-codegen/...`:
"@graphql-codegen/cli": "^1.13.3",
"@graphql-codegen/typescript": "^1.13.3",
"@graphql-codegen/typescript-resolvers": "^1.13.3",
- NodeJS: v12.12.0

**Additional context**
n/a

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.