Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/rburgst/fastify-eslint-ts-problem
https://github.com/rburgst/fastify-eslint-ts-problem
Last synced: 2 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/rburgst/fastify-eslint-ts-problem
- Owner: rburgst
- Created: 2022-09-01T18:45:50.000Z (over 2 years ago)
- Default Branch: master
- Last Pushed: 2022-09-01T18:46:39.000Z (over 2 years ago)
- Last Synced: 2024-11-08T17:53:07.544Z (about 2 months ago)
- Language: TypeScript
- Size: 107 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Sample repo for fastify lint problem
Shows a linting problem with `reply.header()` which appears to be async even though it is not.
1. `npm install`
2. `npm test` -> all ok
3. `npm run lint` -> shows
```
11:5 error Promises must be awaited, end with a call to .catch, end with a call to .then with a rejection handler or be explicitly marked as ignored with the `void` operator @typescript-eslint/no-floating-promises
```
4. "fix" the lint error by changing `server.ts` to
```typescript
server.addHook('onSend', async (request, reply, payload) => {
await reply.header('x-foo', 'bar')
return payload
})
```
i.e. add `await` to `reply.header(...)5. run `npm run test` -> now the test hangs and times out after 5s