Skip to content

Commit 9b3bd73

Browse files
prettier fix for next-swc (vercel#47873)
This enables the existing prettier config to auto apply to code inside the `next-swc` package
1 parent 191acdf commit 9b3bd73

File tree

460 files changed

+4204
-4208
lines changed

Some content is hidden

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

460 files changed

+4204
-4208
lines changed

.prettierignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@ lerna.json
1313
.github/actions/next-stats-action/.work
1414
.github/actions/issue-validator/index.mjs
1515
.github/actions/issue-labeler/lib/index.js
16-
packages/next-swc/crates/**/*
16+
packages/next-swc/crates/next-core/js/src/compiled/**/*
17+
packages/next-swc/crates/**/tests/**/output*
1718
packages/next-swc/target/**/*
1819
packages/next-swc/native/**/*
1920
packages/next-codemod/transforms/__testfixtures__/**/*

packages/next-swc/crates/core/tests/errors/next-dynamic/too-many-arguments/input.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,5 @@ import dynamic from 'next/dynamic'
33
const DynamicComponentWithCustomLoading = dynamic(
44
() => import('../components/hello'),
55
{ loading: () => <p>...</p> },
6-
"3rd"
6+
'3rd'
77
)
Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
1-
import dynamic from 'next/dynamic'
2-
3-
const DynamicComponentWithCustomLoading = dynamic(
4-
() => import('../components/hello'),
5-
{ loading: () => <p>...</p> },
6-
"3rd"
7-
)
1+
import dynamic from 'next/dynamic';
2+
const DynamicComponentWithCustomLoading = dynamic(()=>import('../components/hello'), {
3+
loading: ()=><p>...</p>
4+
}, '3rd');
Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,2 @@
11
const getStaticProps = async () => {}
2-
export { a as getServerSideProps }
3-
2+
export { a as getServerSideProps }

packages/next-swc/crates/core/tests/errors/next-ssg/server-side-after-static-props/output.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@
22
x You can not use getStaticProps or getStaticPaths with getServerSideProps. To use SSG, please remove getServerSideProps
33
,-[input.js:1:1]
44
1 | const getStaticProps = async () => {}
5-
2 | export { a as getServerSideProps }
5+
2 | export { a as getServerSideProps }
66
: ^^^^^^^^^^^^^^^^^^
77
`----
Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,2 @@
11
export { a as getServerSideProps } from './input'
22
export { getStaticPaths } from 'a'
3-
4-
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
// This is a comment.
22

3-
"use strict";
3+
'use strict'
44

55
/**
66
* This is a comment.
77
*/
88

9-
import "client-only"
9+
import 'client-only'
1010

1111
export default function () {
12-
return null;
12+
return null
1313
}
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
// This is a comment.
2-
"use strict";
2+
'use strict';
33
/**
44
* This is a comment.
5-
*/ import "client-only";
5+
*/ import 'client-only';
66
export default function() {
77
return null;
88
}
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
export function getServerSideProps (){
2-
}
1+
export function getServerSideProps() {}
32

43
export default function () {
5-
return null;
4+
return null
65
}
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11

22
x NEXT_RSC_ERR_INVALID_API: getServerSideProps
33
,-[input.js:1:1]
4-
1 | export function getServerSideProps (){
4+
1 | export function getServerSideProps() {}
55
: ^^^^^^^^^^^^^^^^^^
6-
2 | }
76
`----
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
export function getStaticProps (){
2-
}
1+
export function getStaticProps() {}
32

43
export default function () {
5-
return null;
4+
return null
65
}
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11

22
x NEXT_RSC_ERR_INVALID_API: getStaticProps
33
,-[input.js:1:1]
4-
1 | export function getStaticProps (){
4+
1 | export function getStaticProps() {}
55
: ^^^^^^^^^^^^^^
6-
2 | }
76
`----
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
// This is a comment.
22

3-
"use strict";
3+
'use strict'
44

55
/**
66
* This is a comment.
77
*/
88

9-
import "server-only"
9+
import 'server-only'
1010

1111
export default function () {
12-
return null;
12+
return null
1313
}
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
// This is a comment.
2-
"use strict";
2+
'use strict';
33
/**
44
* This is a comment.
5-
*/ import "server-only";
5+
*/ import 'server-only';
66
export default function() {
77
return null;
88
}

packages/next-swc/crates/core/tests/errors/react-server-components/client-graph/server-only/output.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@
22
x NEXT_RSC_ERR_CLIENT_IMPORT: server-only
33
,-[input.js:8:1]
44
8 |
5-
9 | import "server-only"
5+
9 | import 'server-only'
66
: ^^^^^^^^^^^^^^^^^^^^
77
`----
Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
1-
import "react"
2-
3-
"use client"
1+
import 'react'
2+
;('use client')
43

54
export default function () {
6-
return null;
5+
return null
76
}
Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
import "react";
2-
export default function () {
3-
return null;
1+
import 'react';
2+
'use client';
3+
export default function() {
4+
return null;
45
}
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11

2-
x NEXT_RSC_ERR_CLIENT_DIRECTIVE
3-
,-[input.js:2:1]
4-
2 |
5-
3 | "use client"
6-
: ^^^^^^^^^^^^
2+
x NEXT_RSC_ERR_CLIENT_DIRECTIVE_PAREN
3+
,-[input.js:1:1]
4+
1 | import 'react'
5+
2 | ;('use client')
6+
: ^^^^^^^^^^^^^^
77
`----
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
// This is a comment.
22

3-
"use strict";
3+
'use strict'
44

55
/**
66
* This is a comment.
77
*/
88

9-
import "client-only"
9+
import 'client-only'
1010

1111
export default function () {
12-
return null;
12+
return null
1313
}
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
// This is a comment.
2-
"use strict";
2+
'use strict';
33
/**
44
* This is a comment.
5-
*/ import "client-only";
5+
*/ import 'client-only';
66
export default function() {
77
return null;
88
}

packages/next-swc/crates/core/tests/errors/react-server-components/server-graph/client-only/output.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@
22
x NEXT_RSC_ERR_SERVER_IMPORT: client-only
33
,-[input.js:8:1]
44
8 |
5-
9 | import "client-only"
5+
9 | import 'client-only'
66
: ^^^^^^^^^^^^^^^^^^^^
77
`----
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
export function getServerSideProps (){
2-
}
1+
export function getServerSideProps() {}
32

43
export default function () {
5-
return null;
4+
return null
65
}
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11

22
x NEXT_RSC_ERR_INVALID_API: getServerSideProps
33
,-[input.js:1:1]
4-
1 | export function getServerSideProps (){
4+
1 | export function getServerSideProps() {}
55
: ^^^^^^^^^^^^^^^^^^
6-
2 | }
76
`----
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
export function getStaticProps (){
2-
}
1+
export function getStaticProps() {}
32

43
export default function () {
5-
return null;
4+
return null
65
}
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11

22
x NEXT_RSC_ERR_INVALID_API: getStaticProps
33
,-[input.js:1:1]
4-
1 | export function getStaticProps (){
4+
1 | export function getStaticProps() {}
55
: ^^^^^^^^^^^^^^
6-
2 | }
76
`----

packages/next-swc/crates/core/tests/errors/react-server-components/server-graph/react-api/input.js

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,17 @@ import { createContext } from 'react'
55
import { useEffect, useImperativeHandle } from 'react'
66

77
import {
8-
Component,
9-
createFactory,
10-
PureComponent,
8+
Component,
9+
createFactory,
10+
PureComponent,
1111
useDeferredValue,
12-
useInsertionEffect,
13-
useLayoutEffect,
14-
useReducer,
15-
useRef,
16-
useSyncExternalStore
17-
} from "react"
12+
useInsertionEffect,
13+
useLayoutEffect,
14+
useReducer,
15+
useRef,
16+
useSyncExternalStore,
17+
} from 'react'
1818

1919
export default function () {
20-
return null;
20+
return null
2121
}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { useState } from 'react';
22
import { createContext } from 'react';
33
import { useEffect, useImperativeHandle } from 'react';
4-
import { Component, createFactory, PureComponent, useDeferredValue, useInsertionEffect, useLayoutEffect, useReducer, useRef, useSyncExternalStore } from "react";
4+
import { Component, createFactory, PureComponent, useDeferredValue, useInsertionEffect, useLayoutEffect, useReducer, useRef, useSyncExternalStore } from 'react';
55
export default function() {
66
return null;
77
}

packages/next-swc/crates/core/tests/errors/react-server-components/server-graph/react-api/output.stderr

Lines changed: 31 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -29,71 +29,71 @@
2929
x NEXT_RSC_ERR_REACT_API: Component
3030
,-[input.js:7:1]
3131
7 | import {
32-
8 | Component,
33-
: ^^^^^^^^^
34-
9 | createFactory,
32+
8 | Component,
33+
: ^^^^^^^^^
34+
9 | createFactory,
3535
`----
3636

3737
x NEXT_RSC_ERR_REACT_API: createFactory
3838
,-[input.js:8:1]
39-
8 | Component,
40-
9 | createFactory,
41-
: ^^^^^^^^^^^^^
42-
10 | PureComponent,
39+
8 | Component,
40+
9 | createFactory,
41+
: ^^^^^^^^^^^^^
42+
10 | PureComponent,
4343
`----
4444

4545
x NEXT_RSC_ERR_REACT_API: PureComponent
4646
,-[input.js:9:1]
47-
9 | createFactory,
48-
10 | PureComponent,
49-
: ^^^^^^^^^^^^^
47+
9 | createFactory,
48+
10 | PureComponent,
49+
: ^^^^^^^^^^^^^
5050
11 | useDeferredValue,
5151
`----
5252

5353
x NEXT_RSC_ERR_REACT_API: useDeferredValue
5454
,-[input.js:10:1]
55-
10 | PureComponent,
55+
10 | PureComponent,
5656
11 | useDeferredValue,
5757
: ^^^^^^^^^^^^^^^^
58-
12 | useInsertionEffect,
58+
12 | useInsertionEffect,
5959
`----
6060

6161
x NEXT_RSC_ERR_REACT_API: useInsertionEffect
6262
,-[input.js:11:1]
6363
11 | useDeferredValue,
64-
12 | useInsertionEffect,
65-
: ^^^^^^^^^^^^^^^^^^
66-
13 | useLayoutEffect,
64+
12 | useInsertionEffect,
65+
: ^^^^^^^^^^^^^^^^^^
66+
13 | useLayoutEffect,
6767
`----
6868

6969
x NEXT_RSC_ERR_REACT_API: useLayoutEffect
7070
,-[input.js:12:1]
71-
12 | useInsertionEffect,
72-
13 | useLayoutEffect,
73-
: ^^^^^^^^^^^^^^^
74-
14 | useReducer,
71+
12 | useInsertionEffect,
72+
13 | useLayoutEffect,
73+
: ^^^^^^^^^^^^^^^
74+
14 | useReducer,
7575
`----
7676

7777
x NEXT_RSC_ERR_REACT_API: useReducer
7878
,-[input.js:13:1]
79-
13 | useLayoutEffect,
80-
14 | useReducer,
81-
: ^^^^^^^^^^
82-
15 | useRef,
79+
13 | useLayoutEffect,
80+
14 | useReducer,
81+
: ^^^^^^^^^^
82+
15 | useRef,
8383
`----
8484

8585
x NEXT_RSC_ERR_REACT_API: useRef
8686
,-[input.js:14:1]
87-
14 | useReducer,
88-
15 | useRef,
89-
: ^^^^^^
90-
16 | useSyncExternalStore
87+
14 | useReducer,
88+
15 | useRef,
89+
: ^^^^^^
90+
16 | useSyncExternalStore,
9191
`----
9292

9393
x NEXT_RSC_ERR_REACT_API: useSyncExternalStore
9494
,-[input.js:15:1]
95-
15 | useRef,
96-
16 | useSyncExternalStore
97-
: ^^^^^^^^^^^^^^^^^^^^
98-
17 | } from "react"
95+
15 | useRef,
96+
16 | useSyncExternalStore,
97+
: ^^^^^^^^^^^^^^^^^^^^
98+
17 | } from 'react'
9999
`----

0 commit comments

Comments
 (0)