diff --git a/UPGRADING.md b/UPGRADING.md index 5cb8c2c5674956..cf5605e8eaebe8 100644 --- a/UPGRADING.md +++ b/UPGRADING.md @@ -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 diff --git a/errors/next-dynamic-modules.md b/errors/next-dynamic-modules.md index 6d2fbbd4d98bfd..74838f30297663 100644 --- a/errors/next-dynamic-modules.md +++ b/errors/next-dynamic-modules.md @@ -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' @@ -40,6 +41,7 @@ export default DynamicBundle ``` After + ```js import dynamic from 'next/dynamic' diff --git a/examples/blog-starter/pages/about.mdx b/examples/blog-starter/pages/about.mdx index d3362fd7d926d7..853ef5bdf87d43 100644 --- a/examples/blog-starter/pages/about.mdx +++ b/examples/blog-starter/pages/about.mdx @@ -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 }) => ( diff --git a/examples/custom-server-hapi/next-wrapper.js b/examples/custom-server-hapi/next-wrapper.js index 5e0548f6a2772a..072a6945123411 100644 --- a/examples/custom-server-hapi/next-wrapper.js +++ b/examples/custom-server-hapi/next-wrapper.js @@ -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, diff --git a/examples/custom-server-typescript/nodemon.json b/examples/custom-server-typescript/nodemon.json index 7ece2818d72465..00ea83db9500e4 100644 --- a/examples/custom-server-typescript/nodemon.json +++ b/examples/custom-server-typescript/nodemon.json @@ -2,4 +2,4 @@ "watch": ["server", "static"], "exec": "ts-node --project tsconfig.server.json server/index.ts", "ext": "js ts" -} \ No newline at end of file +} diff --git a/examples/with-rbx-bulma-pro/README.md b/examples/with-rbx-bulma-pro/README.md index 9ff957939c6c9d..5dd50b6911d436 100644 --- a/examples/with-rbx-bulma-pro/README.md +++ b/examples/with-rbx-bulma-pro/README.md @@ -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 diff --git a/examples/with-typescript/utils/sample-api.ts b/examples/with-typescript/utils/sample-api.ts index b220434d4d2ae2..a326dfa976fa2e 100644 --- a/examples/with-typescript/utils/sample-api.ts +++ b/examples/with-typescript/utils/sample-api.ts @@ -5,7 +5,7 @@ export const dataArray: User[] = [ { id: 101, name: 'Alice' }, { id: 102, name: 'Bob' }, { id: 103, name: 'Caroline' }, - { id: 104, name: 'Dave' } + { id: 104, name: 'Dave' }, ] /** @@ -13,7 +13,7 @@ export const dataArray: User[] = [ * * 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) { @@ -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') diff --git a/packages/next/build/babel/preset.ts b/packages/next/build/babel/preset.ts index 5300ea439a3d83..5b1b0168fa9c74 100644 --- a/packages/next/build/babel/preset.ts +++ b/packages/next/build/babel/preset.ts @@ -7,7 +7,7 @@ const isTest = env === 'test' type StyledJsxPlugin = [string, any] | string type StyledJsxBabelOptions = | { - plugins?: StyledJsxPlugin[], + plugins?: StyledJsxPlugin[] 'babel-test'?: boolean } | undefined @@ -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'), diff --git a/test/integration/api-support/big.json b/test/integration/api-support/big.json index 60dff4d5aca947..6e4694f35d7872 100644 --- a/test/integration/api-support/big.json +++ b/test/integration/api-support/big.json @@ -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, @@ -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, @@ -300,4 +284,4 @@ } ] } -] \ No newline at end of file +] diff --git a/test/integration/dynamic-routing/pages/[post]/[comment].js b/test/integration/dynamic-routing/pages/[post]/[comment].js index d45987e388bd0d..f0832aba77e905 100644 --- a/test/integration/dynamic-routing/pages/[post]/[comment].js +++ b/test/integration/dynamic-routing/pages/[post]/[comment].js @@ -15,9 +15,7 @@ const $comment = ({ gipQuery }) => { } $comment.getInitialProps = async ({ query }) => { - return { - gipQuery: query - } + return { gipQuery: query } } export default $comment diff --git a/test/integration/export/pages/blog/[post]/comment/[id].js b/test/integration/export/pages/blog/[post]/comment/[id].js index 883c6b39750c82..e23ec345283f54 100644 --- a/test/integration/export/pages/blog/[post]/comment/[id].js +++ b/test/integration/export/pages/blog/[post]/comment/[id].js @@ -6,9 +6,7 @@ const Page = () => { return ( <> -

- {`Blog post ${post} comment ${id || '(all)'}`} -

+

{`Blog post ${post} comment ${id || '(all)'}`}

) }