From 21d32e70b061f05f32f3147a64a4faa3e8a35a6c Mon Sep 17 00:00:00 2001 From: jycouet Date: Tue, 2 Dec 2025 09:23:12 +0100 Subject: [PATCH 1/4] cleanup unused types --- src/context.js | 1 - src/languages/ts/public.d.ts | 2 +- src/languages/tsx/public.d.ts | 2 +- src/languages/types.d.ts | 3 +-- src/public.d.ts | 2 +- src/types.d.ts | 16 +--------------- 6 files changed, 5 insertions(+), 21 deletions(-) diff --git a/src/context.js b/src/context.js index d264282..f0e6b9f 100644 --- a/src/context.js +++ b/src/context.js @@ -1,4 +1,3 @@ -/** @import { TSESTree } from '@typescript-eslint/types' */ /** @import { BaseNode, Command, Visitors } from './types' */ export const margin = 0; diff --git a/src/languages/ts/public.d.ts b/src/languages/ts/public.d.ts index 4009459..b265ace 100644 --- a/src/languages/ts/public.d.ts +++ b/src/languages/ts/public.d.ts @@ -1,2 +1,2 @@ export * from './index'; -export { BaseComment, Comment } from '../types'; +export type { BaseComment, Comment } from '../types'; diff --git a/src/languages/tsx/public.d.ts b/src/languages/tsx/public.d.ts index 4009459..b265ace 100644 --- a/src/languages/tsx/public.d.ts +++ b/src/languages/tsx/public.d.ts @@ -1,2 +1,2 @@ export * from './index'; -export { BaseComment, Comment } from '../types'; +export type { BaseComment, Comment } from '../types'; diff --git a/src/languages/types.d.ts b/src/languages/types.d.ts index 20d2d76..20f06e1 100644 --- a/src/languages/types.d.ts +++ b/src/languages/types.d.ts @@ -1,5 +1,4 @@ -import { TSESTree } from '@typescript-eslint/types'; -import { BaseNode } from '../types'; +import type { BaseNode } from '../types'; export type TSOptions = { quotes?: 'double' | 'single'; diff --git a/src/public.d.ts b/src/public.d.ts index 5fababa..7f36df5 100644 --- a/src/public.d.ts +++ b/src/public.d.ts @@ -1,2 +1,2 @@ -export { PrintOptions, Visitors } from './types'; +export type { PrintOptions, Visitors } from './types'; export * from './index'; diff --git a/src/types.d.ts b/src/types.d.ts index 5763af7..e862803 100644 --- a/src/types.d.ts +++ b/src/types.d.ts @@ -1,5 +1,4 @@ -import { TSESTree } from '@typescript-eslint/types'; -import { Context } from 'esrap'; +import type { Context } from 'esrap'; export type BaseNode = { type: string; @@ -23,19 +22,6 @@ export type Visitors = T['type'] extends '_' export { Context }; -export type TypeAnnotationNodes = - | TSESTree.TypeNode - | TSESTree.TypeElement - | TSESTree.TSTypeAnnotation - | TSESTree.TSPropertySignature - | TSESTree.TSTypeParameter - | TSESTree.TSTypeParameterDeclaration - | TSESTree.TSTypeParameterInstantiation - | TSESTree.TSEnumMember - | TSESTree.TSInterfaceHeritage - | TSESTree.TSClassImplements - | TSExpressionWithTypeArguments; - type TSExpressionWithTypeArguments = { type: 'TSExpressionWithTypeArguments'; expression: any; From 2b5c4304b0cac44ed8ea86bfb4d6e20bd29203a0 Mon Sep 17 00:00:00 2001 From: Simon Hanna Date: Tue, 2 Dec 2025 09:34:28 +0100 Subject: [PATCH 2/4] fix: make @typescript-eslint/types a regular dependency Fixes: #98 --- .changeset/wet-geckos-rush.md | 5 +++++ package.json | 2 +- pnpm-lock.yaml | 6 +++--- 3 files changed, 9 insertions(+), 4 deletions(-) create mode 100644 .changeset/wet-geckos-rush.md diff --git a/.changeset/wet-geckos-rush.md b/.changeset/wet-geckos-rush.md new file mode 100644 index 0000000..3d73322 --- /dev/null +++ b/.changeset/wet-geckos-rush.md @@ -0,0 +1,5 @@ +--- +'esrap': patch +--- + +Fix types for packages that depend on esrap by making @typescript-eslint/types a dependency diff --git a/package.json b/package.json index 77484f0..755f234 100644 --- a/package.json +++ b/package.json @@ -29,7 +29,6 @@ "devDependencies": { "@changesets/cli": "^2.27.11", "@sveltejs/acorn-typescript": "^1.0.5", - "@typescript-eslint/types": "^8.2.0", "@vitest/ui": "^2.1.1", "acorn": "^8.15.0", "dts-buddy": "^0.6.2", @@ -52,6 +51,7 @@ }, "license": "MIT", "dependencies": { + "@typescript-eslint/types": "^8.2.0", "@jridgewell/sourcemap-codec": "^1.4.15" }, "packageManager": "pnpm@9.8.0", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 125db92..2f981c7 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -11,6 +11,9 @@ importers: '@jridgewell/sourcemap-codec': specifier: ^1.4.15 version: 1.5.0 + '@typescript-eslint/types': + specifier: ^8.2.0 + version: 8.46.1 devDependencies: '@changesets/cli': specifier: ^2.27.11 @@ -18,9 +21,6 @@ importers: '@sveltejs/acorn-typescript': specifier: ^1.0.5 version: 1.0.5(acorn@8.15.0) - '@typescript-eslint/types': - specifier: ^8.2.0 - version: 8.46.1 '@vitest/ui': specifier: ^2.1.1 version: 2.1.1(vitest@2.1.1) From c66786e9fccb68e549f7fd735ad39041a159da76 Mon Sep 17 00:00:00 2001 From: jycouet Date: Tue, 2 Dec 2025 10:03:50 +0100 Subject: [PATCH 3/4] @typescript-eslint/types used in src/languages/ts/index.js --- package.json | 4 ++-- pnpm-lock.yaml | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index 77484f0..6776dd1 100644 --- a/package.json +++ b/package.json @@ -29,7 +29,6 @@ "devDependencies": { "@changesets/cli": "^2.27.11", "@sveltejs/acorn-typescript": "^1.0.5", - "@typescript-eslint/types": "^8.2.0", "@vitest/ui": "^2.1.1", "acorn": "^8.15.0", "dts-buddy": "^0.6.2", @@ -52,7 +51,8 @@ }, "license": "MIT", "dependencies": { - "@jridgewell/sourcemap-codec": "^1.4.15" + "@jridgewell/sourcemap-codec": "^1.4.15", + "@typescript-eslint/types": "^8.2.0" }, "packageManager": "pnpm@9.8.0", "publishConfig": { diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 125db92..2f981c7 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -11,6 +11,9 @@ importers: '@jridgewell/sourcemap-codec': specifier: ^1.4.15 version: 1.5.0 + '@typescript-eslint/types': + specifier: ^8.2.0 + version: 8.46.1 devDependencies: '@changesets/cli': specifier: ^2.27.11 @@ -18,9 +21,6 @@ importers: '@sveltejs/acorn-typescript': specifier: ^1.0.5 version: 1.0.5(acorn@8.15.0) - '@typescript-eslint/types': - specifier: ^8.2.0 - version: 8.46.1 '@vitest/ui': specifier: ^2.1.1 version: 2.1.1(vitest@2.1.1) From ccd9c28a86a5c33fba4379e98f6a6e1075fb4d84 Mon Sep 17 00:00:00 2001 From: jycouet Date: Tue, 2 Dec 2025 10:08:23 +0100 Subject: [PATCH 4/4] update changelog --- .changeset/wet-geckos-rush.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.changeset/wet-geckos-rush.md b/.changeset/wet-geckos-rush.md index 3d73322..da923c1 100644 --- a/.changeset/wet-geckos-rush.md +++ b/.changeset/wet-geckos-rush.md @@ -2,4 +2,4 @@ 'esrap': patch --- -Fix types for packages that depend on esrap by making @typescript-eslint/types a dependency +fix: add `@typescript-eslint/types` as a dependency since some types are exported