Unverified Commit 75603987 authored by Joseph's avatar Joseph Committed by GitHub

docs: root layout + opengraph-image + cna-eslit vs next lint bootstrap (#81542)

Fixes: https://github.com/vercel/next.js/issues/81529,
https://github.com/vercel/next.js/issues/81352 and
https://github.com/vercel/next.js/issues/78630
parent 8389b9f7
......@@ -293,15 +293,19 @@ You'll see a prompt like this:
> ? How would you like to configure ESLint?
>
> ❯ Strict (recommended)
> Base
> ❯ Strict (recommended)
> Base
> Cancel
- **Strict**: Includes Next.js' base ESLint configuration along with a stricter Core Web Vitals rule-set. This is the recommended configuration for developers setting up ESLint for the first time.
- **Base**: Includes Next.js' base ESLint configuration.
- **Cancel**: Skip configuration. Select this option if you plan on setting up your own custom ESLint configuration.
If `Strict` or `Base` are selected, Next.js will automatically install `eslint` and `eslint-config-next` as dependencies in your application and create an `.eslintrc.json` file in the root of your project that includes your selected configuration.
If `Strict` or `Base` are selected, Next.js will automatically install `eslint` and `eslint-config-next` as dependencies in your application and create a configuration file in the root of your project.
The ESLint config generated by `next lint` uses the older `.eslintrc.json` format. ESLint supports both [the legacy `.eslintrc.json` and the newer `eslint.config.mjs` format](https://eslint.org/docs/latest/use/configure/configuration-files#configuring-eslint).
You can manually replace `.eslintrc.json` with an `eslint.config.mjs` file using the setup recommended in our [ESLint API reference](/docs/app/api-reference/config/eslint#with-core-web-vitals), and installing the [`@eslint/eslintrc`](https://www.npmjs.com/package/@eslint/eslintrc) package. This more closely matches the ESLint setup used by `create-next-app`.
You can now run `next lint` every time you want to run ESLint to catch errors. Once ESLint has been set up, it will also automatically run during every build (`next build`). Errors will fail the build, while warnings will not.
......
......@@ -234,7 +234,7 @@ You can also add OG images for specific routes by creating a `opengraph-image.pn
The more specific image will take precedence over any OG images above it in the folder structure.
> Other image formats such as `jpeg`, `png`, and `webp` are also supported. See the [Open Graph Image docs](/docs/app/api-reference/file-conventions/metadata/opengraph-image) for more information.
> Other image formats such as `jpeg`, `png`, and `gif` are also supported. See the [Open Graph Image docs](/docs/app/api-reference/file-conventions/metadata/opengraph-image) for more information.
## Generated Open Graph images
......
......@@ -88,7 +88,7 @@ export default async function Layout({ children, params }) {
### Root Layout
The `app` directory **must** include a root `app/layout.js`.
The `app` directory **must** include a **root layout**, which is the top-most layout in the root `app` directory. Typically, the root layout is `app/layout.js`.
```tsx filename="app/layout.tsx" switcher
export default function RootLayout({
......@@ -116,8 +116,9 @@ export default function RootLayout({ children }) {
- The root layout **must** define `<html>` and `<body>` tags.
- You should **not** manually add `<head>` tags such as `<title>` and `<meta>` to root layouts. Instead, you should use the [Metadata API](/docs/app/getting-started/metadata-and-og-images) which automatically handles advanced requirements such as streaming and de-duplicating `<head>` elements.
- You can use [route groups](/docs/app/api-reference/file-conventions/route-groups) to create multiple root layouts.
- You can use [route groups](/docs/app/api-reference/file-conventions/route-groups) to create **multiple root layouts**.
- Navigating **across multiple root layouts** will cause a **full page load** (as opposed to a client-side navigation). For example, navigating from `/cart` that uses `app/(shop)/layout.js` to `/blog` that uses `app/(marketing)/layout.js` will cause a full page load. This **only** applies to multiple root layouts.
- The root layout can be under a **dynamic segment**, for example when implementing [internationalization](/docs/app/guides/internationalization) with `app/[lang]/layout.js`.
## Caveats
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment