Unverified Commit 332aaf39 authored by Joseph's avatar Joseph Committed by GitHub

docs: getting started installation and next lint removal (#84781)

- [x] verify rendering of the changes

Also addressing: #84772

---------
Co-authored-by: 's avatarJiwon Choi <devjiwonchoi@gmail.com>
parent 7296aa62
......@@ -47,7 +47,7 @@ bun dev
Before you begin, make sure your system meets the following requirements:
- [Node.js 18.18](https://nodejs.org/) or later.
- [Node.js 20.9](https://nodejs.org/) or later.
- macOS, Windows (including WSL), or Linux.
## Create with the CLI
......@@ -62,8 +62,18 @@ On installation, you'll see the following prompts:
```txt filename="Terminal"
What is your project named? my-app
Would you like to use the recommended Next.js defaults?
Yes, use recommended defaults - TypeScript, ESLint, Tailwind CSS, App Router, Turbopack
No, reuse previous settings
No, customize settings - Choose your own preferences
```
If you choose to `customize settings`, you'll see the following prompts:
```txt filename="Terminal"
Would you like to use TypeScript? No / Yes
Which linter would you like to use? ESLint / Biome / None
Would you like to use React Compiler? No / Yes
Would you like to use Tailwind CSS? No / Yes
Would you like your code inside a `src/` directory? No / Yes
Would you like to use App Router? (recommended) No / Yes
......@@ -346,9 +356,9 @@ npx @next/codemod@canary next-lint-to-eslint-cli .
If you use ESLint, create an explicit config (recommended `eslint.config.mjs`). ESLint supports both [the legacy `.eslintrc.*` and the newer `eslint.config.mjs` formats](https://eslint.org/docs/latest/use/configure/configuration-files#configuring-eslint). See the [ESLint API reference](/docs/app/api-reference/config/eslint#with-core-web-vitals) for a recommended setup.
> **Good to know**: Prior to Next.js 16, `next build` ran linting automatically. Now, this automatic build-time linting has been removed. Control when linting runs by invoking your linter via npm scripts.
> **Good to know**: Starting with Next.js 16, `next build` no longer runs the linter automatically. Instead, you can run your linter through NPM scripts.
See the [ESLint Plugin](/docs/app/api-reference/config/next-config-js/eslint) page for more information.
See the [ESLint Plugin](/docs/app/api-reference/config/eslint) page for more information.
## Set up Absolute Imports and Module Path Aliases
......
......@@ -582,6 +582,6 @@ If everything worked, you now have a functioning Next.js application running as
- **Optimize images** with the [`<Image>` component](/docs/app/api-reference/components/image)
- **Optimize fonts** with [`next/font`](/docs/app/api-reference/components/font)
- **Optimize third-party scripts** with the [`<Script>` component](/docs/app/guides/scripts)
- **Enable ESLint** with Next.js recommended rules by running `npx next lint` and configuring it to match your project’s needs
- **Enable ESLint** with Next.js [recommended rules](/docs/app/api-reference/config/eslint#setup-eslint)
> **Note**: Using a static export (`output: 'export'`) [does not currently support](https://github.com/vercel/next.js/issues/54393) the `useParams` hook or other server features. To use all Next.js features, remove `output: 'export'` from your `next.config.ts`.
---
title: eslint
description: Next.js reports ESLint errors and warnings during builds by default. Learn how to opt-out of this behavior here.
---
{/* The content of this doc is shared between the app and pages router. You can use the `<PagesOnly>Content</PagesOnly>` component to add content that is specific to the Pages Router. Any shared content should not be wrapped in a component. */}
When ESLint is detected in your project, Next.js fails your **production build** (`next build`) when errors are present.
If you'd like Next.js to produce production code even when your application has ESLint errors, you can disable the built-in linting step completely. This is not recommended unless you already have ESLint configured to run in a separate part of your workflow (for example, in CI or a pre-commit hook).
Open `next.config.js` and enable the `ignoreDuringBuilds` option in the `eslint` config:
```js filename="next.config.js"
module.exports = {
eslint: {
// Warning: This allows production builds to successfully complete even if
// your project has ESLint errors.
ignoreDuringBuilds: true,
},
}
```
......@@ -460,7 +460,7 @@ This keeps your editor strict via `tsconfig.json` while allowing the production
>
> - IDEs typically read `tsconfig.json` for diagnostics and IntelliSense, so you can still see IDE warnings while production builds use the alternate config. Mirror critical options if you want parity in the editor.
> - In development, only `tsconfig.json` is watched for changes. If you edit a different file name via `typescript.tsconfigPath`, restart the dev server to apply changes.
> - The configured file is used in `next dev`, `next build`, `next lint`, and `next typegen`.
> - The configured file is used in `next dev`, `next build`, and `next typegen`.
### Disabling TypeScript errors in production
......
......@@ -71,14 +71,12 @@ Would you like to customize the import alias (`@/*` by default)? No / Yes
### Linter Options
**ESLint**: The traditional and most popular JavaScript linter. Includes Next.js-specific rules from `eslint-plugin-next`.
**ESLint**: The traditional and most popular JavaScript linter. Includes Next.js-specific rules from `@next/eslint-plugin-next`.
**Biome**: A fast, modern linter and formatter that combines the functionality of ESLint and Prettier. Includes built-in Next.js and React domain support for optimal performance.
**None**: Skip linter configuration entirely. You can always add a linter later.
> **Note**: `next lint` command will be deprecated in Next.js 16. New projects should use the chosen linter directly (e.g., `biome check` or `eslint`).
Once you've answered the prompts, a new project will be created with your chosen configuration.
### With an official Next.js example
......
......@@ -26,15 +26,14 @@ The following options are available:
The following commands are available:
| Command | Description |
| -------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| [`dev`](#next-dev-options) | Starts Next.js in development mode with Hot Module Reloading, error reporting, and more. |
| [`build`](#next-build-options) | Creates an optimized production build of your application. Displaying information about each route. |
| [`start`](#next-start-options) | Starts Next.js in production mode. The application should be compiled with `next build` first. |
| [`info`](#next-info-options) | Prints relevant details about the current system which can be used to report Next.js bugs. |
| [`lint`](#next-lint-options) | Runs ESLint for all files in the `/src`, `/app`, `/pages`, `/components`, and `/lib` directories. It also provides a guided setup to install any required dependencies if ESLint it is not already configured in your application. |
| [`telemetry`](#next-telemetry-options) | Allows you to enable or disable Next.js' completely anonymous telemetry collection. |
| [`typegen`](#next-typegen-options) | Generates TypeScript definitions for routes, pages, layouts, and route handlers without running a full build. |
| Command | Description |
| -------------------------------------- | ------------------------------------------------------------------------------------------------------------- |
| [`dev`](#next-dev-options) | Starts Next.js in development mode with Hot Module Reloading, error reporting, and more. |
| [`build`](#next-build-options) | Creates an optimized production build of your application. Displaying information about each route. |
| [`start`](#next-start-options) | Starts Next.js in production mode. The application should be compiled with `next build` first. |
| [`info`](#next-info-options) | Prints relevant details about the current system which can be used to report Next.js bugs. |
| [`telemetry`](#next-telemetry-options) | Allows you to enable or disable Next.js' completely anonymous telemetry collection. |
| [`typegen`](#next-typegen-options) | Generates TypeScript definitions for routes, pages, layouts, and route handlers without running a full build. |
> **Good to know**: Running `next` without a command is an alias for `next dev`.
......@@ -135,48 +134,6 @@ The following options are available for the `next info` command:
| `-h` or `--help` | Show all available options |
| `--verbose` | Collects additional information for debugging. |
### `next lint` options
> **Warning**: This command is deprecated and will be removed in Next.js 16.
>
> We recommend migrating to invoking ESLint directly (or using Biome). A [codemod](https://nextjs.org/blog/next-15-5#next-lint-deprecation) is available to migrate scripts to the ESLint CLI.
>
> `next lint` generates a `next-env.d.ts` file, which is often needed during type-check. To ensure `next-env.d.ts` is present run [`next typegen`](#next-typegen-options) before type-checking. `next dev` and `next build` also generate the `next-env.d.ts` file, but it is often undesirable to run these just to type-check.
>
> ```bash filename="Terminal"
> next typegen && tsc --noEmit
> ```
`next lint` runs ESLint for all files in the `pages/`, `app/`, `components/`, `lib/`, and `src/` directories. It also provides a guided setup to install any required dependencies if ESLint is not already configured in your application.
The following options are available for the `next lint` command:
| Option | Description |
| ----------------------------------------------------- | ------------------------------------------------------------------------------------------------------------- |
| `[directory]` | A base directory on which to lint the application. If not provided, the current directory will be used. |
| `-d, --dir, <dirs...>` | Include directory, or directories, to run ESLint. |
| `--file, <files...>` | Include file, or files, to run ESLint. |
| `--ext, [exts...]` | Specify JavaScript file extensions. (default: [".js", ".mjs", ".cjs", ".jsx", ".ts", ".mts", ".cts", ".tsx"]) |
| `-c, --config, <config>` | Uses this configuration file, overriding all other configuration options. |
| `--resolve-plugins-relative-to, <rprt>` | Specify a directory where plugins should be resolved from. |
| `--strict` | Creates a `.eslintrc.json` file using the Next.js strict configuration. |
| `--rulesdir, <rulesdir...>` | Uses additional rules from this directory(s). |
| `--fix` | Automatically fix linting issues. |
| `--fix-type <fixType>` | Specify the types of fixes to apply (e.g., problem, suggestion, layout). |
| `--ignore-path <path>` | Specify a file to ignore. |
| `--no-ignore <path>` | Disables the `--ignore-path` option. |
| `--quiet` | Reports errors only. |
| `--max-warnings [maxWarnings]` | Specify the number of warnings before triggering a non-zero exit code. (default: -1) |
| `-o, --output-file, <outputFile>` | Specify a file to write report to. |
| `-f, --format, <format>` | Uses a specific output format. |
| `--no-inline-config` | Prevents comments from changing config or rules. |
| `--report-unused-disable-directives-severity <level>` | Specify severity level for unused eslint-disable directives. (choices: "error", "off", "warn") |
| `--no-cache` | Disables caching. |
| `--cache-location, <cacheLocation>` | Specify a location for cache. |
| `--cache-strategy, [cacheStrategy]` | Specify a strategy to use for detecting changed files in the cache. (default: "metadata") |
| `--error-on-unmatched-pattern` | Reports errors when any file patterns are unmatched. |
| `-h, --help` | Displays this message. |
### `next telemetry` options
Next.js collects **completely anonymous** telemetry data about general usage. Participation in this anonymous program is optional, and you can opt-out if you prefer not to share information.
......
---
title: eslint
description: Next.js reports ESLint errors and warnings during builds by default. Learn how to opt-out of this behavior here.
source: app/api-reference/config/next-config-js/eslint
---
{/* DO NOT EDIT. The content of this doc is generated from the source above. To edit the content of this page, navigate to the source page in your editor. You can use the `<PagesOnly>Content</PagesOnly>` component to add content that is specific to the Pages Router. Any shared content should not be wrapped in a component. */}
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