dotansimha / dotansimha/graphql-code-generator

git generates: warning: LF will be replaced by CRLF in src/graphql/generated/fragment-matcher.ts

Open
#5,154 3 comments 3 reactions 0 assignees View on GitHub
help wanted plugins stage/1-reproduction
Dominant language
TypeScript
Stars
11.3k
Forks
1.4k
Avg merge
1d 1h
Merged PRs (30d)
23

Description

**Describe the bug**

Whenever we create a new file with extension `.graphql` and run `graphql-codegen` to generate the required files for typescript we get the following error from git:

![image](https://user-images.githubusercontent.com/10828570/100709037-a9704c80-33ad-11eb-864d-8e483b4f1234.png)

**To Reproduce**
- Create a file `test.graphql` on a Windows machine
- Run `graphql-codegen`
- Add the newly generated files to git `git add .`
> Notice line ending warnings

The GraphQL generated code can be found [here](https://github.com/DarkLite1/hip/tree/master/src/graphql).

2. My `codegen.js` config file:

```javascript
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
/* eslint-disable @typescript-eslint/no-var-requires */

const fs = require('fs')

const token = fs.readFileSync('./token.txt')

module.exports = {
overwrite: true,
schema: {
[process.env.BACKEND_API_URI]: {
headers: {
Authorization: `Bearer ${token}`,
},
},
},
documents: 'src/**/*.graphql',
hooks: {
afterAllFileWrite: ['prettier --write'],
},
generates: {
'src/graphql/generated/schema.json': {
plugins: ['introspection'],
},
'src/graphql/generated/operations.ts': {
plugins: [
{
add: {
content: '/* eslint-disable */',
},
},
'typescript',
'typescript-operations',
'typescript-vue-apollo',
],
config: { withCompositionFunctions: true },
},
'src/graphql/generated/fragment-matcher.ts': ['fragment-matcher'],
},
}
```

**Expected behavior**
No line ending warnings as this isn't happening for manually created files.

**Environment:**

- OS: Windows Server 2016
- `@graphql-codegen/...`:
```
"@graphql-codegen/add": "^2.0.2",
"@graphql-codegen/cli": "^1.19.4",
"@graphql-codegen/fragment-matcher": "2.0.1",
"@graphql-codegen/introspection": "1.18.1",
"@graphql-codegen/typescript": "^1.19.0",
"@graphql-codegen/typescript-operations": "^1.17.12",
"@graphql-codegen/typescript-vue-apollo": "^2.3.1",
```
- NodeJS: v12.18.1

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.