Skip to content

Commit fcf0afe

Browse files
authored
ci: format with prettier (#329)
* ci: format with prettier * chore: disable "only changed" just for this PR * Format with prettier * chore: re-enable only_changed for future PRs * chore: move prettier into existing lint workflow * chore: format with prettier * chore: don't clean node_modules * chore: format with prettier --------- Co-authored-by: ascorbic <ascorbic@users.noreply.github.com>
1 parent b0cc3cd commit fcf0afe

File tree

84 files changed

+4855
-2217
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

84 files changed

+4855
-2217
lines changed

.github/workflows/lint.yml

+11-1
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,24 @@ jobs:
1313
steps:
1414
- name: Checkout
1515
uses: actions/checkout@v4
16-
16+
with:
17+
ref: ${{ github.head_ref }}
18+
fetch-depth: 0
1719
- name: Setup Node.js
1820
uses: actions/setup-node@v4
1921
with:
2022
node-version: '18.x'
2123
cache: 'npm'
2224
cache-dependency-path: '**/package-lock.json'
2325
- run: npm ci
26+
- name: Prettify code
27+
uses: creyD/prettier_action@v4.3
28+
with:
29+
prettier_options: --write .
30+
only_changed: true
31+
commit_message: 'chore: format with prettier'
32+
clean_node_folder: false
33+
2434
- name: Lint
2535
# github adds inline annotation for compact or stylish format
2636
# which is different than our default for local usage

.prettierignore

+11-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,12 @@
11
dist/
2-
demo/
2+
.next
3+
playwright-report/
4+
.netlify
5+
CHANGELOG.md
6+
package-lock.json
7+
package.json
8+
edge-runtime/vendor/
9+
deno.lock
10+
tests/fixtures/simple-next-app-dist-dir/cool/output
11+
.nx
12+
custom-dist-dir

CONTRIBUTING.md

+22-13
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,19 @@
33
🎉 Thanks for considering contributing to this project! 🎉
44

55
When contributing to this repository, please first discuss the change you wish to make via an
6-
[issue](https://github.com/netlify/next-runtime/issues/new/choose). Please use the issue templates. They are there to
7-
help you and to help the maintainers gather information.
6+
[issue](https://github.com/netlify/next-runtime/issues/new/choose). Please use the issue templates.
7+
They are there to help you and to help the maintainers gather information.
88

9-
Before working on an issue, ask to be assigned to it. This makes it clear to other potential contributors that someone
10-
is working on the issue.
9+
Before working on an issue, ask to be assigned to it. This makes it clear to other potential
10+
contributors that someone is working on the issue.
1111

12-
When creating a PR, please use the template. The information in the template helps maintainers review your pull request.```
12+
When creating a PR, please use the template. The information in the template helps maintainers
13+
review your pull request.```
1314

1415
This project was made with ❤️. The simplest way to give back is by starring and sharing it online.
1516

16-
Everyone is welcome regardless of personal background. We enforce a [Code of conduct](CODE_OF_CONDUCT.md) in order to
17-
promote a positive and inclusive environment.
17+
Everyone is welcome regardless of personal background. We enforce a
18+
[Code of conduct](CODE_OF_CONDUCT.md) in order to promote a positive and inclusive environment.
1819

1920
## Development process
2021

@@ -35,7 +36,8 @@ npm test
3536

3637
## How to write commit messages
3738

38-
We use [Conventional Commit messages](https://www.conventionalcommits.org/) to automate version management.
39+
We use [Conventional Commit messages](https://www.conventionalcommits.org/) to automate version
40+
management.
3941

4042
Most common commit message prefixes are:
4143

@@ -45,15 +47,22 @@ Most common commit message prefixes are:
4547

4648
## Releasing
4749

48-
This repository uses [release-please](https://github.com/googleapis/release-please) to automate its releases.
50+
This repository uses [release-please](https://github.com/googleapis/release-please) to automate its
51+
releases.
4952

5053
## How to make a minimal reproduction
5154

52-
A reproducible test case is a small Next.js site built to demonstrate a problem - often this problem is caused by a bug in Next.js, next-runtime or user code. Your reproducible test case should contain the bare minimum features needed to clearly demonstrate the bug.
55+
A reproducible test case is a small Next.js site built to demonstrate a problem - often this problem
56+
is caused by a bug in Next.js, next-runtime or user code. Your reproducible test case should contain
57+
the bare minimum features needed to clearly demonstrate the bug.
5358

5459
Steps to create a reproducible test case:
5560

5661
- Create a new Next.js site: `npx create-next-app@latest`
57-
- Add any code or functionality related to the issue. For example, if you have problems with middleware functionality you should add all the necessary code of your middleware.
58-
- Verify that you're seeing the expected error(s) when running `netlify serve` and on a deployed version on [Netlify](https://www.netlify.com)
59-
- Publish the code (your GitHub account is a good place to do this) and then link to it when creating an issue. While creating the issue, please give as many details as possible. This could also include screenshots of error messages.
62+
- Add any code or functionality related to the issue. For example, if you have problems with
63+
middleware functionality you should add all the necessary code of your middleware.
64+
- Verify that you're seeing the expected error(s) when running `netlify serve` and on a deployed
65+
version on [Netlify](https://www.netlify.com)
66+
- Publish the code (your GitHub account is a good place to do this) and then link to it when
67+
creating an issue. While creating the issue, please give as many details as possible. This could
68+
also include screenshots of error messages.

package-lock.json

+30-8
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+3
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@
1919
"build": "node ./tools/build.js",
2020
"build:watch": "node ./tools/build.js --watch",
2121
"lint": "eslint --cache --format=codeframe --max-warnings=0 --ext .ts,.cts,.js src",
22+
"format:fix": "prettier --write .",
23+
"format:check": "prettier --check .",
2224
"test": "vitest",
2325
"test:ci": "vitest run --reporter=default --retry=3",
2426
"typecheck": "tsc --noEmit",
@@ -78,6 +80,7 @@
7880
"p-limit": "^4.0.0",
7981
"path-to-regexp": "^6.2.1",
8082
"picomatch": "^3.0.1",
83+
"prettier": "^3.2.5",
8184
"regexp-tree": "^0.1.27",
8285
"typescript": "^5.1.6",
8386
"unionfs": "^4.5.1",

renovate.json

+1-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
{
22
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
3-
"extends": [
4-
"local>netlify/renovate-config"
5-
]
3+
"extends": ["local>netlify/renovate-config"]
64
}

report/style.css

+12-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,16 @@
11
* {
2-
font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu,
3-
Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
2+
font-family:
3+
system-ui,
4+
-apple-system,
5+
BlinkMacSystemFont,
6+
'Segoe UI',
7+
Roboto,
8+
Oxygen,
9+
Ubuntu,
10+
Cantarell,
11+
'Open Sans',
12+
'Helvetica Neue',
13+
sans-serif;
414
}
515

616
.test-results {
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
export default function App({ Component, pageProps }) {
22
if (!pageProps || typeof pageProps !== 'object') {
3-
throw new Error(
4-
`Invariant: received invalid pageProps in _app, received ${pageProps}`
5-
)
3+
throw new Error(`Invariant: received invalid pageProps in _app, received ${pageProps}`)
64
}
75
return <Component {...pageProps} />
86
}

tests/fixtures/middleware-i18n/pages/index.js

+3-11
Original file line numberDiff line numberDiff line change
@@ -14,23 +14,15 @@ export default function Home() {
1414
<div />
1515
<Link href="/blank-page?foo=bar">Redirect me with URL params intact</Link>
1616
<div />
17-
<Link href="/redirect-to-google">
18-
Redirect me to Google (with no body response)
19-
</Link>
17+
<Link href="/redirect-to-google">Redirect me to Google (with no body response)</Link>
2018
<div />
21-
<Link href="/redirect-to-google">
22-
Redirect me to Google (with no stream response)
23-
</Link>
19+
<Link href="/redirect-to-google">Redirect me to Google (with no stream response)</Link>
2420
<div />
2521
<Link href="/redirect-me-alot">Redirect me alot (chained requests)</Link>
2622
<div />
2723
<Link href="/infinite-loop">Redirect me alot (infinite loop)</Link>
2824
<div />
29-
<Link
30-
href="/to?pathname=/api/ok"
31-
locale="nl"
32-
id="link-to-api-with-locale"
33-
>
25+
<Link href="/to?pathname=/api/ok" locale="nl" id="link-to-api-with-locale">
3426
Redirect me to api with locale
3527
</Link>
3628
<div />

tests/fixtures/middleware-pages/middleware.js

+1-2
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,7 @@ export async function middleware(request) {
6868
'req-url-pathname': request.nextUrl.pathname,
6969
'req-url-query': request.nextUrl.searchParams.get('foo'),
7070
'req-url-locale': request.nextUrl.locale,
71-
'req-url-params':
72-
url.pathname !== '/static' ? JSON.stringify(params(request.url)) : '{}',
71+
'req-url-params': url.pathname !== '/static' ? JSON.stringify(params(request.url)) : '{}',
7372
},
7473
})
7574
}
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
export default function App({ Component, pageProps }) {
22
if (!pageProps || typeof pageProps !== 'object') {
3-
throw new Error(
4-
`Invariant: received invalid pageProps in _app, received ${pageProps}`
5-
)
3+
throw new Error(`Invariant: received invalid pageProps in _app, received ${pageProps}`)
64
}
75
return <Component {...pageProps} />
86
}

tests/fixtures/middleware-pages/pages/html-links.js

+2-8
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,12 @@ export default function Page() {
44
return (
55
<ul>
66
<li>
7-
<Link
8-
id="with-html"
9-
href="/product/shirts_and_tops/mens_ua_playoff_polo_2.0/1327037.html"
10-
>
7+
<Link id="with-html" href="/product/shirts_and_tops/mens_ua_playoff_polo_2.0/1327037.html">
118
Does not work
129
</Link>
1310
</li>
1411
<li>
15-
<Link
16-
id="without-html"
17-
href="/product/shirts_and_tops/mens_ua_playoff_polo_2.0/1327037"
18-
>
12+
<Link id="without-html" href="/product/shirts_and_tops/mens_ua_playoff_polo_2.0/1327037">
1913
Works
2014
</Link>
2115
</li>

tests/fixtures/middleware-pages/pages/ssg/[slug].js

+1-3
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,7 @@ import { useState } from 'react'
44

55
export default function Page(props) {
66
const router = useRouter()
7-
const [asPath, setAsPath] = useState(
8-
router.isReady ? router.asPath : router.href
9-
)
7+
const [asPath, setAsPath] = useState(router.isReady ? router.asPath : router.href)
108

119
useEffect(() => {
1210
if (router.isReady) {
+3-13
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,6 @@
11
{
22
"compilerOptions": {
3-
"lib": [
4-
"dom",
5-
"dom.iterable",
6-
"esnext"
7-
],
3+
"lib": ["dom", "dom.iterable", "esnext"],
84
"allowJs": true,
95
"skipLibCheck": true,
106
"strict": false,
@@ -17,12 +13,6 @@
1713
"isolatedModules": true,
1814
"jsx": "preserve"
1915
},
20-
"include": [
21-
"next-env.d.ts",
22-
"**/*.ts",
23-
"**/*.tsx"
24-
],
25-
"exclude": [
26-
"node_modules"
27-
]
16+
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx"],
17+
"exclude": ["node_modules"]
2818
}

tests/fixtures/middleware/app/og.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,6 @@ export default function og() {
1616
>
1717
Open Graph
1818
</div>
19-
)
19+
),
2020
)
21-
}
21+
}
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
export const alt = 'Open Graph'
22

3-
export { default } from './og'
3+
export { default } from './og'
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
export async function GET(request: Request) {
2-
return new Response('Hello, from API!');
2+
return new Response('Hello, from API!')
33
}

0 commit comments

Comments
 (0)