diff --git a/.github/workflows/stale.yml b/.github/workflows/stale.yml index 2e779633de1af..4d15b37533f69 100644 --- a/.github/workflows/stale.yml +++ b/.github/workflows/stale.yml @@ -14,7 +14,8 @@ jobs: with: only-labels: 'please add a complete reproduction' close-issue-message: 'This issue has been automatically closed after 30 days of inactivity with no reproduction. If you are running into a similar issue, please open a new issue with a reproduction. Thank you.' - days-before-issue-close: 30 + days-before-issue-close: 1 + days-before-issue-stale: 30 days-before-pr-close: -1 days-before-pr-stale: -1 exempt-issue-labels: 'blocked,must,should,keep' diff --git a/docs/advanced-features/react-18.md b/docs/advanced-features/react-18.md index 60f7504837f55..1d82c82b71b47 100644 --- a/docs/advanced-features/react-18.md +++ b/docs/advanced-features/react-18.md @@ -12,6 +12,8 @@ Ensure you have the `rc` npm tag of React installed: npm install next@latest react@rc react-dom@rc ``` +That's all! You can now start using React 18's new APIs like `startTransition` and `Suspense` in Next.js. + ### Enable SSR Streaming (Alpha) Concurrent features in React 18 include built-in support for server-side Suspense and SSR streaming support, allowing you to server-render pages using HTTP streaming. diff --git a/docs/api-reference/next/link.md b/docs/api-reference/next/link.md index ba6b656b7aa9b..a7ad63ca27047 100644 --- a/docs/api-reference/next/link.md +++ b/docs/api-reference/next/link.md @@ -204,7 +204,7 @@ The default behavior of the `Link` component is to `push` a new URL into the `hi The default behavior of `Link` is to scroll to the top of the page. When there is a hash defined it will scroll to the specific id, like a normal `` tag. To prevent scrolling to the top / hash `scroll={false}` can be added to `Link`: ```jsx - + Disables scrolling to the top ``` diff --git a/docs/basic-features/eslint.md b/docs/basic-features/eslint.md index 5e50cc656c4fb..1ce00e9cdaf00 100644 --- a/docs/basic-features/eslint.md +++ b/docs/basic-features/eslint.md @@ -90,6 +90,7 @@ Next.js provides an ESLint plugin, [`eslint-plugin-next`](https://www.npmjs.com/ | ✔️ | [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 | @@ -202,11 +203,15 @@ Then, add `prettier` to your existing ESLint config: If you would like to use `next lint` with [lint-staged](https://github.com/okonet/lint-staged) to run the linter on staged git files, you'll have to add the following to the `.lintstagedrc.js` file in the root of your project in order to specify usage of the `--file` flag. ```js +const path = require('path') + +const buildEslintCommand = (filenames) => + `next lint --fix --file ${filenames + .map((f) => path.relative(process.cwd(), f)) + .join(' --file ')}` + module.exports = { - '**/*.js?(x)': (filenames) => - `next lint --fix --file ${filenames - .map((file) => file.split(process.cwd())[1]) - .join(' --file ')}`, + '*.{js,jsx,ts,tsx}': [buildEslintCommand], } ``` diff --git a/errors/manifest.json b/errors/manifest.json index bb7a91f4a85c7..4aaeead555a5a 100644 --- a/errors/manifest.json +++ b/errors/manifest.json @@ -447,6 +447,7 @@ "path": "/errors/link-multiple-children.md" }, { "title": "no-img-element", "path": "/errors/no-img-element.md" }, + { "title": "no-head-element", "path": "/errors/no-head-element.md" }, { "title": "non-dynamic-getstaticpaths-usage", "path": "/errors/non-dynamic-getstaticpaths-usage.md" diff --git a/errors/no-head-element.md b/errors/no-head-element.md new file mode 100644 index 0000000000000..670894e64a445 --- /dev/null +++ b/errors/no-head-element.md @@ -0,0 +1,30 @@ +# No Head Element + +### Why This Error Occurred + +An HTML `` element was used to include page-level metadata, but this can cause unexpected behavior in a Next.js application. Use Next.js' built-in `` component instead. + +### Possible Ways to Fix It + +Import and use the `` component: + +```jsx +import Head from 'next/head' + +function Index() { + return ( + <> + + My page title + + + + ) +} + +export default Index +``` + +### Useful Links + +- [next/head](https://nextjs.org/docs/api-reference/next/head) diff --git a/examples/with-docker/Dockerfile b/examples/with-docker/Dockerfile index 57e44c4e05ced..aa4b329d5e399 100644 --- a/examples/with-docker/Dockerfile +++ b/examples/with-docker/Dockerfile @@ -9,9 +9,9 @@ RUN yarn install --frozen-lockfile # Rebuild the source code only when needed FROM node:16-alpine AS builder WORKDIR /app -COPY . . COPY --from=deps /app/node_modules ./node_modules -RUN yarn build && yarn install --production --ignore-scripts --prefer-offline +COPY . . +RUN yarn build # Production image, copy all the files and run next FROM node:16-alpine AS runner diff --git a/examples/with-segment-analytics/pages/_app.js b/examples/with-segment-analytics/pages/_app.js index 402797f3fa0b1..5c2c2bf7d0a2d 100644 --- a/examples/with-segment-analytics/pages/_app.js +++ b/examples/with-segment-analytics/pages/_app.js @@ -24,7 +24,10 @@ function MyApp({ Component, pageProps }) { return ( {/* Inject the Segment snippet into the of the document */} -