Skip to content

Commit cbcd674

Browse files
authored
feat!: drop legacy configs, requires ESLint v9 and ESM (#534)
1 parent ac4afef commit cbcd674

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+64
-3737
lines changed

docs/content/1.packages/0.module.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ All-in-one ESLint integration for Nuxt. It generates a project-aware [ESLint fla
77
:::callout{icon="i-ph-lightbulb-duotone"}
88
This module is designed for the [new ESLint flat config format](https://eslint.org/docs/latest/use/configure/configuration-files-new) which is the [default format since ESLint v9](https://eslint.org/blog/2024/04/eslint-v9.0.0-released/). Flat config is supported since ESLint v8.45.0 so you can use any version of ESLint later than that. We recommend you to use the latest version of ESLint to get the best experience.
99
<br><br>
10-
The legacy `.eslintrc` config is **not supported** by this module. We highly recommend you to migrate over the flat config to be future-proof. If you still want to use the legacy format, you might need to manually config with [`@nuxt/eslint-config`](/packages/config), which will missing some features like project-aware settings tho.
10+
The legacy `.eslintrc` config is **not supported** by this module. We highly recommend you to migrate over the flat config to be future-proof.
1111
:::
1212

1313
::read-more

docs/content/1.packages/1.config.md

+8-55
Original file line numberDiff line numberDiff line change
@@ -18,16 +18,9 @@ Source code on GitHub
1818
::
1919

2020

21-
## Config Formats
21+
## Configurations
2222

23-
This package provides two different ESLint configs:
24-
25-
- [Flat Config](#flat-config-format) - Customizable future-proof config for the [new flat config format](https://eslint.org/docs/latest/use/configure/configuration-files-new).
26-
- [Legacy Config](#legacy-config-format) - Unopinionated static config for the legacy `.eslintrc` format.
27-
28-
## Flat Config Format
29-
30-
The flat config format is the future of ESLint and is designed to be more flexible and project-aware. The entry `@nuxt/eslint-config/flat` provides a factory function to create a project-aware ESLint config for Nuxt 3 projects. It is unopinionated by default but customizable by passing options to the factory function. Used by [`@nuxt/eslint`](/packages/module) module to generate project-aware ESLint config.
23+
Since version v1.0, we provide in the flat config format. The entry `@nuxt/eslint-config` provides a factory function to create a project-aware ESLint config for Nuxt 3 projects. It is unopinionated by default but customizable by passing options to the factory function. Used by [`@nuxt/eslint`](/packages/module) module to generate project-aware ESLint config.
3124

3225
1. Install this package and `eslint` in your `devDependencies`.
3326

@@ -46,10 +39,10 @@ bun add -D @nuxt/eslint-config eslint
4639
```
4740
::
4841

49-
2. Import the config factory function from `@nuxt/eslint-config/flat` entry in your `eslint.config.mjs`:
42+
2. Import the config factory function from `@nuxt/eslint-config` entry in your `eslint.config.mjs`:
5043

5144
```js [eslint.config.mjs]
52-
import { createConfigForNuxt } from '@nuxt/eslint-config/flat'
45+
import { createConfigForNuxt } from '@nuxt/eslint-config'
5346

5447
export default createConfigForNuxt({
5548
// options here
@@ -71,7 +64,7 @@ You might also want to add a script entry to your `package.json`:
7164
Note that `createConfigForNuxt()` returns a chainable [`FlatConfigComposer` instance](https://github.com/antfu/eslint-flat-config-utils#composer) from [`eslint-flat-config-utils`](https://github.com/antfu/eslint-flat-config-utils) which allows you to manipulate the ESLint flat config with ease. If you want to combine with other configs, you can use the `.append()` method:
7265

7366
```js [eslint.config.mjs]
74-
import { createConfigForNuxt } from '@nuxt/eslint-config/flat'
67+
import { createConfigForNuxt } from '@nuxt/eslint-config'
7568

7669
export default createConfigForNuxt({
7770
// options here
@@ -100,7 +93,7 @@ This feature is experimental and may change in the future.
10093
:::
10194

10295
```js [eslint.config.mjs]
103-
import { createConfigForNuxt } from '@nuxt/eslint-config/flat'
96+
import { createConfigForNuxt } from '@nuxt/eslint-config'
10497

10598
export default createConfigForNuxt({
10699
features: {
@@ -114,7 +107,7 @@ This will enable rules with `unicorn`, `regexp` and `jsdoc` plugins, to ensure y
114107
You can also turn them off individually by providing an object with the rule names set to `false`:
115108

116109
```js [eslint.config.mjs]
117-
import { createConfigForNuxt } from '@nuxt/eslint-config/flat'
110+
import { createConfigForNuxt } from '@nuxt/eslint-config'
118111

119112
export default createConfigForNuxt({
120113
features: {
@@ -125,52 +118,12 @@ export default createConfigForNuxt({
125118
})
126119
```
127120

128-
## Legacy Config Format
129-
130-
The legacy config configures TypeScript and Vue integration for ESLint. It is unopinionated and static, and does not contains stylistic rules or project-aware settings.
131-
132-
1. Install this package and `eslint` in your `devDependencies`.
133-
134-
::code-group
135-
```bash [yarn]
136-
yarn add --dev @nuxt/eslint-config eslint
137-
```
138-
```bash [npm]
139-
npm install --save-dev @nuxt/eslint-config eslint
140-
```
141-
```bash [pnpm]
142-
pnpm add -D @nuxt/eslint-config eslint
143-
```
144-
```bash [bun]
145-
bun add -D @nuxt/eslint-config eslint
146-
```
147-
::
148-
149-
2. Extend the default Nuxt config by creating an `.eslintrc.cjs`:
150-
151-
```js [.eslintrc.cjs]
152-
module.exports = {
153-
root: true,
154-
extends: ["@nuxt/eslint-config"],
155-
};
156-
```
157-
158-
You might also want to add a script entry to your `package.json`:
159-
160-
```json [package.json]
161-
{
162-
"scripts": {
163-
"lint": "eslint ."
164-
}
165-
}
166-
```
167-
168121
## ESLint Stylistic
169122

170123
Similar to the [ESLint Module](https://eslint.nuxt.com/packages/module#eslint-stylistic), you can opt-in by setting `stylistic` to `true` in the `features` module options.
171124

172125
```js [eslint.config.mjs]
173-
import { createConfigForNuxt } from '@nuxt/eslint-config/flat'
126+
import { createConfigForNuxt } from '@nuxt/eslint-config'
174127

175128
export default createConfigForNuxt({
176129
features: {

eslint.config.js

-5
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,6 @@ export default createConfigForNuxt({
1818
},
1919
})
2020
.append(
21-
{
22-
ignores: [
23-
'packages-legacy/**',
24-
],
25-
},
2621
{
2722
files: ['docs/**/*.vue'],
2823
rules: {

package.json

-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
"build": "pnpm run -r build",
88
"stub": "pnpm run -r stub",
99
"release": "bumpp \"package.json\" \"packages/**/package.json\" && pnpm publish -r",
10-
"release:legacy": "bumpp \"packages-legacy/**/package.json\" --commit \"chore: release @nuxtjs/eslint-config@%s\" --no-tag && pnpm publish -r",
1110
"test": "vitest run",
1211
"play": "pnpm -C playground run play:dev",
1312
"lint": "eslint .",

packages-legacy/nuxt2-eslint-config-typescript/CHANGELOG.md

-196
This file was deleted.

packages-legacy/nuxt2-eslint-config-typescript/README.md

-9
This file was deleted.

packages-legacy/nuxt2-eslint-config-typescript/index.js

-47
This file was deleted.

0 commit comments

Comments
 (0)