Skip to content

Commit 142e793

Browse files
ddosakuraantfu
andauthored
fix: custom commands (#28)
Co-authored-by: Anthony Fu <[email protected]>
1 parent 853e996 commit 142e793

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/plugin.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,22 @@
11
import type { ESLint } from 'eslint'
2-
import { version } from '../package.json'
3-
import command from './rule'
42
import type { ESLintPluginCommandOptions } from './types'
3+
import { version } from '../package.json'
4+
import BuiltinRules, { createRuleWithCommands } from './rule'
55

66
export function createPluginWithCommands(options: ESLintPluginCommandOptions = {}) {
77
const {
88
name = 'command',
99
} = options
10+
const plugin = options.commands
11+
? createRuleWithCommands(options.commands)
12+
: BuiltinRules
1013
return {
1114
meta: {
1215
name,
1316
version,
1417
},
1518
rules: {
16-
command,
19+
command: plugin,
1720
},
1821
} satisfies ESLint.Plugin
1922
}

0 commit comments

Comments
 (0)