Skip to content

Commit

Permalink
chore: update typegen
Browse files Browse the repository at this point in the history
  • Loading branch information
antfu committed Mar 27, 2024
1 parent 31b06e1 commit 95963ac
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 47 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@
"eslint-plugin-react-hooks": "^4.6.0",
"eslint-plugin-react-refresh": "^0.4.6",
"eslint-plugin-svelte": "2.36.0-next.13",
"eslint-typegen": "^0.0.2",
"eslint-typegen": "^0.1.0",
"esno": "^4.7.0",
"execa": "^8.0.1",
"fast-glob": "^3.3.2",
Expand Down
14 changes: 5 additions & 9 deletions pnpm-lock.yaml

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

39 changes: 5 additions & 34 deletions scripts/typegen.ts
Original file line number Diff line number Diff line change
@@ -1,32 +1,6 @@
import fs from 'node:fs/promises'
import { pluginsToRulesOptions } from 'eslint-typegen'
import type { ESLint } from 'eslint'
import {
astro,
combine,
comments,
formatters,
imports,
javascript,
jsdoc,
jsonc,
markdown,
node,
perfectionist,
react,
sortPackageJson,
stylistic,
svelte,
test,
toml,
typescript,
unicorn,
unocss,
vue,
yaml,
} from '../src'

const plugins: Record<string, ESLint.Plugin> = {}
import { flatConfigsToRulesDTS } from 'eslint-typegen/core'
import { astro, combine, comments, formatters, imports, javascript, jsdoc, jsonc, markdown, node, perfectionist, react, sortPackageJson, stylistic, svelte, test, toml, typescript, unicorn, unocss, vue, yaml } from '../src'

const configs = await combine(
astro(),
Expand All @@ -52,11 +26,8 @@ const configs = await combine(
yaml(),
)

for (const config of configs)
Object.assign(plugins, config.plugins)

console.log(Object.keys(plugins))

const dts = await pluginsToRulesOptions(plugins)
const dts = await flatConfigsToRulesDTS(configs, {
includeAugmentation: false,
})

await fs.writeFile('src/typegen.d.ts', dts)
6 changes: 3 additions & 3 deletions src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ import type { Options as VueBlocksOptions } from 'eslint-processor-vue-blocks'
import type { Linter } from 'eslint'
import type { StylisticCustomizeOptions } from '@stylistic/eslint-plugin'
import type { VendoredPrettierOptions } from './vender/prettier-types'
import type { RulesOptions } from './typegen'
import type { RuleOptions } from './typegen'

export type Awaitable<T> = T | Promise<T>

export type Rules = RulesOptions
export type Rules = RuleOptions

export type FlatConfigItem = Omit<Linter.FlatConfig, 'plugins' | 'rules'> & {
/**
Expand All @@ -29,7 +29,7 @@ export type FlatConfigItem = Omit<Linter.FlatConfig, 'plugins' | 'rules'> & {
*/
rules?: {
[key: string]: Linter.RuleEntry
} & RulesOptions
} & Rules
}

export interface OptionsFiles {
Expand Down

0 comments on commit 95963ac

Please sign in to comment.