Skip to content

Commit 92deb7d

Browse files
committed
feat(unicorn): add options parameter to unicorn function and extend OptionsUnicorn interface
1 parent bc89fd1 commit 92deb7d

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

src/configs/unicorn.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
import { pluginUnicorn } from '../plugins'
2-
import type { TypedFlatConfigItem } from '../types'
2+
import type { OptionsUnicorn, TypedFlatConfigItem } from '../types'
3+
4+
export function unicorn(options: OptionsUnicorn = {}): TypedFlatConfigItem[] {
5+
const { overrides = {} } = options
36

4-
export function unicorn(): TypedFlatConfigItem[] {
57
return [
68
{
79
name: 'coderwyd/unicorn/rules',
@@ -79,6 +81,8 @@ export function unicorn(): TypedFlatConfigItem[] {
7981
// 'unicorn/prefer-top-level-await': 'error',
8082
'unicorn/prefer-type-error': 'error',
8183
'unicorn/throw-new-error': 'error',
84+
85+
...overrides,
8286
},
8387
},
8488
]

src/types/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ export interface OptionsComponentExts {
2727
componentExts?: string[]
2828
}
2929

30+
export interface OptionsUnicorn extends OptionsOverrides {}
31+
3032
export interface OptionsTypeScriptParserOptions {
3133
/**
3234
* Additional parser options for TypeScript.
@@ -192,8 +194,6 @@ export interface OptionsConfig extends OptionsComponentExts {
192194
*/
193195
unocss?: boolean | OptionsUnoCSS
194196

195-
196-
197197
/**
198198
* Enable regexp rules.
199199
*

0 commit comments

Comments
 (0)