Skip to content

Commit

Permalink
feat: optional oxlint plugin. close #13 .
Browse files Browse the repository at this point in the history
  • Loading branch information
lvjiaxuan committed Feb 18, 2024
1 parent 21251a2 commit c886466
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 7 deletions.
10 changes: 9 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,21 @@
"lint": "oxlint . && eslint .",
"prepublishOnly": "pnpm run build"
},
"peerDependencies": {
"@lvjiaxuan/eslint-plugin-oxlint": "workspace:*"
},
"peerDependenciesMeta": {
"@lvjiaxuan/eslint-plugin-oxlint": {
"optional": true
}
},
"dependencies": {
"@antfu/eslint-config": "^2.6.4",
"@lvjiaxuan/eslint-plugin": "workspace:*",
"@lvjiaxuan/eslint-plugin-oxlint": "workspace:*",
"fs-extra": "^11.2.0"
},
"devDependencies": {
"@lvjiaxuan/eslint-plugin-oxlint": "workspace:*",
"@types/eslint": "^8.56.2",
"@types/fs-extra": "^11.0.4",
"@types/node": "^20.11.19",
Expand Down
6 changes: 3 additions & 3 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/index.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { join } from 'node:path'
import process from 'node:process'
import antfu, { typescript } from '@antfu/eslint-config'
import antfu, { ensurePackages, typescript } from '@antfu/eslint-config'
import type { FlatConfigItem, OptionsTypeScriptWithTypes } from '@antfu/eslint-config'
import { lvPlugin } from '@lvjiaxuan/eslint-plugin'
import { pathExists } from 'fs-extra'
import { type OptionsOXLint, oxlint } from '@lvjiaxuan/eslint-plugin-oxlint'
import type { OptionsOXLint } from '@lvjiaxuan/eslint-plugin-oxlint'

async function detectTsconfigPath() {
const defaultFile = 'tsconfig.json' as const
Expand All @@ -20,8 +20,11 @@ const lv: (...args: _Params) => ReturnType<Antfu> = async (...args) => {

const pluginsInstalled = [lvPlugin()]

if (options?.oxlint)
if (options?.oxlint) {
await ensurePackages(['@lvjiaxuan/eslint-plugin-oxlint'])
const { oxlint } = await import('@lvjiaxuan/eslint-plugin-oxlint')
pluginsInstalled.push(...(await oxlint(options.oxlint)))
}

const merged = await antfu(
...args,
Expand Down

0 comments on commit c886466

Please sign in to comment.