Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support ESLint Flat Config #124

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ Specify the files and/or directories to exclude.
- Type: `String`
- Default: `eslint`

Path to `eslint` instance that will be used for linting.
Path to `eslint` instance that will be used for linting. Set `'eslint/use-at-your-own-risk'` if you want to use the flat config system in ESLint v8. Place an `eslint.config.js` file in the root of your project or set the `ESLINT_USE_FLAT_CONFIG` environment variable to true and pass the option `overrideConfigFile` to the plugin if you are using other config files. You can learn more from [Flat config rollout plans](https://eslint.org/blog/2023/10/flat-config-rollout-plans/) and [Configuration Files (New)](https://eslint.org/docs/latest/use/configure/configuration-files-new).

### `formatter`

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
"chokidar": "^3.5.3",
"eslint-webpack-plugin": "^4.0.1",
"pathe": "^1.1.1",
"vite-plugin-eslint": "^1.8.1"
"vite-plugin-eslint2": "^4.4.0"
},
"devDependencies": {
"@nuxt/module-builder": "latest",
Expand Down
104 changes: 69 additions & 35 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 6 additions & 3 deletions src/module.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { defineNuxtModule, addVitePlugin, addWebpackPlugin, useLogger } from '@nuxt/kit'
import type { Options as VitePlugin } from 'vite-plugin-eslint'
import type { ESLintPluginUserOptions as VitePlugin } from 'vite-plugin-eslint2'
import type { Options as WebpackPlugin } from 'eslint-webpack-plugin'
import vitePluginEslint from 'vite-plugin-eslint'
import vitePluginEslint from 'vite-plugin-eslint2'
import EslintWebpackPlugin from 'eslint-webpack-plugin'
import { relative } from 'pathe'
import { watch } from 'chokidar'
Expand Down Expand Up @@ -43,7 +43,10 @@ export default defineNuxtModule<ModuleOptions>({
'.eslintrc.js',
'.eslintrc.yaml',
'.eslintrc.yml',
'.eslintrc.json'
'.eslintrc.json',
'eslint.config.js',
'eslint.config.mjs',
'eslint.config.cjs'
].map(path => relative(nuxt.options.rootDir, path))

if (nuxt.options.watch) {
Expand Down