Skip to content

Commit

Permalink
feat: add eslint-plugin-command
Browse files Browse the repository at this point in the history
  • Loading branch information
sxzz committed May 3, 2024
1 parent 451f28c commit 43efef0
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 0 deletions.
1 change: 1 addition & 0 deletions package.json
Expand Up @@ -39,6 +39,7 @@
"eslint-config-prettier": "^9.1.0",
"eslint-define-config": "^1.24.1",
"eslint-plugin-antfu": "^2.1.2",
"eslint-plugin-command": "^0.1.5",
"eslint-plugin-eslint-comments": "^3.2.0",
"eslint-plugin-import-x": "^0.5.0",
"eslint-plugin-jsonc": "^2.15.1",
Expand Down
12 changes: 12 additions & 0 deletions pnpm-lock.yaml

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

4 changes: 4 additions & 0 deletions src/configs/command.ts
@@ -0,0 +1,4 @@
import { configCommand } from '../plugins'
import type { FlatESLintConfigItem } from 'eslint-define-config'

export const command: FlatESLintConfigItem[] = [configCommand()]
1 change: 1 addition & 0 deletions src/configs/index.ts
@@ -1,3 +1,4 @@
export * from './command'
export * from './comments'
export * from './ignores'
export * from './imports'
Expand Down
2 changes: 2 additions & 0 deletions src/plugins.ts
Expand Up @@ -52,3 +52,5 @@ export * as pluginYml from 'eslint-plugin-yml'
export * as parserVue from 'vue-eslint-parser'
export * as parserYml from 'yaml-eslint-parser'
export * as parserJsonc from 'jsonc-eslint-parser'

export { default as configCommand } from 'eslint-plugin-command/config'
6 changes: 6 additions & 0 deletions src/presets.ts
@@ -1,5 +1,6 @@
import { hasUnocss, hasVue } from './env'
import {
command,
comments,
ignores,
imports,
Expand Down Expand Up @@ -60,6 +61,7 @@ export { presetBasic as basic, presetAll as all }
export function sxzz(
config: FlatESLintConfigItem | FlatESLintConfigItem[] = [],
{
command: enableCommand = true,
markdown: enableMarkdown = true,
prettier: enablePrettier = true,
unocss: enableUnocss = hasUnocss,
Expand All @@ -74,6 +76,7 @@ export function sxzz(
/** UnoCSS support. Auto-enable. */
unocss: boolean
sortKeys: boolean
command: boolean
}> = {},
): FlatESLintConfigItem[] {
const configs = [...presetBasic, ...yml, ...presetJsonc]
Expand All @@ -89,6 +92,9 @@ export function sxzz(
if (enablePrettier) {
configs.push(...prettier)
}
if (enableCommand) {
configs.push(...command)
}
if (Object.keys(config).length > 0) {
configs.push(...(Array.isArray(config) ? config : [config]))
}
Expand Down

0 comments on commit 43efef0

Please sign in to comment.