Skip to content

Commit 9f45ef3

Browse files
authored
style(docs): apply stricter linting (#4574)
1 parent 5f4d029 commit 9f45ef3

31 files changed

+71
-67
lines changed

biome.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
{
2-
"$schema": "https://biomejs.dev/schemas/2.2.4/schema.json",
2+
"$schema": "./node_modules/@biomejs/biome/configuration_schema.json",
3+
"root": true,
34
"assist": {
45
"actions": {
56
"source": {

docs/features/event-handler/appsync-events.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ When processing batch of items with `aggregate` enabled, you must format the pay
210210

211211
=== "Error handling with batch of items"
212212

213-
```typescript hl_lines="21-24"
213+
```typescript hl_lines="25-28"
214214
--8<-- "examples/snippets/event-handler/appsync-events/errorHandlingWithBatchOfItems.ts"
215215
```
216216

docs/features/event-handler/appsync-graphql.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ You can use an AppSync JavaScript resolver or a VTL response mapping template to
176176

177177
=== "Exception Handling response"
178178

179-
```json hl_lines="11 20"
179+
```json hl_lines="9 18"
180180
--8<-- "examples/snippets/event-handler/appsync-graphql/exceptionHandlingResponse.json"
181181
```
182182

docs/features/event-handler/rest.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -479,7 +479,7 @@ You can enable response compression by using the `compress` middleware. This wil
479479

480480
=== "Response"
481481

482-
```json hl_lines="7-9 11 12"
482+
```json hl_lines="4-5 7-8"
483483
--8<-- "examples/snippets/event-handler/rest/samples/advanced_compress_res.json"
484484
```
485485

docs/features/tracer.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@ You can trace other class methods using the `captureMethod` decorator or any arb
230230

231231
=== "Manual"
232232

233-
```typescript hl_lines="7-13 19 22 26-31"
233+
```typescript hl_lines="7-10 16 21 25 27"
234234
--8<-- "examples/snippets/tracer/captureMethodManual.ts"
235235
```
236236

examples/snippets/batch/advancedTracingRecordHandler.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ const recordHandler = async (record: SQSRecord): Promise<void> => {
2222
// do something with the item
2323
subsegment?.addMetadata('item', item);
2424
} catch (error) {
25-
subsegment?.addError(error);
25+
subsegment?.addError(error as Error);
2626
throw error;
2727
}
2828
}

examples/snippets/biome.json

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"$schema": "../../node_modules/@biomejs/biome/configuration_schema.json",
3+
"extends": "//",
4+
"root": false,
5+
"linter": {
6+
"rules": {
7+
"suspicious": {
8+
"useAwait": "off"
9+
}
10+
}
11+
}
12+
}

examples/snippets/event-handler/appsync-events/errorHandlingWithBatchOfItems.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,13 @@ app.onPublish(
1818
payload: { processed: true, original_payload: payload },
1919
});
2020
} catch (error) {
21+
const errorString =
22+
error instanceof Error
23+
? `${error.name} - ${error.message}`
24+
: 'Unknown error';
2125
returnValues.push({
2226
id: payload.id,
23-
error: `${error.name} - ${error.message}`,
27+
error: errorString,
2428
});
2529
}
2630
}

examples/snippets/event-handler/appsync-graphql/advancedTestYourCode.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ describe('Unit test for AppSync GraphQL Resolver', () => {
3838
const event = onGraphqlEventFactory('listLocations', 'Query');
3939

4040
// Act
41-
const result = (await handler(event, {} as Context)) as Promise<unknown[]>;
41+
const result = (await handler(event, {} as Context)) as unknown[];
4242

4343
// Assess
4444
expect(result).toHaveLength(2);

examples/snippets/event-handler/appsync-graphql/exceptionHandling.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1+
import { AssertionError } from 'node:assert';
12
import { AppSyncGraphQLResolver } from '@aws-lambda-powertools/event-handler/appsync-graphql';
23
import { Logger } from '@aws-lambda-powertools/logger';
3-
import { AssertionError } from 'node:assert';
44
import type { Context } from 'aws-lambda';
55

66
const logger = new Logger({

0 commit comments

Comments
 (0)