Add .graphql detection (#2256)

Test Plan:
create a `test.graphql` file that has some graphql content

```js
fragment Visit on HighlightedVisit
  @argumentDefinitions(
    count: {type: "Int", defaultValue: 20}
  ) {
  name
}
```

```
./bin/prettier.js test.graphql
```

make sure it doesn't syntax error because it's parsing it as js.
master
Christopher Chedeau 2017-06-24 11:14:36 -07:00 committed by GitHub
parent 59b3a9bc56
commit b464189fb4
1 changed files with 2 additions and 0 deletions

View File

@ -35,6 +35,8 @@ function normalize(options) {
normalized.parser = "parse5";
} else if (/\.(ts|tsx)$/.test(filepath)) {
normalized.parser = "typescript";
} else if (/\.graphql$/.test(filepath)) {
normalized.parser = "graphql";
} else if (/\.json$/.test(filepath)) {
normalized.parser = "json";
normalized.trailingComma = "none";