Skip to content

Commit c75ebf1

Browse files
committedApr 10, 2024·
feat(eslint-config): support default export and rest arguments for easier usage
1 parent 10d21e9 commit c75ebf1

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed
 

‎packages/eslint-config/src/flat/index.ts

+12-3
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,15 @@ export function defineFlatConfigs(
2626

2727
/**
2828
* Create an array of ESLint flat configs for Nuxt 3, based on the given options.
29+
* Accpets appending user configs as rest arguments from the second argument.
2930
*
30-
* Usually it would be use `@nuxt/eslint` module which will generate the necessary configuration based on your project.
31-
*
31+
* For Nuxt apps, it's recommanded to use `@nuxt/eslint` module instead, which will generate the necessary configuration based on your project.
3232
* @see https://eslint.nuxt.com/packages/module
3333
*/
34-
export function createConfigForNuxt(options: NuxtESLintConfigOptions = {}): FlatConfigComposer<FlatConfigItem> {
34+
export function createConfigForNuxt(
35+
options: NuxtESLintConfigOptions = {},
36+
...userConfigs: ResolvableFlatConfig[]
37+
): FlatConfigComposer<FlatConfigItem> {
3538
const c = composer()
3639

3740
const resolved = resolveOptions(options)
@@ -73,5 +76,11 @@ export function createConfigForNuxt(options: NuxtESLintConfigOptions = {}): Flat
7376
disables(resolved),
7477
)
7578

79+
if (userConfigs.length > 0) {
80+
c.append(...userConfigs)
81+
}
82+
7683
return c
7784
}
85+
86+
export default createConfigForNuxt

0 commit comments

Comments
 (0)
Please sign in to comment.