Skip to content

Commit

Permalink
Apply missing formatting (vercel#8079)
Browse files Browse the repository at this point in the history
* Reapply missing formatting

* Fix lint
  • Loading branch information
Timer authored Jul 23, 2019
1 parent ab57978 commit aac5121
Show file tree
Hide file tree
Showing 11 changed files with 38 additions and 40 deletions.
15 changes: 9 additions & 6 deletions UPGRADING.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,19 @@ The following types are different:
> This list was created by the community to help you upgrade, if you find other differences please send a pull-request to this list to help other users.
From:

```tsx
import { NextContext } from "next";
import { NextAppContext } from "next/app";
import { NextDocumentContext } from "next/document";
import { NextContext } from 'next'
import { NextAppContext } from 'next/app'
import { NextDocumentContext } from 'next/document'
```

to

```tsx
import { NextPageContext } from "next";
import { AppContext } from "next/app";
import { DocumentContext } from "next/document";
import { NextPageContext } from 'next'
import { AppContext } from 'next/app'
import { DocumentContext } from 'next/document'
```

#### The `config` key is now a special export on a page
Expand Down
2 changes: 2 additions & 0 deletions errors/next-dynamic-modules.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ Updating code that relies on this behavior is relatively straightforward! We've
Migrate to using separate dynamic calls for each module.

Before

```js
import dynamic from 'next/dynamic'

Expand Down Expand Up @@ -40,6 +41,7 @@ export default DynamicBundle
```

After

```js
import dynamic from 'next/dynamic'

Expand Down
3 changes: 2 additions & 1 deletion examples/blog-starter/pages/about.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ import Page from '../components/layouts/page'

export const meta = {
title: 'About',
summary: 'Hi! This is a placeholder page. I thought that the header was too empty so I wanted to add an element to show how to add additional pages and put a small navigation here.',
summary:
'Hi! This is a placeholder page. I thought that the header was too empty so I wanted to add an element to show how to add additional pages and put a small navigation here.',
}

export default withRouter(({ children, router }) => (
Expand Down
5 changes: 4 additions & 1 deletion examples/custom-server-hapi/next-wrapper.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,10 @@ const defaultHandlerWrapper = app => async ({ raw: { req, res }, url }, h) => {
return h.response(html).code(res.statusCode)
}

const pathWrapper = (app, pathName, opts) => async ({ raw, query, params }, h) => {
const pathWrapper = (app, pathName, opts) => async (
{ raw, query, params },
h
) => {
const html = await app.renderToHTML(
raw.req,
raw.res,
Expand Down
2 changes: 1 addition & 1 deletion examples/custom-server-typescript/nodemon.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
"watch": ["server", "static"],
"exec": "ts-node --project tsconfig.server.json server/index.ts",
"ext": "js ts"
}
}
6 changes: 5 additions & 1 deletion examples/with-rbx-bulma-pro/README.md
Original file line number Diff line number Diff line change
@@ -1,24 +1,28 @@
# rbx & bulma-pro example

## How to use

### Using `create-next-app`

Execute create-next-app with yarn or npm to bootstrap the example:

```
npm create-next-app --example with-rbx-bulma-pro with-rbx-bulma-pro-app
# or
yarn create next-app --example with-rbx-bulma-pro with-rbx-bulma-pro-app
```


### Download manually

Download the example:

```
curl https://codeload.github.com/zeit/next.js/tar.gz/canary | tar -xz --strip=2 next.js-canary/examples/with-rbx-bulma-pro
cd with-rbx-bulma-pro
```

Install it and run:

```
npm install
npm run dev
Expand Down
6 changes: 3 additions & 3 deletions examples/with-typescript/utils/sample-api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@ export const dataArray: User[] = [
{ id: 101, name: 'Alice' },
{ id: 102, name: 'Bob' },
{ id: 103, name: 'Caroline' },
{ id: 104, name: 'Dave' }
{ id: 104, name: 'Dave' },
]

/**
* Calls a mock API which finds a user by ID from the list above.
*
* Throws an error if not found.
*/
export async function findData (id: number | string) {
export async function findData(id: number | string) {
const selected = dataArray.find(data => data.id === Number(id))

if (!selected) {
Expand All @@ -24,7 +24,7 @@ export async function findData (id: number | string) {
}

/** Calls a mock API which returns the above array to simulate "get all". */
export async function findAll () {
export async function findAll() {
// Throw an error, just for example.
if (!Array.isArray(dataArray)) {
throw new Error('Cannot find users')
Expand Down
9 changes: 7 additions & 2 deletions packages/next/build/babel/preset.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ const isTest = env === 'test'
type StyledJsxPlugin = [string, any] | string
type StyledJsxBabelOptions =
| {
plugins?: StyledJsxPlugin[],
plugins?: StyledJsxPlugin[]
'babel-test'?: boolean
}
| undefined
Expand Down Expand Up @@ -119,7 +119,12 @@ module.exports = (
...options['transform-runtime'],
},
],
[(isTest && options['styled-jsx'] && options['styled-jsx']['babel-test']) ? require('styled-jsx/babel-test') : require('styled-jsx/babel'), styledJsxOptions(options['styled-jsx'])],
[
isTest && options['styled-jsx'] && options['styled-jsx']['babel-test']
? require('styled-jsx/babel-test')
: require('styled-jsx/babel'),
styledJsxOptions(options['styled-jsx']),
],
require('./plugins/amp-attributes'),
isProduction && [
require('babel-plugin-transform-react-remove-prop-types'),
Expand Down
22 changes: 3 additions & 19 deletions test/integration/api-support/big.json
Original file line number Diff line number Diff line change
Expand Up @@ -61,15 +61,7 @@
"registered": "2014-07-30T10:07:08 -02:00",
"latitude": -9.239109,
"longitude": 123.085402,
"tags": [
"incididunt",
"laboris",
"culpa",
"non",
"sint",
"sunt",
"et"
],
"tags": ["incididunt", "laboris", "culpa", "non", "sint", "sunt", "et"],
"friends": [
{
"id": 0,
Expand Down Expand Up @@ -190,15 +182,7 @@
"registered": "2017-03-03T08:55:12 -01:00",
"latitude": -54.522447,
"longitude": -80.499064,
"tags": [
"officia",
"non",
"culpa",
"non",
"deserunt",
"ex",
"velit"
],
"tags": ["officia", "non", "culpa", "non", "deserunt", "ex", "velit"],
"friends": [
{
"id": 0,
Expand Down Expand Up @@ -300,4 +284,4 @@
}
]
}
]
]
4 changes: 1 addition & 3 deletions test/integration/dynamic-routing/pages/[post]/[comment].js
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,7 @@ const $comment = ({ gipQuery }) => {
}

$comment.getInitialProps = async ({ query }) => {
return {
gipQuery: query
}
return { gipQuery: query }
}

export default $comment
4 changes: 1 addition & 3 deletions test/integration/export/pages/blog/[post]/comment/[id].js
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,7 @@ const Page = () => {

return (
<>
<p>
{`Blog post ${post} comment ${id || '(all)'}`}
</p>
<p>{`Blog post ${post} comment ${id || '(all)'}`}</p>
</>
)
}
Expand Down

0 comments on commit aac5121

Please sign in to comment.