Skip to content

Commit 2d9f18f

Browse files
authored
build: fix prettier configuration, reformat files, and run prettier in CI (#227)
* build: fix prettier configuration * style: reformat files with fixed prettier * ci: run prettier in CI * ci: rename format job * style: reformat again after rebasing
1 parent 2ce5919 commit 2d9f18f

File tree

18 files changed

+82
-52
lines changed

18 files changed

+82
-52
lines changed

.github/workflows/format.yaml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
name: Check formatting
2+
on:
3+
push:
4+
branches: [main]
5+
pull_request:
6+
types: [opened, synchronize, reopened]
7+
merge_group:
8+
jobs:
9+
format:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/checkout@v4
13+
with:
14+
fetch-depth: 0
15+
- name: Node.js
16+
uses: actions/setup-node@v4
17+
with:
18+
node-version: lts/*
19+
cache: 'npm'
20+
- name: Install dependencies
21+
run: npm ci
22+
- name: Check formatting
23+
run: npm run format:ci

.github/workflows/test.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,4 +47,4 @@ jobs:
4747
- name: Build
4848
run: npm run build --workspaces=true
4949
- name: Tests
50-
run: npm run test --workspaces=true
50+
run: npm run test --workspaces=true

.prettierignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,4 @@
11
.circleci
2+
dist
23
coverage
4+
CHANGELOG.md

packages/cache/src/cache-status/cache-status.ts

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -42,14 +42,17 @@ export const parseCacheStatusValue = (value: string) => {
4242
const parts = value.split(';').map((part) => part.trim())
4343
const [namePart, ...attributeParts] = parts
4444
const name = (namePart ?? '').replace(/"/g, '').toLowerCase()
45-
const attributes = attributeParts.reduce((acc, part) => {
46-
const [key, value = ''] = part.split('=')
45+
const attributes = attributeParts.reduce(
46+
(acc, part) => {
47+
const [key, value = ''] = part.split('=')
4748

48-
return {
49-
...acc,
50-
[key]: value,
51-
}
52-
}, {} as Record<string, string>)
49+
return {
50+
...acc,
51+
[key]: value,
52+
}
53+
},
54+
{} as Record<string, string>,
55+
)
5356

5457
return {
5558
attributes,

packages/dev-utils/src/lib/base64.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,6 @@ import { shouldBase64Encode } from './base64.js'
44

55
describe('`shouldBase64Encode` helper', () => {
66
test('Returns `false` for `text/` content types', async () => {
7-
expect(shouldBase64Encode("text/html")).toBeFalsy()
7+
expect(shouldBase64Encode('text/html')).toBeFalsy()
88
})
9-
})
9+
})

packages/dev/README.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
# @netlify/dev
22

3-
> [!WARNING]
4-
> This module is under active development and does **not** yet support all Netlify platform features.
3+
> [!WARNING] This module is under active development and does **not** yet support all Netlify platform features.
54
65
`@netlify/dev` is a local emulator for the Netlify production environment. While it can be used directly by advanced
76
users, it is primarily designed as a foundational library for higher-level tools like the

packages/dev/src/main.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ export class NetlifyDev {
144144
publishDir: this.#config?.config.build.publish ?? undefined,
145145
logger: this.#logger,
146146
})
147-
: {handle: async (_request: Request, response: Response) => response}
147+
: { handle: async (_request: Request, response: Response) => response }
148148

149149
// Redirects
150150
const redirects = this.#features.redirects

packages/functions/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ To use Scheduled Functions, wrap your function handler with the `schedule` funct
6868
```ts
6969
import { schedule } from '@netlify/functions'
7070

71-
export const handler = schedule("5 4 * * *", async () => {
71+
export const handler = schedule('5 4 * * *', async () => {
7272
console.log("It's 04:05 AM!")
7373
})
7474
```

packages/functions/test/helpers/main.mjs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,3 @@ export const invokeLambda = (handler, { method = 'GET', ...options } = {}) => {
1616
resolve(handler(event, {}, callback))
1717
})
1818
}
19-

packages/functions/test/helpers/mock_fetch.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import assert from "node:assert"
1+
import assert from 'node:assert'
22

33
export class MockFetch {
44
constructor() {

0 commit comments

Comments
 (0)