Nuxt/docs/2.guide/1.concepts/9.code-style.md

25 lines
1.1 KiB
Markdown
Raw Normal View History

2024-01-16 12:13:18 +00:00
---
title: 'Code Style'
description: "Nuxt supports ESLint out of the box"
---
## ESLint
The recommended approach for Nuxt is to enable ESLint support using the [`@nuxt/eslint`](https://eslint.nuxt.com/packages/module) module, that will setup project-aware ESLint configuration for you.
2024-01-16 12:13:18 +00:00
:::callout{icon="i-ph-lightbulb-duotone"}
The module is designed for the [new ESLint flat config format](https://eslint.org/docs/latest/use/configure/configuration-files-new) with is the [default format since ESLint v9](https://eslint.org/blog/2024/04/eslint-v9.0.0-released/).
2024-01-16 12:13:18 +00:00
If you are using the legacy `.eslintrc` config, you will need to [configure manually with `@nuxt/eslint-config`](https://eslint.nuxt.com/packages/config#legacy-config-format). We highly recommand you to migrate over the flat config to be future-proof.
:::
2024-01-16 12:13:18 +00:00
## Quick Setup
2024-01-16 12:13:18 +00:00
```bash
npx nuxi module add eslint
2024-01-16 12:13:18 +00:00
```
Start your Nuxt app, a `eslint.config.mjs` file will be generated under your project root. You can customize it as needed.
2024-01-16 12:13:18 +00:00
You can learn more about the module and customizations in [Nuxt ESLint's documentation](https://eslint.nuxt.com/packages/module).