8000 feat: migrate to `json-schema-to-typescript-lite` · antfu/eslint-typegen@d8bf325 · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Commit d8bf325

Browse files
committed
feat: migrate to json-schema-to-typescript-lite
1 parent 20d4004 commit d8bf325

File tree

5 files changed

+1004
-1130
lines changed

5 files changed

+1004
-1130
lines changed

package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,9 +58,8 @@
5858
"prepare": "simple-git-hooks"
5959
},
6060
"dependencies": {
61-
"@bcherny/json-schema-ref-parser": "10.0.5-fork",
6261
"@types/eslint": "^8.56.6",
63-
"js-yaml": "^4.1.0",
62+
"json-schema-to-typescript-lite": "^14.0.0",
6463
"ohash": "^1.1.3"
6564
},
6665
"devDependencies": {

pnpm-lock.yaml

Lines changed: 22 additions & 9 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/core.ts

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import type { ESLint, Linter, Rule } from 'eslint'
22
import type { JSONSchema4 } from 'json-schema'
3-
import { compile as compileSchema } from 'json-schema-to-typescript'
3+
import type { Options as CompileOptions } from 'json-schema-to-typescript-lite'
4+
import { compile as compileSchema } from 'json-schema-to-typescript-lite'
45

56
export interface RulesTypeGenOptions {
67
/**
@@ -34,7 +35,7 @@ export interface RulesTypeGenOptions {
3435
/**
3536
* Options for json-schema-to-typescript
3637
*/
37-
compileOptions?: any // Partial<CompileOptions>
38+
compileOptions?: Partial<CompileOptions>
3839
}
3940

4041
export interface FlatConfigsToPluginsOptions {
@@ -152,7 +153,7 @@ export async function pluginsToRulesDTS(
152153
export async function compileRule(
153154
name: string,
154155
rule: Rule.RuleModule,
155-
compileOptions: Partial<any> = {},
156+
compileOptions: Partial<CompileOptions> = {},
156157
) {
157158
const meta = rule.meta ?? {}
158159
let schemas = meta.schema as JSONSchema4[] ?? []
@@ -181,8 +182,6 @@ export async function compileRule(
181182
async function compile(schema: JSONSchema4, name: string, ruleName: string) {
182183
try {
183184
const compiled = await compileSchema(schema, name, {
184-
bannerComment: '',
185-
format: 'style' in compileOptions,
186185
unreachableDefinitions: false,
187186
strictIndexSignatures: true,
188187
customName(schema, keyName) {

0 commit comments

Comments
 (0)
0