From 9b22dc4660e4b60e56f4a2558f9d1c780ddd087f Mon Sep 17 00:00:00 2001 From: Joe Haddad Date: Sat, 12 Sep 2020 14:57:07 -0400 Subject: [PATCH 1/5] Improve custom document error message (#17048) --- packages/next/next-server/server/render.tsx | 19 ++++++++++--------- .../test/index.test.js | 10 +++++----- 2 files changed, 15 insertions(+), 14 deletions(-) diff --git a/packages/next/next-server/server/render.tsx b/packages/next/next-server/server/render.tsx index d5733179ad526..df2be19398304 100644 --- a/packages/next/next-server/server/render.tsx +++ b/packages/next/next-server/server/render.tsx @@ -2,6 +2,7 @@ import { IncomingMessage, ServerResponse } from 'http' import { ParsedUrlQuery } from 'querystring' import React from 'react' import { renderToStaticMarkup, renderToString } from 'react-dom/server' +import { warn } from '../../build/output/log' import { UnwrapPromise } from '../../lib/coalesced-function' import { GSP_NO_RETURNED_VALUE, @@ -19,9 +20,9 @@ import { isInAmpMode } from '../lib/amp' import { AmpStateContext } from '../lib/amp-context' import { AMP_RENDER_TARGET, + PERMANENT_REDIRECT_STATUS, SERVER_PROPS_ID, STATIC_PROPS_ID, - PERMANENT_REDIRECT_STATUS, TEMPORARY_REDIRECT_STATUS, } from '../lib/constants' import { defaultHead } from '../lib/head' @@ -37,13 +38,13 @@ import { AppType, ComponentsEnhancer, DocumentInitialProps, + DocumentProps, DocumentType, getDisplayName, isResSent, loadGetInitialProps, NextComponentType, RenderPage, - DocumentProps, } from '../lib/utils' import { tryGetPreviewData, __ApiPreviewProps } from './api-utils' import { denormalizePagePath } from './denormalize-page-path' @@ -906,13 +907,13 @@ export async function renderToHTML( const plural = nonRenderedComponents.length !== 1 ? 's' : '' if (nonRenderedComponents.length) { - console.warn( - `Expected Document Component${plural} ${nonRenderedComponents.join( - ', ' - )} ${ - plural ? 'were' : 'was' - } not rendered. Make sure you render them in your custom \`_document\`\n` + - `See more info here https://err.sh/next.js/missing-document-component` + const missingComponentList = nonRenderedComponents + .map((e) => `<${e} />`) + .join(', ') + warn( + `Your custom Document (pages/_document) did not render all the required subcomponent${plural}.\n` + + `Missing component${plural}: ${missingComponentList}\n` + + 'Read how to fix here: https://err.sh/next.js/missing-document-component' ) } } diff --git a/test/integration/missing-document-component-error/test/index.test.js b/test/integration/missing-document-component-error/test/index.test.js index 5502a0f628d6d..11a635cf26a41 100644 --- a/test/integration/missing-document-component-error/test/index.test.js +++ b/test/integration/missing-document-component-error/test/index.test.js @@ -40,7 +40,7 @@ const checkMissing = async (missing = [], docContent) => { describe('Missing _document components error', () => { it('should detect missing Html component', async () => { await checkMissing( - ['Html'], + [''], ` import Document, { Head, Main, NextScript } from 'next/document' @@ -65,7 +65,7 @@ describe('Missing _document components error', () => { it('should detect missing Head component', async () => { await checkMissing( - ['Head'], + [''], ` import Document, { Html, Main, NextScript } from 'next/document' @@ -89,7 +89,7 @@ describe('Missing _document components error', () => { it('should detect missing Main component', async () => { await checkMissing( - ['Main'], + ['
'], ` import Document, { Html, Head, NextScript } from 'next/document' @@ -113,7 +113,7 @@ describe('Missing _document components error', () => { it('should detect missing NextScript component', async () => { await checkMissing( - ['NextScript'], + [''], ` import Document, { Html, Head, Main } from 'next/document' @@ -136,7 +136,7 @@ describe('Missing _document components error', () => { it('should detect multiple missing document components', async () => { await checkMissing( - ['Head', 'NextScript'], + ['', ''], ` import Document, { Html, Main } from 'next/document' From 0f41062db0bb1341c76bc9190415d27de6625e64 Mon Sep 17 00:00:00 2001 From: Fran Zekan Date: Sun, 13 Sep 2020 15:06:29 +0200 Subject: [PATCH 2/5] Examples blogs: fix spelling (#17049) Throughout some of the blog examples word `formatter` is spelled as `formater`, this PR changes all of them to `formatter` --- .../components/{date-formater.tsx => date-formatter.tsx} | 4 ++-- examples/blog-starter-typescript/components/hero-post.tsx | 4 ++-- examples/blog-starter-typescript/components/post-header.tsx | 4 ++-- examples/blog-starter-typescript/components/post-preview.tsx | 4 ++-- .../components/{date-formater.js => date-formatter.js} | 2 +- examples/blog-starter/components/hero-post.js | 4 ++-- examples/blog-starter/components/post-header.js | 4 ++-- examples/blog-starter/components/post-preview.js | 4 ++-- examples/cms-kontent/components/date-formater.js | 2 +- examples/cms-kontent/components/hero-post.js | 4 ++-- examples/cms-kontent/components/post-header.js | 4 ++-- examples/cms-kontent/components/post-preview.js | 4 ++-- 12 files changed, 22 insertions(+), 22 deletions(-) rename examples/blog-starter-typescript/components/{date-formater.tsx => date-formatter.tsx} (71%) rename examples/blog-starter/components/{date-formater.js => date-formatter.js} (73%) diff --git a/examples/blog-starter-typescript/components/date-formater.tsx b/examples/blog-starter-typescript/components/date-formatter.tsx similarity index 71% rename from examples/blog-starter-typescript/components/date-formater.tsx rename to examples/blog-starter-typescript/components/date-formatter.tsx index 720b7bd50189a..e827be5e9c84d 100644 --- a/examples/blog-starter-typescript/components/date-formater.tsx +++ b/examples/blog-starter-typescript/components/date-formatter.tsx @@ -4,9 +4,9 @@ type Props = { dateString: string } -const DateFormater = ({ dateString }: Props) => { +const DateFormatter = ({ dateString }: Props) => { const date = parseISO(dateString) return } -export default DateFormater +export default DateFormatter diff --git a/examples/blog-starter-typescript/components/hero-post.tsx b/examples/blog-starter-typescript/components/hero-post.tsx index 8d769b4b7a3fb..5bd84f9bbe0d3 100644 --- a/examples/blog-starter-typescript/components/hero-post.tsx +++ b/examples/blog-starter-typescript/components/hero-post.tsx @@ -1,5 +1,5 @@ import Avatar from './avatar' -import DateFormater from './date-formater' +import DateFormatter from './date-formatter' import CoverImage from './cover-image' import Link from 'next/link' import Author from '../types/author' @@ -34,7 +34,7 @@ const HeroPost = ({
- +
diff --git a/examples/blog-starter-typescript/components/post-header.tsx b/examples/blog-starter-typescript/components/post-header.tsx index d91161ad0cd52..5e9d616aebf00 100644 --- a/examples/blog-starter-typescript/components/post-header.tsx +++ b/examples/blog-starter-typescript/components/post-header.tsx @@ -1,5 +1,5 @@ import Avatar from './avatar' -import DateFormater from './date-formater' +import DateFormatter from './date-formatter' import CoverImage from './cover-image' import PostTitle from './post-title' import Author from '../types/author' @@ -26,7 +26,7 @@ const PostHeader = ({ title, coverImage, date, author }: Props) => {
- +
diff --git a/examples/blog-starter-typescript/components/post-preview.tsx b/examples/blog-starter-typescript/components/post-preview.tsx index 1f3ad8643347e..6a02d9a6940ab 100644 --- a/examples/blog-starter-typescript/components/post-preview.tsx +++ b/examples/blog-starter-typescript/components/post-preview.tsx @@ -1,5 +1,5 @@ import Avatar from './avatar' -import DateFormater from './date-formater' +import DateFormatter from './date-formatter' import CoverImage from './cover-image' import Link from 'next/link' import Author from '../types/author' @@ -32,7 +32,7 @@ const PostPreview = ({
- +

{excerpt}

diff --git a/examples/blog-starter/components/date-formater.js b/examples/blog-starter/components/date-formatter.js similarity index 73% rename from examples/blog-starter/components/date-formater.js rename to examples/blog-starter/components/date-formatter.js index b346c94cab03f..9de4f4880011d 100644 --- a/examples/blog-starter/components/date-formater.js +++ b/examples/blog-starter/components/date-formatter.js @@ -1,6 +1,6 @@ import { parseISO, format } from 'date-fns' -export default function DateFormater({ dateString }) { +export default function DateFormatter({ dateString }) { const date = parseISO(dateString) return } diff --git a/examples/blog-starter/components/hero-post.js b/examples/blog-starter/components/hero-post.js index 68f7cb984ad03..cfedfb874fe41 100644 --- a/examples/blog-starter/components/hero-post.js +++ b/examples/blog-starter/components/hero-post.js @@ -1,5 +1,5 @@ import Avatar from '../components/avatar' -import DateFormater from '../components/date-formater' +import DateFormatter from '../components/date-formatter' import CoverImage from '../components/cover-image' import Link from 'next/link' @@ -24,7 +24,7 @@ export default function HeroPost({
- +
diff --git a/examples/blog-starter/components/post-header.js b/examples/blog-starter/components/post-header.js index 299600d6bcd2a..d1cfc20f44991 100644 --- a/examples/blog-starter/components/post-header.js +++ b/examples/blog-starter/components/post-header.js @@ -1,5 +1,5 @@ import Avatar from '../components/avatar' -import DateFormater from '../components/date-formater' +import DateFormatter from '../components/date-formatter' import CoverImage from '../components/cover-image' import PostTitle from '../components/post-title' @@ -18,7 +18,7 @@ export default function PostHeader({ title, coverImage, date, author }) {
- +
diff --git a/examples/blog-starter/components/post-preview.js b/examples/blog-starter/components/post-preview.js index ac8c8b98a5628..fd067f4f868fe 100644 --- a/examples/blog-starter/components/post-preview.js +++ b/examples/blog-starter/components/post-preview.js @@ -1,5 +1,5 @@ import Avatar from '../components/avatar' -import DateFormater from '../components/date-formater' +import DateFormatter from '../components/date-formatter' import CoverImage from './cover-image' import Link from 'next/link' @@ -22,7 +22,7 @@ export default function PostPreview({
- +

{excerpt}

diff --git a/examples/cms-kontent/components/date-formater.js b/examples/cms-kontent/components/date-formater.js index b346c94cab03f..9de4f4880011d 100644 --- a/examples/cms-kontent/components/date-formater.js +++ b/examples/cms-kontent/components/date-formater.js @@ -1,6 +1,6 @@ import { parseISO, format } from 'date-fns' -export default function DateFormater({ dateString }) { +export default function DateFormatter({ dateString }) { const date = parseISO(dateString) return } diff --git a/examples/cms-kontent/components/hero-post.js b/examples/cms-kontent/components/hero-post.js index 68f7cb984ad03..cfedfb874fe41 100644 --- a/examples/cms-kontent/components/hero-post.js +++ b/examples/cms-kontent/components/hero-post.js @@ -1,5 +1,5 @@ import Avatar from '../components/avatar' -import DateFormater from '../components/date-formater' +import DateFormatter from '../components/date-formatter' import CoverImage from '../components/cover-image' import Link from 'next/link' @@ -24,7 +24,7 @@ export default function HeroPost({
- +
diff --git a/examples/cms-kontent/components/post-header.js b/examples/cms-kontent/components/post-header.js index 4a832420cbd27..583e2e33a630f 100644 --- a/examples/cms-kontent/components/post-header.js +++ b/examples/cms-kontent/components/post-header.js @@ -1,5 +1,5 @@ import Avatar from '../components/avatar' -import DateFormater from '../components/date-formater' +import DateFormatter from '../components/date-formatter' import CoverImage from '../components/cover-image' import PostTitle from '../components/post-title' @@ -18,7 +18,7 @@ export default function PostHeader({ title, coverImage, date, author }) {
- +
diff --git a/examples/cms-kontent/components/post-preview.js b/examples/cms-kontent/components/post-preview.js index ac8c8b98a5628..fd067f4f868fe 100644 --- a/examples/cms-kontent/components/post-preview.js +++ b/examples/cms-kontent/components/post-preview.js @@ -1,5 +1,5 @@ import Avatar from '../components/avatar' -import DateFormater from '../components/date-formater' +import DateFormatter from '../components/date-formatter' import CoverImage from './cover-image' import Link from 'next/link' @@ -22,7 +22,7 @@ export default function PostPreview({
- +

{excerpt}

From 9959d7ef32bb74ec9467df86c598d0a365942d48 Mon Sep 17 00:00:00 2001 From: Bogdan Chadkin Date: Sun, 13 Sep 2020 16:29:23 +0300 Subject: [PATCH 3/5] Use babel 7 jsx syntax (#17043) For some reason babel-plugin-syntax-jsx of babel 6 was used instead of babel 7 version. --- packages/next/build/babel/plugins/jsx-pragma.ts | 3 ++- packages/next/package.json | 2 +- packages/next/types/misc.d.ts | 1 + yarn.lock | 8 +------- 4 files changed, 5 insertions(+), 9 deletions(-) diff --git a/packages/next/build/babel/plugins/jsx-pragma.ts b/packages/next/build/babel/plugins/jsx-pragma.ts index cd09b76c17518..52dd2af24e8e3 100644 --- a/packages/next/build/babel/plugins/jsx-pragma.ts +++ b/packages/next/build/babel/plugins/jsx-pragma.ts @@ -1,4 +1,5 @@ import { NodePath, PluginObj, types as BabelTypes } from '@babel/core' +import jsx from '@babel/plugin-syntax-jsx' export default function ({ types: t, @@ -6,7 +7,7 @@ export default function ({ types: typeof BabelTypes }): PluginObj { return { - inherits: require('babel-plugin-syntax-jsx'), + inherits: jsx, visitor: { JSXElement(_path, state) { state.set('jsx', true) diff --git a/packages/next/package.json b/packages/next/package.json index 9acfb60570261..03595d4878739 100644 --- a/packages/next/package.json +++ b/packages/next/package.json @@ -67,6 +67,7 @@ "@babel/plugin-proposal-object-rest-spread": "7.11.0", "@babel/plugin-syntax-bigint": "7.8.3", "@babel/plugin-syntax-dynamic-import": "7.8.3", + "@babel/plugin-syntax-jsx": "7.10.4", "@babel/plugin-transform-modules-commonjs": "7.10.4", "@babel/plugin-transform-runtime": "7.11.5", "@babel/preset-env": "7.11.5", @@ -78,7 +79,6 @@ "@next/react-dev-overlay": "9.5.4-canary.14", "@next/react-refresh-utils": "9.5.4-canary.14", "ast-types": "0.13.2", - "babel-plugin-syntax-jsx": "6.18.0", "babel-plugin-transform-define": "2.0.0", "babel-plugin-transform-react-remove-prop-types": "0.4.24", "browserslist": "4.13.0", diff --git a/packages/next/types/misc.d.ts b/packages/next/types/misc.d.ts index cbc1f67ef95ae..5b0a9f066d66c 100644 --- a/packages/next/types/misc.d.ts +++ b/packages/next/types/misc.d.ts @@ -1,5 +1,6 @@ /* eslint-disable import/no-extraneous-dependencies */ declare module '@babel/plugin-transform-modules-commonjs' +declare module '@babel/plugin-syntax-jsx' declare module 'browserslist' declare module 'cssnano-simple' { import { Plugin } from 'postcss' diff --git a/yarn.lock b/yarn.lock index 457d6ac60f80a..ef39521971cc6 100644 --- a/yarn.lock +++ b/yarn.lock @@ -766,19 +766,13 @@ dependencies: "@babel/helper-plugin-utils" "^7.8.0" -"@babel/plugin-syntax-jsx@^7.10.4": +"@babel/plugin-syntax-jsx@7.10.4", "@babel/plugin-syntax-jsx@^7.10.4", "@babel/plugin-syntax-jsx@^7.2.0": version "7.10.4" resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-jsx/-/plugin-syntax-jsx-7.10.4.tgz#39abaae3cbf710c4373d8429484e6ba21340166c" integrity sha512-KCg9mio9jwiARCB7WAcQ7Y1q+qicILjoK8LP/VkPkEKaf5dkaZZK1EcTe91a3JJlZ3qy6L5s9X52boEYi8DM9g== dependencies: "@babel/helper-plugin-utils" "^7.10.4" -"@babel/plugin-syntax-jsx@^7.2.0": - version "7.7.4" - resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-jsx/-/plugin-syntax-jsx-7.7.4.tgz#dab2b56a36fb6c3c222a1fbc71f7bf97f327a9ec" - dependencies: - "@babel/helper-plugin-utils" "^7.0.0" - "@babel/plugin-syntax-logical-assignment-operators@^7.10.4": version "7.10.4" resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-logical-assignment-operators/-/plugin-syntax-logical-assignment-operators-7.10.4.tgz#ca91ef46303530448b906652bac2e9fe9941f699" From a3c47721a1822f6eb3c2443439e33efa106a91e4 Mon Sep 17 00:00:00 2001 From: Jens Meindertsma Date: Mon, 14 Sep 2020 04:53:19 +0200 Subject: [PATCH 4/5] Include all files in Prettier (#17050) This uses the "Expand directories" feature introduces in Prettier 2.0 to automatically format all supported file types. Also, I fixed some badly formatted files. --- examples/svg-components/.babelrc | 4 +- examples/with-ant-design-less/.babelrc | 3 +- examples/with-ant-design-mobile/.babelrc | 13 +++--- .../with-ant-design-pro-layout-less/.babelrc | 6 +-- examples/with-cssed/.babelrc | 8 +--- examples/with-custom-babel-config/.babelrc | 8 +--- examples/with-custom-reverse-proxy/.babelrc | 4 +- examples/with-filbert/.babelrc | 6 +-- examples/with-flow/.babelrc | 10 ++--- examples/with-flow/flow-typed/next.js.flow | 44 +++++++++++-------- examples/with-glamor/.babelrc | 7 +-- examples/with-linaria/.babelrc | 5 +-- examples/with-lingui/.babelrc | 10 ++--- examples/with-mobx-react-lite/.babelrc | 4 +- examples/with-mobx-state-tree/.babelrc | 8 +--- examples/with-mobx/.babelrc | 4 +- examples/with-mocha/.babelrc | 2 +- examples/with-orbit-components/.babelrc | 5 ++- examples/with-react-intl/.babelrc | 19 ++++---- examples/with-react-jss/.babelrc | 2 +- .../with-react-relay-network-modern/.babelrc | 8 +--- examples/with-reason-relay/.babelrc | 10 ++--- examples/with-reasonml-todo/.babelrc | 4 +- examples/with-reasonml/.babelrc | 4 +- examples/with-rebass/.babelrc | 11 ++--- examples/with-relay-modern/.babelrc | 10 ++--- examples/with-styled-jsx-plugins/.babelrc | 4 +- examples/with-styled-jsx-scss/.babelrc | 4 +- examples/with-tailwindcss-emotion/.babelrc | 11 ++--- .../with-typescript-eslint-jest/package.json | 2 +- package.json | 4 +- test/.babelrc | 4 +- .../fixtures/targets-browsers/.babelrc | 2 +- .../fixtures/targets-string/.babelrc | 2 +- test/integration/babel-custom/test/.babelrc | 13 +++--- test/integration/babel/test/.babelrc | 13 +++--- 36 files changed, 120 insertions(+), 158 deletions(-) diff --git a/examples/svg-components/.babelrc b/examples/svg-components/.babelrc index b8a759ccadb49..a6f4434e2b740 100644 --- a/examples/svg-components/.babelrc +++ b/examples/svg-components/.babelrc @@ -1,4 +1,4 @@ { - "presets": [ "next/babel" ], - "plugins": [ "inline-react-svg" ] + "presets": ["next/babel"], + "plugins": ["inline-react-svg"] } diff --git a/examples/with-ant-design-less/.babelrc b/examples/with-ant-design-less/.babelrc index e6fec7587099c..04b7e1dae953e 100644 --- a/examples/with-ant-design-less/.babelrc +++ b/examples/with-ant-design-less/.babelrc @@ -2,7 +2,8 @@ "presets": ["next/babel"], "plugins": [ [ - "import", { + "import", + { "libraryName": "antd", "style": true } diff --git a/examples/with-ant-design-mobile/.babelrc b/examples/with-ant-design-mobile/.babelrc index 7ec4804a88b1c..89444305b2cc6 100644 --- a/examples/with-ant-design-mobile/.babelrc +++ b/examples/with-ant-design-mobile/.babelrc @@ -1,9 +1,12 @@ { - "presets": ["next/babel"], + "presets": ["next/babel"], "plugins": [ - ["import", { - "libraryName": "antd-mobile", - "style": "css" - }] + [ + "import", + { + "libraryName": "antd-mobile", + "style": "css" + } + ] ] } diff --git a/examples/with-ant-design-pro-layout-less/.babelrc b/examples/with-ant-design-pro-layout-less/.babelrc index b48316c795da2..04b7e1dae953e 100644 --- a/examples/with-ant-design-pro-layout-less/.babelrc +++ b/examples/with-ant-design-pro-layout-less/.babelrc @@ -1,7 +1,5 @@ { - "presets": [ - "next/babel" - ], + "presets": ["next/babel"], "plugins": [ [ "import", @@ -11,4 +9,4 @@ } ] ] -} \ No newline at end of file +} diff --git a/examples/with-cssed/.babelrc b/examples/with-cssed/.babelrc index 00628a7afac18..703a4831c7776 100644 --- a/examples/with-cssed/.babelrc +++ b/examples/with-cssed/.babelrc @@ -1,8 +1,4 @@ { - "presets": [ - "next/babel" - ], - "plugins": [ - "babel-plugin-macros" - ] + "presets": ["next/babel"], + "plugins": ["babel-plugin-macros"] } diff --git a/examples/with-custom-babel-config/.babelrc b/examples/with-custom-babel-config/.babelrc index 9321b9cab4e11..1009837a6569f 100644 --- a/examples/with-custom-babel-config/.babelrc +++ b/examples/with-custom-babel-config/.babelrc @@ -1,8 +1,4 @@ { - "presets": [ - "next/babel" - ], - "plugins": [ - "@babel/plugin-proposal-do-expressions" - ] + "presets": ["next/babel"], + "plugins": ["@babel/plugin-proposal-do-expressions"] } diff --git a/examples/with-custom-reverse-proxy/.babelrc b/examples/with-custom-reverse-proxy/.babelrc index d44724705b94a..1ff94f7ed28e1 100644 --- a/examples/with-custom-reverse-proxy/.babelrc +++ b/examples/with-custom-reverse-proxy/.babelrc @@ -1,5 +1,3 @@ { - "presets": [ - "next/babel" - ] + "presets": ["next/babel"] } diff --git a/examples/with-filbert/.babelrc b/examples/with-filbert/.babelrc index 9cc7017fb9b6c..646cc8f3d1476 100644 --- a/examples/with-filbert/.babelrc +++ b/examples/with-filbert/.babelrc @@ -1,4 +1,4 @@ { - "presets": ["next/babel"], - "plugins": ["macros"] - } \ No newline at end of file + "presets": ["next/babel"], + "plugins": ["macros"] +} diff --git a/examples/with-flow/.babelrc b/examples/with-flow/.babelrc index 53d70241c5c66..2dbd5ef381f08 100644 --- a/examples/with-flow/.babelrc +++ b/examples/with-flow/.babelrc @@ -1,8 +1,4 @@ { - "presets": [ - "next/babel" - ], - "plugins": [ - "transform-flow-strip-types" - ] -} \ No newline at end of file + "presets": ["next/babel"], + "plugins": ["transform-flow-strip-types"] +} diff --git a/examples/with-flow/flow-typed/next.js.flow b/examples/with-flow/flow-typed/next.js.flow index e5b2756d88722..a6087145c493f 100644 --- a/examples/with-flow/flow-typed/next.js.flow +++ b/examples/with-flow/flow-typed/next.js.flow @@ -1,32 +1,40 @@ // @flow -declare module "next" { +declare module 'next' { declare type NextApp = { - prepare(): Promise; - getRequestHandler(): any; - render(req: any, res: any, pathname: string, query: any): any; - }; + prepare(): Promise, + getRequestHandler(): any, + render(req: any, res: any, pathname: string, query: any): any, + } declare module.exports: (...opts: any) => NextApp } -declare module "next/head" { - declare module.exports: Class>; +declare module 'next/head' { + declare module.exports: Class> } -declare module "next/link" { - declare module.exports: Class>; +declare module 'next/link' { + declare module.exports: Class< + React$Component<{ href: string, prefetch?: boolean }, any> + > } -declare module "next/error" { - declare module.exports: Class>; +declare module 'next/error' { + declare module.exports: Class> } -declare module "next/document" { - declare export var Head: Class>; - declare export var Main: Class>; - declare export var NextScript: Class>; +declare module 'next/document' { + declare export var Head: Class> + declare export var Main: Class> + declare export var NextScript: Class> declare export default Class> & { - getInitialProps: (ctx: {pathname: string, query: any, req?: any, res?: any, err?: any}) => Promise; - renderPage(cb: Function): void; - }; + getInitialProps: (ctx: { + pathname: string, + query: any, + req?: any, + res?: any, + err?: any, + }) => Promise, + renderPage(cb: Function): void, + } } diff --git a/examples/with-glamor/.babelrc b/examples/with-glamor/.babelrc index b5ca29a087c3b..857ad21176e1b 100644 --- a/examples/with-glamor/.babelrc +++ b/examples/with-glamor/.babelrc @@ -1,9 +1,4 @@ { "presets": ["next/babel"], - "plugins": [ - [ - "transform-react-jsx", - { "pragma": "Glamor.createElement" } - ] - ] + "plugins": [["transform-react-jsx", { "pragma": "Glamor.createElement" }]] } diff --git a/examples/with-linaria/.babelrc b/examples/with-linaria/.babelrc index c7c203321b5b2..2a7aa6993b2cd 100644 --- a/examples/with-linaria/.babelrc +++ b/examples/with-linaria/.babelrc @@ -1,6 +1,3 @@ { - "presets": [ - "next/babel", - "linaria/babel" - ] + "presets": ["next/babel", "linaria/babel"] } diff --git a/examples/with-lingui/.babelrc b/examples/with-lingui/.babelrc index 985c48a7a692e..646cc8f3d1476 100644 --- a/examples/with-lingui/.babelrc +++ b/examples/with-lingui/.babelrc @@ -1,8 +1,4 @@ { - "presets": [ - "next/babel" - ], - "plugins": [ - "macros" - ] -} \ No newline at end of file + "presets": ["next/babel"], + "plugins": ["macros"] +} diff --git a/examples/with-mobx-react-lite/.babelrc b/examples/with-mobx-react-lite/.babelrc index d44724705b94a..1ff94f7ed28e1 100644 --- a/examples/with-mobx-react-lite/.babelrc +++ b/examples/with-mobx-react-lite/.babelrc @@ -1,5 +1,3 @@ { - "presets": [ - "next/babel" - ] + "presets": ["next/babel"] } diff --git a/examples/with-mobx-state-tree/.babelrc b/examples/with-mobx-state-tree/.babelrc index 8a6b29925cab7..1bbd4ca8f2cd9 100644 --- a/examples/with-mobx-state-tree/.babelrc +++ b/examples/with-mobx-state-tree/.babelrc @@ -1,8 +1,4 @@ { - "presets": [ - "next/babel" - ], - "plugins": [ - ["@babel/plugin-proposal-decorators", { "legacy": true }] - ] + "presets": ["next/babel"], + "plugins": [["@babel/plugin-proposal-decorators", { "legacy": true }]] } diff --git a/examples/with-mobx/.babelrc b/examples/with-mobx/.babelrc index 8414ce523601c..93a29a8387362 100644 --- a/examples/with-mobx/.babelrc +++ b/examples/with-mobx/.babelrc @@ -1,7 +1,5 @@ { - "presets": [ - "next/babel" - ], + "presets": ["next/babel"], "plugins": [ ["@babel/plugin-proposal-decorators", { "legacy": true }], ["@babel/plugin-proposal-class-properties", { "loose": true }] diff --git a/examples/with-mocha/.babelrc b/examples/with-mocha/.babelrc index a4dff5c9c927d..717376c4a019a 100644 --- a/examples/with-mocha/.babelrc +++ b/examples/with-mocha/.babelrc @@ -10,4 +10,4 @@ "presets": [["next/babel", { "preset-env": { "modules": "commonjs" } }]] } } -} \ No newline at end of file +} diff --git a/examples/with-orbit-components/.babelrc b/examples/with-orbit-components/.babelrc index a1321f6708cd7..c0df6939bfa0c 100644 --- a/examples/with-orbit-components/.babelrc +++ b/examples/with-orbit-components/.babelrc @@ -1,4 +1,7 @@ { "presets": ["next/babel"], - "plugins": [["styled-components", { "ssr": true }], "@kiwicom/babel-plugin-orbit-components"] + "plugins": [ + ["styled-components", { "ssr": true }], + "@kiwicom/babel-plugin-orbit-components" + ] } diff --git a/examples/with-react-intl/.babelrc b/examples/with-react-intl/.babelrc index ece588bc02628..13541db6e9cae 100644 --- a/examples/with-react-intl/.babelrc +++ b/examples/with-react-intl/.babelrc @@ -1,10 +1,13 @@ { - "presets": ["next/babel"], - "plugins": [ - ["babel-plugin-react-intl", { - "ast": true, - "idInterpolationPattern": "[sha512:contenthash:base64:6]", - "extractFromFormatMessageCall": true - }] + "presets": ["next/babel"], + "plugins": [ + [ + "babel-plugin-react-intl", + { + "ast": true, + "idInterpolationPattern": "[sha512:contenthash:base64:6]", + "extractFromFormatMessageCall": true + } ] - } \ No newline at end of file + ] +} diff --git a/examples/with-react-jss/.babelrc b/examples/with-react-jss/.babelrc index e49a7e6569de7..1ff94f7ed28e1 100644 --- a/examples/with-react-jss/.babelrc +++ b/examples/with-react-jss/.babelrc @@ -1,3 +1,3 @@ { "presets": ["next/babel"] -} \ No newline at end of file +} diff --git a/examples/with-react-relay-network-modern/.babelrc b/examples/with-react-relay-network-modern/.babelrc index 8a782ec48561c..f2926a3cc64c6 100644 --- a/examples/with-react-relay-network-modern/.babelrc +++ b/examples/with-react-relay-network-modern/.babelrc @@ -1,8 +1,4 @@ { - "presets": [ - "next/babel" - ], - "plugins": [ - ["relay", { artifactDirectory: "__generated__" }] - ] + "presets": ["next/babel"], + "plugins": [["relay", { "artifactDirectory": "__generated__" }]] } diff --git a/examples/with-reason-relay/.babelrc b/examples/with-reason-relay/.babelrc index 8fad94a215c1e..d236bcb94689a 100644 --- a/examples/with-reason-relay/.babelrc +++ b/examples/with-reason-relay/.babelrc @@ -1,8 +1,4 @@ { - "presets": [ - "next/babel" - ], - "plugins": [ - "relay" - ] -} \ No newline at end of file + "presets": ["next/babel"], + "plugins": ["relay"] +} diff --git a/examples/with-reasonml-todo/.babelrc b/examples/with-reasonml-todo/.babelrc index a69bdba1642c8..1ff94f7ed28e1 100644 --- a/examples/with-reasonml-todo/.babelrc +++ b/examples/with-reasonml-todo/.babelrc @@ -1,5 +1,3 @@ { - "presets": [ - "next/babel" - ], + "presets": ["next/babel"] } diff --git a/examples/with-reasonml/.babelrc b/examples/with-reasonml/.babelrc index d44724705b94a..1ff94f7ed28e1 100644 --- a/examples/with-reasonml/.babelrc +++ b/examples/with-reasonml/.babelrc @@ -1,5 +1,3 @@ { - "presets": [ - "next/babel" - ] + "presets": ["next/babel"] } diff --git a/examples/with-rebass/.babelrc b/examples/with-rebass/.babelrc index 43fff1d321677..d9c3f919cedb3 100644 --- a/examples/with-rebass/.babelrc +++ b/examples/with-rebass/.babelrc @@ -1,8 +1,9 @@ { - "presets": [ - "next/babel" - ], + "presets": ["next/babel"], "plugins": [ - ["styled-components", { "ssr": true, "displayName": true, "preprocess": false } ] + [ + "styled-components", + { "ssr": true, "displayName": true, "preprocess": false } + ] ] -} \ No newline at end of file +} diff --git a/examples/with-relay-modern/.babelrc b/examples/with-relay-modern/.babelrc index 8fad94a215c1e..d236bcb94689a 100644 --- a/examples/with-relay-modern/.babelrc +++ b/examples/with-relay-modern/.babelrc @@ -1,8 +1,4 @@ { - "presets": [ - "next/babel" - ], - "plugins": [ - "relay" - ] -} \ No newline at end of file + "presets": ["next/babel"], + "plugins": ["relay"] +} diff --git a/examples/with-styled-jsx-plugins/.babelrc b/examples/with-styled-jsx-plugins/.babelrc index f0779ab79ad1d..e3ffd2aa231b7 100644 --- a/examples/with-styled-jsx-plugins/.babelrc +++ b/examples/with-styled-jsx-plugins/.babelrc @@ -4,9 +4,7 @@ "next/babel", { "styled-jsx": { - "plugins": [ - "styled-jsx-plugin-postcss" - ] + "plugins": ["styled-jsx-plugin-postcss"] } } ] diff --git a/examples/with-styled-jsx-scss/.babelrc b/examples/with-styled-jsx-scss/.babelrc index 062279eeaa421..3eaec7a8b8557 100644 --- a/examples/with-styled-jsx-scss/.babelrc +++ b/examples/with-styled-jsx-scss/.babelrc @@ -4,9 +4,7 @@ "next/babel", { "styled-jsx": { - "plugins": [ - "styled-jsx-plugin-sass" - ] + "plugins": ["styled-jsx-plugin-sass"] } } ] diff --git a/examples/with-tailwindcss-emotion/.babelrc b/examples/with-tailwindcss-emotion/.babelrc index d952dc7b6e5e3..263afbb5fe034 100644 --- a/examples/with-tailwindcss-emotion/.babelrc +++ b/examples/with-tailwindcss-emotion/.babelrc @@ -1,9 +1,4 @@ { - "presets": [ - "next/babel" - ], - "plugins": [ - "macros", - "@emotion/babel-plugin" - ] -} \ No newline at end of file + "presets": ["next/babel"], + "plugins": ["macros", "@emotion/babel-plugin"] +} diff --git a/examples/with-typescript-eslint-jest/package.json b/examples/with-typescript-eslint-jest/package.json index 67b084d2629d6..733aa72017aa9 100644 --- a/examples/with-typescript-eslint-jest/package.json +++ b/examples/with-typescript-eslint-jest/package.json @@ -8,7 +8,7 @@ "build": "next build", "start": "next start", "type-check": "tsc --pretty --noEmit", - "format": "prettier --write \"**/*.{js,ts,tsx}\"", + "format": "prettier --write .", "lint": "eslint . --ext ts --ext tsx --ext js", "test": "jest", "test-all": "yarn lint && yarn type-check && yarn test" diff --git a/package.json b/package.json index 3c05d474b944b..9660e457a1ce5 100644 --- a/package.json +++ b/package.json @@ -24,8 +24,8 @@ "lint-eslint": "eslint . --ext js,jsx,ts,tsx --max-warnings=0", "lint": "run-p lint-typescript prettier-check lint-eslint", "lint-fix": "yarn prettier-fix && eslint . --ext js,jsx,ts,tsx --fix --max-warnings=0", - "prettier-check": "prettier --check \"**/*.{js,mjs,cjs,jsx,json,ts,tsx,md,mdx,css,html,yml,yaml,scss,less,graphql,graphqls,gql}\"", - "prettier-fix": "prettier --write \"**/*.{js,mjs,cjs,jsx,json,ts,tsx,md,mdx,css,html,yml,yaml,scss,less,graphql,graphqls,gql}\"", + "prettier-check": "prettier --check .", + "prettier-fix": "prettier --write .", "types": "lerna run types --stream", "typescript": "lerna run typescript", "prepublish": "lerna run prepublish", diff --git a/test/.babelrc b/test/.babelrc index d44724705b94a..1ff94f7ed28e1 100644 --- a/test/.babelrc +++ b/test/.babelrc @@ -1,5 +1,3 @@ { - "presets": [ - "next/babel" - ] + "presets": ["next/babel"] } diff --git a/test/integration/babel-custom/fixtures/targets-browsers/.babelrc b/test/integration/babel-custom/fixtures/targets-browsers/.babelrc index 1ee00605c4734..d7ac2d9c5392e 100644 --- a/test/integration/babel-custom/fixtures/targets-browsers/.babelrc +++ b/test/integration/babel-custom/fixtures/targets-browsers/.babelrc @@ -11,4 +11,4 @@ } ] ] -} \ No newline at end of file +} diff --git a/test/integration/babel-custom/fixtures/targets-string/.babelrc b/test/integration/babel-custom/fixtures/targets-string/.babelrc index ebec263410e33..972bc3f06d670 100644 --- a/test/integration/babel-custom/fixtures/targets-string/.babelrc +++ b/test/integration/babel-custom/fixtures/targets-string/.babelrc @@ -9,4 +9,4 @@ } ] ] -} \ No newline at end of file +} diff --git a/test/integration/babel-custom/test/.babelrc b/test/integration/babel-custom/test/.babelrc index 27c7237aeb802..b423f17883221 100644 --- a/test/integration/babel-custom/test/.babelrc +++ b/test/integration/babel-custom/test/.babelrc @@ -1,9 +1,12 @@ { "presets": [ - ["next/babel", { - "preset-env": { - "modules": "commonjs" + [ + "next/babel", + { + "preset-env": { + "modules": "commonjs" + } } - }] + ] ] -} \ No newline at end of file +} diff --git a/test/integration/babel/test/.babelrc b/test/integration/babel/test/.babelrc index 27c7237aeb802..b423f17883221 100644 --- a/test/integration/babel/test/.babelrc +++ b/test/integration/babel/test/.babelrc @@ -1,9 +1,12 @@ { "presets": [ - ["next/babel", { - "preset-env": { - "modules": "commonjs" + [ + "next/babel", + { + "preset-env": { + "modules": "commonjs" + } } - }] + ] ] -} \ No newline at end of file +} From 1d30f2179f5f2da619b819ac3e82909cac7bb4bd Mon Sep 17 00:00:00 2001 From: Joe Haddad Date: Sun, 13 Sep 2020 23:39:22 -0400 Subject: [PATCH 5/5] v9.5.4-canary.15 --- lerna.json | 2 +- packages/create-next-app/package.json | 2 +- packages/eslint-plugin-next/package.json | 2 +- packages/next-bundle-analyzer/package.json | 2 +- packages/next-codemod/package.json | 2 +- packages/next-mdx/package.json | 2 +- packages/next-plugin-google-analytics/package.json | 2 +- packages/next-plugin-sentry/package.json | 2 +- packages/next-plugin-storybook/package.json | 2 +- packages/next-polyfill-nomodule/package.json | 2 +- packages/next/package.json | 8 ++++---- packages/react-dev-overlay/package.json | 2 +- packages/react-refresh-utils/package.json | 2 +- 13 files changed, 16 insertions(+), 16 deletions(-) diff --git a/lerna.json b/lerna.json index 68cf75fcb24ce..9b30fa98d20ce 100644 --- a/lerna.json +++ b/lerna.json @@ -17,5 +17,5 @@ "registry": "https://registry.npmjs.org/" } }, - "version": "9.5.4-canary.14" + "version": "9.5.4-canary.15" } diff --git a/packages/create-next-app/package.json b/packages/create-next-app/package.json index c6d89f1dbffe3..5762d8384f2ca 100644 --- a/packages/create-next-app/package.json +++ b/packages/create-next-app/package.json @@ -1,6 +1,6 @@ { "name": "create-next-app", - "version": "9.5.4-canary.14", + "version": "9.5.4-canary.15", "keywords": [ "react", "next", diff --git a/packages/eslint-plugin-next/package.json b/packages/eslint-plugin-next/package.json index aca5fd344c747..62023945b138f 100644 --- a/packages/eslint-plugin-next/package.json +++ b/packages/eslint-plugin-next/package.json @@ -1,6 +1,6 @@ { "name": "@next/eslint-plugin-next", - "version": "9.5.4-canary.14", + "version": "9.5.4-canary.15", "description": "ESLint plugin for NextJS.", "main": "lib/index.js", "license": "MIT", diff --git a/packages/next-bundle-analyzer/package.json b/packages/next-bundle-analyzer/package.json index 61887aaf41fb7..60c9a2dacb968 100644 --- a/packages/next-bundle-analyzer/package.json +++ b/packages/next-bundle-analyzer/package.json @@ -1,6 +1,6 @@ { "name": "@next/bundle-analyzer", - "version": "9.5.4-canary.14", + "version": "9.5.4-canary.15", "main": "index.js", "license": "MIT", "repository": { diff --git a/packages/next-codemod/package.json b/packages/next-codemod/package.json index a32507efee1cc..0e8516330e265 100644 --- a/packages/next-codemod/package.json +++ b/packages/next-codemod/package.json @@ -1,6 +1,6 @@ { "name": "@next/codemod", - "version": "9.5.4-canary.14", + "version": "9.5.4-canary.15", "license": "MIT", "dependencies": { "chalk": "4.1.0", diff --git a/packages/next-mdx/package.json b/packages/next-mdx/package.json index a1b7e5dae8095..bdb4ad3cd83ed 100644 --- a/packages/next-mdx/package.json +++ b/packages/next-mdx/package.json @@ -1,6 +1,6 @@ { "name": "@next/mdx", - "version": "9.5.4-canary.14", + "version": "9.5.4-canary.15", "main": "index.js", "license": "MIT", "repository": { diff --git a/packages/next-plugin-google-analytics/package.json b/packages/next-plugin-google-analytics/package.json index 6f93ccfab91b2..e9cc7386943a1 100644 --- a/packages/next-plugin-google-analytics/package.json +++ b/packages/next-plugin-google-analytics/package.json @@ -1,6 +1,6 @@ { "name": "@next/plugin-google-analytics", - "version": "9.5.4-canary.14", + "version": "9.5.4-canary.15", "repository": { "url": "vercel/next.js", "directory": "packages/next-plugin-google-analytics" diff --git a/packages/next-plugin-sentry/package.json b/packages/next-plugin-sentry/package.json index d876024c3182a..d94b5ddf43fbd 100644 --- a/packages/next-plugin-sentry/package.json +++ b/packages/next-plugin-sentry/package.json @@ -1,6 +1,6 @@ { "name": "@next/plugin-sentry", - "version": "9.5.4-canary.14", + "version": "9.5.4-canary.15", "repository": { "url": "vercel/next.js", "directory": "packages/next-plugin-sentry" diff --git a/packages/next-plugin-storybook/package.json b/packages/next-plugin-storybook/package.json index 6f2a1e9732deb..9e8e1526f2907 100644 --- a/packages/next-plugin-storybook/package.json +++ b/packages/next-plugin-storybook/package.json @@ -1,6 +1,6 @@ { "name": "@next/plugin-storybook", - "version": "9.5.4-canary.14", + "version": "9.5.4-canary.15", "repository": { "url": "vercel/next.js", "directory": "packages/next-plugin-storybook" diff --git a/packages/next-polyfill-nomodule/package.json b/packages/next-polyfill-nomodule/package.json index c39f414ef6b33..d435eed89eced 100644 --- a/packages/next-polyfill-nomodule/package.json +++ b/packages/next-polyfill-nomodule/package.json @@ -1,6 +1,6 @@ { "name": "@next/polyfill-nomodule", - "version": "9.5.4-canary.14", + "version": "9.5.4-canary.15", "description": "A polyfill for non-dead, nomodule browsers.", "main": "dist/polyfill-nomodule.js", "license": "MIT", diff --git a/packages/next/package.json b/packages/next/package.json index 03595d4878739..d8532f2903031 100644 --- a/packages/next/package.json +++ b/packages/next/package.json @@ -1,6 +1,6 @@ { "name": "next", - "version": "9.5.4-canary.14", + "version": "9.5.4-canary.15", "description": "The React Framework", "main": "./dist/server/next.js", "license": "MIT", @@ -76,8 +76,8 @@ "@babel/preset-typescript": "7.10.4", "@babel/runtime": "7.11.2", "@babel/types": "7.11.5", - "@next/react-dev-overlay": "9.5.4-canary.14", - "@next/react-refresh-utils": "9.5.4-canary.14", + "@next/react-dev-overlay": "9.5.4-canary.15", + "@next/react-refresh-utils": "9.5.4-canary.15", "ast-types": "0.13.2", "babel-plugin-transform-define": "2.0.0", "babel-plugin-transform-react-remove-prop-types": "0.4.24", @@ -121,7 +121,7 @@ "react-dom": "^16.6.0" }, "devDependencies": { - "@next/polyfill-nomodule": "9.5.4-canary.14", + "@next/polyfill-nomodule": "9.5.4-canary.15", "@taskr/clear": "1.1.0", "@taskr/esnext": "1.1.0", "@taskr/watch": "1.1.0", diff --git a/packages/react-dev-overlay/package.json b/packages/react-dev-overlay/package.json index 84d00f88b6c81..d85051714990e 100644 --- a/packages/react-dev-overlay/package.json +++ b/packages/react-dev-overlay/package.json @@ -1,6 +1,6 @@ { "name": "@next/react-dev-overlay", - "version": "9.5.4-canary.14", + "version": "9.5.4-canary.15", "description": "A development-only overlay for developing React applications.", "repository": { "url": "vercel/next.js", diff --git a/packages/react-refresh-utils/package.json b/packages/react-refresh-utils/package.json index 76f76fc729648..dcc3687d762aa 100644 --- a/packages/react-refresh-utils/package.json +++ b/packages/react-refresh-utils/package.json @@ -1,6 +1,6 @@ { "name": "@next/react-refresh-utils", - "version": "9.5.4-canary.14", + "version": "9.5.4-canary.15", "description": "An experimental package providing utilities for React Refresh.", "repository": { "url": "vercel/next.js",