From 60488e68e323ce7ca1b2eee74ea560f486d34e68 Mon Sep 17 00:00:00 2001 From: Maedah Batool Date: Fri, 22 Apr 2022 17:03:07 +0500 Subject: [PATCH] Fix broken data fetching links in docs (#33766) * Fix broken links for Data Fetching * Fix link data fetching doc * Improve link file paths * Update errors/large-page-data.md Co-authored-by: Steven * Update links * Fix linting * Lint tests * Lint tests Co-authored-by: Steven Co-authored-by: Tim Neutkens --- docs/basic-features/eslint.md | 36 ++++++++++++------------- errors/conflicting-ssg-paths.md | 2 +- errors/gsp-redirect-during-prerender.md | 2 +- errors/gssp-export.md | 6 ++--- errors/gssp-mixed-not-found-redirect.md | 4 +-- errors/gssp-no-mutating-res.md | 2 +- errors/invalid-redirect-gssp.md | 2 +- errors/large-page-data.md | 2 +- errors/page-data-collection-timeout.md | 3 ++- errors/prerender-error.md | 2 +- errors/ssg-fallback-true-export.md | 2 +- 11 files changed, 32 insertions(+), 31 deletions(-) diff --git a/docs/basic-features/eslint.md b/docs/basic-features/eslint.md index fd342db4c80f..a8c99aea6e3b 100644 --- a/docs/basic-features/eslint.md +++ b/docs/basic-features/eslint.md @@ -80,24 +80,24 @@ This will take precedence over the configuration from `next.config.js`. Next.js provides an ESLint plugin, [`eslint-plugin-next`](https://www.npmjs.com/package/@next/eslint-plugin-next), already bundled within the base configuration that makes it possible to catch common issues and problems in a Next.js application. The full set of rules is as follows: -| | Rule | Description | -| :-: | ---------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------- | -| ✔️ | [next/google-font-display](https://nextjs.org/docs/messages/google-font-display) | Enforce optional or swap font-display behavior with Google Fonts | -| ✔️ | [next/google-font-preconnect](https://nextjs.org/docs/messages/google-font-preconnect) | Enforce preconnect usage with Google Fonts | -| ✔️ | [next/link-passhref](https://nextjs.org/docs/messages/link-passhref) | Enforce passHref prop usage with custom Link components | -| ✔️ | [next/no-css-tags](https://nextjs.org/docs/messages/no-css-tags) | Prevent manual stylesheet tags | -| ✔️ | [next/no-document-import-in-page](https://nextjs.org/docs/messages/no-document-import-in-page) | Disallow importing next/document outside of pages/document.js | -| ✔️ | [next/no-head-import-in-document](https://nextjs.org/docs/messages/no-head-import-in-document) | Disallow importing next/head in pages/document.js | -| ✔️ | [next/no-html-link-for-pages](https://nextjs.org/docs/messages/no-html-link-for-pages) | Prohibit HTML anchor links to pages without a Link component | -| ✔️ | [next/no-img-element](https://nextjs.org/docs/messages/no-img-element) | Prohibit usage of HTML <img> element | -| ✔️ | [next/no-head-element](https://nextjs.org/docs/messages/no-head-element) | Prohibit usage of HTML <head> element | -| ✔️ | [next/no-page-custom-font](https://nextjs.org/docs/messages/no-page-custom-font) | Prevent page-only custom fonts | -| ✔️ | [next/no-sync-scripts](https://nextjs.org/docs/messages/no-sync-scripts) | Forbid synchronous scripts | -| ✔️ | [next/no-title-in-document-head](https://nextjs.org/docs/messages/no-title-in-document-head) | Disallow using <title> with Head from next/document | -| ✔️ | [next/no-unwanted-polyfillio](https://nextjs.org/docs/messages/no-unwanted-polyfillio) | Prevent duplicate polyfills from Polyfill.io | -| ✔️ | [next/inline-script-id](https://nextjs.org/docs/messages/inline-script-id) | Enforce id attribute on next/script components with inline content | -| ✔️ | next/no-typos | Ensure no typos were made declaring [Next.js's data fetching function](https://nextjs.org/docs/basic-features/data-fetching) | -| ✔️ | [next/next-script-for-ga](https://nextjs.org/docs/messages/next-script-for-ga) | Use the Script component to defer loading of the script until necessary. | +| | Rule | Description | +| :-: | ------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------- | +| ✔️ | [next/google-font-display](/docs/messages/google-font-display.md) | Enforce optional or swap font-display behavior with Google Fonts | +| ✔️ | [next/google-font-preconnect](/docs/messages/google-font-preconnect.md) | Enforce preconnect usage with Google Fonts | +| ✔️ | [next/link-passhref](/docs/messages/link-passhref.md) | Enforce passHref prop usage with custom Link components | +| ✔️ | [next/no-css-tags](/docs/messages/no-css-tags.md) | Prevent manual stylesheet tags | +| ✔️ | [next/no-document-import-in-page](/docs/messages/no-document-import-in-page.md) | Disallow importing next/document outside of pages/document.js | +| ✔️ | [next/no-head-import-in-document](/docs/messages/no-head-import-in-document.md) | Disallow importing next/head in pages/document.js | +| ✔️ | [next/no-html-link-for-pages](/docs/messages/no-html-link-for-pages.md) | Prohibit HTML anchor links to pages without a Link component | +| ✔️ | [next/no-img-element](/docs/messages/no-img-element.md) | Prohibit usage of HTML <img> element | +| ✔️ | [next/no-head-element](/docs/messages/no-head-element.md) | Prohibit usage of HTML <head> element | +| ✔️ | [next/no-page-custom-font](/docs/messages/no-page-custom-font.md) | Prevent page-only custom fonts | +| ✔️ | [next/no-sync-scripts](/docs/messages/no-sync-scripts.md) | Forbid synchronous scripts | +| ✔️ | [next/no-title-in-document-head](/docs/messages/no-title-in-document-head.md) | Disallow using <title> with Head from next/document | +| ✔️ | [next/no-unwanted-polyfillio](/docs/messages/no-unwanted-polyfillio.md) | Prevent duplicate polyfills from Polyfill.io | +| ✔️ | [next/inline-script-id](/docs/messages/inline-script-id.md) | Enforce id attribute on next/script components with inline content | +| ✔️ | next/no-typos | Ensure no typos were made declaring [Next.js's data fetching function](/docs/basic-features/data-fetching/overview.md) | +| ✔️ | [next/next-script-for-ga](/docs/messages/next-script-for-ga.md) | Use the Script component to defer loading of the script until necessary. | - ✔: Enabled in the recommended configuration diff --git a/errors/conflicting-ssg-paths.md b/errors/conflicting-ssg-paths.md index 6badf67ce858..3b4a49bc87f5 100644 --- a/errors/conflicting-ssg-paths.md +++ b/errors/conflicting-ssg-paths.md @@ -65,4 +65,4 @@ export default function CatchAll() { ### Useful Links -- [`getStaticPaths` Documentation](https://nextjs.org/docs/api-reference/data-fetching/get-static-paths) +- [`getStaticPaths` Documentation](https://nextjs.org/docs/basic-features/data-fetching/get-static-paths) diff --git a/errors/gsp-redirect-during-prerender.md b/errors/gsp-redirect-during-prerender.md index 3246e0464df9..9c61bfb4040f 100644 --- a/errors/gsp-redirect-during-prerender.md +++ b/errors/gsp-redirect-during-prerender.md @@ -10,4 +10,4 @@ Remove any paths that result in a redirect from being prerendered in `getStaticP ### Useful Links -- [Data Fetching Documentation](/docs/basic-features/data-fetching/get-static-props.md) +- [Data Fetching Documentation](https://nextjs.org/docs/basic-features/data-fetching/get-static-props) diff --git a/errors/gssp-export.md b/errors/gssp-export.md index 3110e974f396..e34189ac1761 100644 --- a/errors/gssp-export.md +++ b/errors/gssp-export.md @@ -33,6 +33,6 @@ The `getServerSideProps` lifecycle is not compatible with `next export`, so you' ### Useful Links -- [Automatic Static Optimization](/docs/advanced-features/automatic-static-optimization.md) -- [`getStaticProps` documentation](/docs/basic-features/data-fetching/get-static-props.md) -- [`exportPathMap` documentation](/docs/api-reference/next.config.js/exportPathMap.md) +- [Automatic Static Optimization](https://nextjs.org/docs/advanced-features/automatic-static-optimization) +- [`getStaticProps` documentation](https://nextjs.org/docs/basic-features/data-fetching/get-static-props) +- [`exportPathMap` documentation](https://nextjs.org/docs/api-reference/next.config.js/exportPathMap) diff --git a/errors/gssp-mixed-not-found-redirect.md b/errors/gssp-mixed-not-found-redirect.md index 9765365a8394..25378bed0bd5 100644 --- a/errors/gssp-mixed-not-found-redirect.md +++ b/errors/gssp-mixed-not-found-redirect.md @@ -12,5 +12,5 @@ Make sure only `notFound` **or** `redirect` is being returned on your page's `ge ### Useful Links -- [`getStaticProps` Documentation](/docs/basic-features/data-fetching/get-static-props.md) -- [`getServerSideProps` Documentation](/docs/basic-features/data-fetching/get-server-side-props.md) +- [`getStaticProps` Documentation](https://nextjs.org/docs/basic-features/data-fetching/get-static-props) +- [`getServerSideProps` Documentation](https://nextjs.org/docs/basic-features/data-fetching/get-server-side-props) diff --git a/errors/gssp-no-mutating-res.md b/errors/gssp-no-mutating-res.md index d40db77d6ecb..64d7da5d03b1 100644 --- a/errors/gssp-no-mutating-res.md +++ b/errors/gssp-no-mutating-res.md @@ -16,4 +16,4 @@ If you’re using a custom server and running into this problem due to session m ### Useful Links -- [Data Fetching Docs](https://nextjs.org/docs/basic-features/data-fetching) +- [Data Fetching Docs](https://nextjs.org/docs/basic-features/data-fetching/index) diff --git a/errors/invalid-redirect-gssp.md b/errors/invalid-redirect-gssp.md index 7c17f2c416d4..d75fbb9fe4d0 100644 --- a/errors/invalid-redirect-gssp.md +++ b/errors/invalid-redirect-gssp.md @@ -29,4 +29,4 @@ export const getStaticProps = ({ params }) => { ### Useful Links -- [Data Fetching Documentation](/docs/basic-features/data-fetching/get-static-props.md) +- [Data Fetching Documentation](https://nextjs.org/docs/basic-features/data-fetching/get-static-props) diff --git a/errors/large-page-data.md b/errors/large-page-data.md index 62600879b441..b42c86a51fbe 100644 --- a/errors/large-page-data.md +++ b/errors/large-page-data.md @@ -10,4 +10,4 @@ Reduce the amount of data returned from `getStaticProps`, `getServerSideProps`, ### Useful Links -- [Data Fetching Documentation](https://nextjs.org/docs/basic-features/data-fetching) +- [Data Fetching Documentation](https://nextjs.org/docs/basic-features/data-fetching/overview) diff --git a/errors/page-data-collection-timeout.md b/errors/page-data-collection-timeout.md index 49d2d80fa9f6..70539d20e88d 100644 --- a/errors/page-data-collection-timeout.md +++ b/errors/page-data-collection-timeout.md @@ -15,4 +15,5 @@ When restarted it will retry all uncompleted jobs, but if a job was unsuccessful ### Useful Links -- [`getStaticPaths`](/docs/basic-features/data-fetching/get-static-paths.md) +- [`getStaticPaths`](https://nextjs.org/docs/basic-features/data-fetching/get-static-paths) +- [`getStaticProps`](https://nextjs.org/docs/basic-features/data-fetching/get-static-props) diff --git a/errors/prerender-error.md b/errors/prerender-error.md index 474926c9631b..f296fcb20f5f 100644 --- a/errors/prerender-error.md +++ b/errors/prerender-error.md @@ -11,4 +11,4 @@ While prerendering a page an error occurred. This can occur for many reasons fro - Set default values for all dynamic pages' props (avoid `undefined`, use `null` instead so it can be serialized) - Check for any out of date modules that you might be relying on - Make sure your component handles `fallback` if it is enabled in `getStaticPaths`. [Fallback docs](https://nextjs.org/docs/api-reference/data-fetching/get-static-paths#fallback-false) -- Make sure you are not trying to export (`next export`) pages that have server-side rendering enabled [(getServerSideProps)](/docs/basic-features/data-fetching/get-server-side-props.md) +- Make sure you are not trying to export (`next export`) pages that have server-side rendering enabled [(getServerSideProps)](https://nextjs.org/docs/basic-features/data-fetching/get-server-side-props) diff --git a/errors/ssg-fallback-true-export.md b/errors/ssg-fallback-true-export.md index 9696edc817d7..34bd4839526b 100644 --- a/errors/ssg-fallback-true-export.md +++ b/errors/ssg-fallback-true-export.md @@ -11,4 +11,4 @@ If you would like the `fallback: true` behavior, `next export` should not be use ### Useful Links - [deployment documentation](https://nextjs.org/docs/deployment#vercel-recommended) -- [`fallback: true` documentation](https://nextjs.org/docs/basic-features/data-fetching#fallback-true) +- [`fallback: true` documentation](https://nextjs.org/docs/api-reference/data-fetching/get-static-paths#fallback-true)