facebook / facebook/hermes

prettier plugin: Infinite loop for malformed graphql relay query

Open
#1,359 0 comments 1 reaction 1 assignee Claimed by @pieterv View on GitHub
bug
Dominant language
JavaScript
Stars
11.3k
Forks
859
Avg merge
1h 30m
Merged PRs (30d)
3

Description

## Bug Description

The following code hangs forever:

```js
const prettier = require('@prettier/sync');
const prettierOptions = {
plugins: ['prettier-plugin-hermes-parser'],
};
const code = `// @flow strict
function App() {
const data = useLazyLoadQuery(graphql\`query AppQuery {} \`, {})
}
`;

for (let i = 0; i < 4; ++i) {
console.log(
prettier.format(code, { ...prettierOptions, parser: 'hermes' }).trim()
);
}
```

Hermes git revision (if applicable): `"prettier-plugin-hermes-parser": "0.19.2",`

## The Expected Behavior

Don't have infinite loops

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.