Skip to content

Commit 6f7b781

Browse files
authored
style: remove trailing whitespace (fastify#5817)
1 parent c8286ea commit 6f7b781

28 files changed

+243
-243
lines changed

.github/workflows/benchmark-parser.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,9 +77,9 @@ jobs:
7777
**Node**: 20
7878
**PR**: ${{ needs.benchmark.outputs.PR-BENCH-20 }}
7979
**MAIN**: ${{ needs.benchmark.outputs.MAIN-BENCH-20 }}
80-
80+
8181
---
82-
82+
8383
**Node**: 22
8484
**PR**: ${{ needs.benchmark.outputs.PR-BENCH-22 }}
8585
**MAIN**: ${{ needs.benchmark.outputs.MAIN-BENCH-22 }}

.github/workflows/benchmark.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,9 +77,9 @@ jobs:
7777
**Node**: 20
7878
**PR**: ${{ needs.benchmark.outputs.PR-BENCH-20 }}
7979
**MAIN**: ${{ needs.benchmark.outputs.MAIN-BENCH-20 }}
80-
80+
8181
---
82-
82+
8383
**Node**: 22
8484
**PR**: ${{ needs.benchmark.outputs.PR-BENCH-22 }}
8585
**MAIN**: ${{ needs.benchmark.outputs.MAIN-BENCH-22 }}

.github/workflows/md-lint.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ jobs:
2727
uses: actions/checkout@v4
2828
with:
2929
persist-credentials: false
30-
30+
3131
- name: Setup Node
3232
uses: actions/setup-node@v4
3333
with:

CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ the following tasks:
107107
5. The person that does the onboarding must add you to the [npm
108108
org](https://www.npmjs.com/org/fastify), so that you can help maintaining the
109109
official plugins.
110-
6. Optionally, the person can be added as an Open Collective member
110+
6. Optionally, the person can be added as an Open Collective member
111111
by the lead team.
112112

113113
### Offboarding Collaborators

EXPENSE_POLICY.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ To claim a bounty:
9898
- The expense will be validated by a lead maintainer and then the payment will be
9999
processed by Open Collective
100100

101-
If the Open Collective budget is insufficient, the expense will be rejected.
101+
If the Open Collective budget is insufficient, the expense will be rejected.
102102
Unclaimed bounties are available for other issues.
103103

104104
[submit]: https://opencollective.com/fastify/expenses/new

docs/Guides/Database.md

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,17 @@
22

33
## Database
44

5-
Fastify's ecosystem provides a handful of
6-
plugins for connecting to various database engines.
7-
This guide covers engines that have Fastify
5+
Fastify's ecosystem provides a handful of
6+
plugins for connecting to various database engines.
7+
This guide covers engines that have Fastify
88
plugins maintained within the Fastify organization.
99

10-
> If a plugin for your database of choice does not exist
11-
> you can still use the database as Fastify is database agnostic.
12-
> By following the examples of the database plugins listed in this guide,
13-
> a plugin can be written for the missing database engine.
10+
> If a plugin for your database of choice does not exist
11+
> you can still use the database as Fastify is database agnostic.
12+
> By following the examples of the database plugins listed in this guide,
13+
> a plugin can be written for the missing database engine.
1414
15-
> If you would like to write your own Fastify plugin
15+
> If you would like to write your own Fastify plugin
1616
> please take a look at the [plugins guide](./Plugins-Guide.md)
1717
1818
### [MySQL](https://github.com/fastify/fastify-mysql)
@@ -104,8 +104,8 @@ fastify.listen({ port: 3000 }, err => {
104104
})
105105
```
106106

107-
By default `@fastify/redis` doesn't close
108-
the client connection when Fastify server shuts down.
107+
By default `@fastify/redis` doesn't close
108+
the client connection when Fastify server shuts down.
109109
To opt-in to this behavior, register the client like so:
110110

111111
```javascript
@@ -126,7 +126,7 @@ fastify.register(require('@fastify/mongodb'), {
126126
// force to close the mongodb connection when app stopped
127127
// the default value is false
128128
forceClose: true,
129-
129+
130130
url: 'mongodb://mongo/mydb'
131131
})
132132

@@ -178,8 +178,8 @@ fastify.listen({ port: 3000 }, err => {
178178
```
179179

180180
### Writing plugin for a database library
181-
We could write a plugin for a database
182-
library too (e.g. Knex, Prisma, or TypeORM).
181+
We could write a plugin for a database
182+
library too (e.g. Knex, Prisma, or TypeORM).
183183
We will use [Knex](https://knexjs.org/) in our example.
184184

185185
```javascript
@@ -281,7 +281,7 @@ async function migrate() {
281281
const client = new pg.Client({
282282
host: 'localhost',
283283
port: 5432,
284-
database: 'example',
284+
database: 'example',
285285
user: 'example',
286286
password: 'example',
287287
});
@@ -313,7 +313,7 @@ async function migrate() {
313313
console.error(err)
314314
process.exitCode = 1
315315
}
316-
316+
317317
await client.end()
318318
}
319319

docs/Guides/Detecting-When-Clients-Abort.md

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -4,30 +4,30 @@
44

55
## Introduction
66

7-
Fastify provides request events to trigger at certain points in a request's
8-
lifecycle. However, there isn't a built-in mechanism to
9-
detect unintentional client disconnection scenarios such as when the client's
7+
Fastify provides request events to trigger at certain points in a request's
8+
lifecycle. However, there isn't a built-in mechanism to
9+
detect unintentional client disconnection scenarios such as when the client's
1010
internet connection is interrupted. This guide covers methods to detect if
1111
and when a client intentionally aborts a request.
1212

13-
Keep in mind, Fastify's `clientErrorHandler` is not designed to detect when a
14-
client aborts a request. This works in the same way as the standard Node HTTP
15-
module, which triggers the `clientError` event when there is a bad request or
16-
exceedingly large header data. When a client aborts a request, there is no
13+
Keep in mind, Fastify's `clientErrorHandler` is not designed to detect when a
14+
client aborts a request. This works in the same way as the standard Node HTTP
15+
module, which triggers the `clientError` event when there is a bad request or
16+
exceedingly large header data. When a client aborts a request, there is no
1717
error on the socket and the `clientErrorHandler` will not be triggered.
1818

1919
## Solution
2020

2121
### Overview
2222

23-
The proposed solution is a possible way of detecting when a client
24-
intentionally aborts a request, such as when a browser is closed or the HTTP
25-
request is aborted from your client application. If there is an error in your
26-
application code that results in the server crashing, you may require
23+
The proposed solution is a possible way of detecting when a client
24+
intentionally aborts a request, such as when a browser is closed or the HTTP
25+
request is aborted from your client application. If there is an error in your
26+
application code that results in the server crashing, you may require
2727
additional logic to avoid a false abort detection.
2828

29-
The goal here is to detect when a client intentionally aborts a connection
30-
so your application logic can proceed accordingly. This can be useful for
29+
The goal here is to detect when a client intentionally aborts a connection
30+
so your application logic can proceed accordingly. This can be useful for
3131
logging purposes or halting business logic.
3232

3333
### Hands-on
@@ -78,10 +78,10 @@ const start = async () => {
7878
start()
7979
```
8080

81-
Our code is setting up a Fastify server which includes the following
81+
Our code is setting up a Fastify server which includes the following
8282
functionality:
8383

84-
- Accepting requests at http://localhost:3000, with a 3 second delayed response
84+
- Accepting requests at http://localhost:3000, with a 3 second delayed response
8585
of `{ ok: true }`.
8686
- An onRequest hook that triggers when every request is received.
8787
- Logic that triggers in the hook when the request is closed.
@@ -108,7 +108,7 @@ app.get('/', async (request, reply) => {
108108
})
109109
```
110110

111-
At any point in your business logic, you can check if the request has been
111+
At any point in your business logic, you can check if the request has been
112112
aborted and perform alternative actions.
113113

114114
```js
@@ -122,14 +122,14 @@ app.get('/', async (request, reply) => {
122122
})
123123
```
124124

125-
A benefit to adding this in your application code is that you can log Fastify
126-
details such as the reqId, which may be unavailable in lower-level code that
125+
A benefit to adding this in your application code is that you can log Fastify
126+
details such as the reqId, which may be unavailable in lower-level code that
127127
only has access to the raw request information.
128128

129129
### Testing
130130

131-
To test this functionality you can use an app like Postman and cancel your
132-
request within 3 seconds. Alternatively, you can use Node to send an HTTP
131+
To test this functionality you can use an app like Postman and cancel your
132+
request within 3 seconds. Alternatively, you can use Node to send an HTTP
133133
request with logic to abort the request before 3 seconds. Example:
134134

135135
```js
@@ -151,7 +151,7 @@ setTimeout(() => {
151151
}, 1000);
152152
```
153153

154-
With either approach, you should see the Fastify log appear at the moment the
154+
With either approach, you should see the Fastify log appear at the moment the
155155
request is aborted.
156156

157157
## Conclusion
@@ -160,13 +160,13 @@ Specifics of the implementation will vary from one problem to another, but the
160160
main goal of this guide was to show a very specific use case of an issue that
161161
could be solved within Fastify's ecosystem.
162162

163-
You can listen to the request close event and determine if the request was
164-
aborted or if it was successfully delivered. You can implement this solution
163+
You can listen to the request close event and determine if the request was
164+
aborted or if it was successfully delivered. You can implement this solution
165165
in an onRequest hook or directly in an individual route.
166166

167-
This approach will not trigger in the event of internet disruption, and such
168-
detection would require additional business logic. If you have flawed backend
169-
application logic that results in a server crash, then you could trigger a
170-
false detection. The `clientErrorHandler`, either by default or with custom
171-
logic, is not intended to handle this scenario and will not trigger when the
167+
This approach will not trigger in the event of internet disruption, and such
168+
detection would require additional business logic. If you have flawed backend
169+
application logic that results in a server crash, then you could trigger a
170+
false detection. The `clientErrorHandler`, either by default or with custom
171+
logic, is not intended to handle this scenario and will not trigger when the
172172
client aborts a request.

docs/Guides/Ecosystem.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,7 @@ section.
249249
plugin to authenticate HTTP requests based on API key and signature
250250
- [`fastify-appwrite`](https://github.com/Dev-Manny/fastify-appwrite) Fastify
251251
Plugin for interacting with Appwrite server.
252-
- [`fastify-asyncforge`](https://github.com/mcollina/fastify-asyncforge) Plugin
252+
- [`fastify-asyncforge`](https://github.com/mcollina/fastify-asyncforge) Plugin
253253
to access Fastify instance, logger, request and reply from Node.js [Async
254254
Local Storage](https://nodejs.org/api/async_context.html#class-asynclocalstorage).
255255
- [`fastify-at-mysql`](https://github.com/mateonunez/fastify-at-mysql) Fastify
@@ -277,7 +277,7 @@ section.
277277
development servers that require Babel transformations of JavaScript sources.
278278
- [`fastify-bcrypt`](https://github.com/beliven-it/fastify-bcrypt) A Bcrypt hash
279279
generator & checker.
280-
- [`fastify-better-sqlite3`](https://github.com/punkish/fastify-better-sqlite3)
280+
- [`fastify-better-sqlite3`](https://github.com/punkish/fastify-better-sqlite3)
281281
Plugin for better-sqlite3.
282282
- [`fastify-blipp`](https://github.com/PavelPolyakov/fastify-blipp) Prints your
283283
routes to the console, so you definitely know which endpoints are available.
@@ -289,7 +289,7 @@ section.
289289
to add [bree](https://github.com/breejs/bree) support.
290290
- [`fastify-bugsnag`](https://github.com/ZigaStrgar/fastify-bugsnag) Fastify plugin
291291
to add support for [Bugsnag](https://www.bugsnag.com/) error reporting.
292-
- [`fastify-cacheman`](https://gitlab.com/aalfiann/fastify-cacheman)
292+
- [`fastify-cacheman`](https://gitlab.com/aalfiann/fastify-cacheman)
293293
Small and efficient cache provider for Node.js with In-memory, File, Redis
294294
and MongoDB engines for Fastify
295295
- [`fastify-casbin`](https://github.com/nearform/fastify-casbin) Casbin support
@@ -344,7 +344,7 @@ section.
344344
- [`fastify-event-bus`](https://github.com/Shiva127/fastify-event-bus) Event bus
345345
support for Fastify. Built upon [js-event-bus](https://github.com/bcerati/js-event-bus).
346346
- [`fastify-evervault`](https://github.com/Briscoooe/fastify-evervault/) Fastify
347-
plugin for instantiating and encapsulating the
347+
plugin for instantiating and encapsulating the
348348
[Evervault](https://evervault.com/) client.
349349
- [`fastify-explorer`](https://github.com/Eomm/fastify-explorer) Get control of
350350
your decorators across all the encapsulated contexts.

docs/Guides/Index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ This table of contents is in alphabetical order.
1515
met in your application. This guide focuses on solving the problem using
1616
[`Hooks`](../Reference/Hooks.md), [`Decorators`](../Reference/Decorators.md),
1717
and [`Plugins`](../Reference/Plugins.md).
18-
+ [Detecting When Clients Abort](./Detecting-When-Clients-Abort.md): A
18+
+ [Detecting When Clients Abort](./Detecting-When-Clients-Abort.md): A
1919
practical guide on detecting if and when a client aborts a request.
2020
+ [Ecosystem](./Ecosystem.md): Lists all core plugins and many known community
2121
plugins.

docs/Guides/Migration-Guide-V4.md

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,13 @@ work after upgrading.
99
## Codemods
1010
### Fastify v4 Codemods
1111

12-
To help with the upgrade, we’ve worked with the team at
12+
To help with the upgrade, we’ve worked with the team at
1313
[Codemod](https://github.com/codemod-com/codemod) to
14-
publish codemods that will automatically update your code to many of
14+
publish codemods that will automatically update your code to many of
1515
the new APIs and patterns in Fastify v4.
1616

17-
Run the following
18-
[migration recipe](https://go.codemod.com/fastify-4-migration-recipe) to
17+
Run the following
18+
[migration recipe](https://go.codemod.com/fastify-4-migration-recipe) to
1919
automatically update your code to Fastify v4:
2020

2121
```
@@ -30,7 +30,7 @@ This will run the following codemods:
3030
- [`fastify/4/await-register-calls`](https://go.codemod.com/fastify-4-await-register-calls)
3131

3232
Each of these codemods automates the changes listed in the v4 migration guide.
33-
For a complete list of available Fastify codemods and further details,
33+
For a complete list of available Fastify codemods and further details,
3434
see [Codemod Registry](https://go.codemod.com/fastify).
3535

3636

@@ -52,25 +52,25 @@ fastify.register(async fastify => {
5252
console.log(err.message) // 'kaboom'
5353
throw new Error('caught')
5454
})
55-
55+
5656
fastify.get('/encapsulated', async () => {
5757
throw new Error('kaboom')
5858
})
5959
})
6060

6161
fastify.setErrorHandler(async err => {
62-
console.log(err.message) // 'caught'
62+
console.log(err.message) // 'caught'
6363
throw new Error('wrapped')
6464
})
6565

6666
const res = await fastify.inject('/encapsulated')
6767
console.log(res.json().message) // 'wrapped'
6868
```
6969

70-
>The root error handler is Fastify’s generic error handler.
71-
>This error handler will use the headers and status code in the Error object,
70+
>The root error handler is Fastify’s generic error handler.
71+
>This error handler will use the headers and status code in the Error object,
7272
>if they exist. **The headers and status code will not be automatically set if
73-
>a custom error handler is provided**.
73+
>a custom error handler is provided**.
7474
7575
### Removed `app.use()` ([#3506](https://github.com/fastify/fastify/pull/3506))
7676

@@ -242,7 +242,7 @@ As such, schemas like below will need to be changed from:
242242
properties: {
243243
api_key: { type: 'string' },
244244
image: { type: ['object', 'array'] }
245-
}
245+
}
246246
}
247247
```
248248

docs/Guides/Migration-Guide-V5.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ the following:
159159
+++ b/index.ts
160160
@@ -11,7 +11,8 @@ import {
161161
import { FromSchema, FromSchemaDefaultOptions, FromSchemaOptions, JSONSchema } from 'json-schema-to-ts'
162-
162+
163163
export interface JsonSchemaToTsProvider<
164164
Options extends FromSchemaOptions = FromSchemaDefaultOptions
165165
> extends FastifyTypeProvider {
@@ -298,7 +298,7 @@ use the `constraints` option instead.
298298
We have a more strict requirement for custom `HEAD` route when
299299
`exposeHeadRoutes: true`.
300300

301-
When you provides a custom `HEAD` route, you must either explicitly
301+
When you provides a custom `HEAD` route, you must either explicitly
302302
set `exposeHeadRoutes` to `false`
303303

304304
```js
@@ -403,7 +403,7 @@ and requires the route definition to be passed as it is defined in the route.
403403
fastify.get('/example/:file(^\\d+).png', function (request, reply) { })
404404

405405
console.log(fastify.hasRoute({
406-
method: 'GET',
406+
method: 'GET',
407407
url: '/example/12345.png'
408408
)); // true
409409
```
@@ -414,7 +414,7 @@ console.log(fastify.hasRoute({
414414
fastify.get('/example/:file(^\\d+).png', function (request, reply) { })
415415

416416
console.log(fastify.hasRoute({
417-
method: 'GET',
417+
method: 'GET',
418418
url: '/example/:file(^\\d+).png'
419419
)); // true
420420
```
@@ -480,7 +480,7 @@ or as a getter
480480
```js
481481
// v5
482482
fastify.decorateRequest('myObject', {
483-
getter () {
483+
getter () {
484484
return { hello: 'world' }
485485
}
486486
});

0 commit comments

Comments
 (0)