From d3fd40c5f2d99a93706cf5e98f406c1a890f02cf Mon Sep 17 00:00:00 2001 From: Eli <88557639+lishaduck@users.noreply.github.com> Date: Mon, 28 Apr 2025 12:28:46 -0500 Subject: [PATCH 1/7] fix!: dts output --- package.json | 30 +++++++++++++++++++++--------- tsconfig.json | 6 ++++-- tsdown.config.mts | 12 ++++++++++++ tsup.config.ts | 9 --------- 4 files changed, 37 insertions(+), 20 deletions(-) create mode 100644 tsdown.config.mts delete mode 100644 tsup.config.ts diff --git a/package.json b/package.json index a1eef31..ee4c81b 100644 --- a/package.json +++ b/package.json @@ -1,8 +1,12 @@ { "name": "typescript-eslint-parser-for-extra-files", "version": "0.8.0", + "type": "module", "description": "An experimental ESLint custom parser for Vue, Svelte, and Astro for use with TypeScript. It provides type information in combination with each framework's ESLint custom parser.", - "repository": "git+https://github.com/ota-meshi/typescript-eslint-parser-for-extra-files.git", + "repository": { + "type": "git", + "url": "git+https://github.com/ota-meshi/typescript-eslint-parser-for-extra-files.git" + }, "homepage": "https://github.com/ota-meshi/typescript-eslint-parser-for-extra-files#readme", "author": "Yosuke Ota (https://github.com/ota-meshi)", "funding": "https://github.com/sponsors/ota-meshi", @@ -11,17 +15,23 @@ "engines": { "node": ">=16.0.0" }, - "main": "lib/index.js", - "module": "./lib/index.mjs", + "main": "./lib/index.cjs", + "module": "./lib/index.js", + "types": "./lib/index.d.ts", "exports": { ".": { - "import": "./lib/index.mjs", - "require": "./lib/index.js" + "module-sync": { + "types": "./lib/index.d.ts", + "default": "./lib/index.js" + }, + "default": { + "types": "./lib/index.d.cts", + "default": "./lib/index.cjs" + } } }, - "types": "./lib/index.d.ts", "files": [ - "lib" + "lib/" ], "keywords": [ "eslint", @@ -32,7 +42,7 @@ "typescript" ], "scripts": { - "build": "tsup", + "build": "tsdown", "clean": "rimraf .nyc_output lib coverage", "cover": "nyc --reporter=lcov yarn test", "debug": "yarn mocha \"tests/src/**/*.ts\" --reporter dot --timeout 60000", @@ -107,12 +117,14 @@ "prettier-plugin-astro": "^0.14.0", "prettier-plugin-pkg": "^0.19.0", "prettier-plugin-svelte": "^3.0", + "publint": "^0.3.12", "semver": "^7.3.5", "svelte": "^4.0.0", "svelte-eslint-parser": "^1.0.0", "svelte2tsx": "^0.7.0", - "tsup": "^8.0.0", + "tsdown": "https://pkg.pr.new/tsdown@03230c4", "typescript": "~5.8.0", + "unplugin-unused": "^0.4.4", "vue": "^3.2.41", "vue-eslint-parser": "^10.0.0" }, diff --git a/tsconfig.json b/tsconfig.json index 5add73d..8f46683 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -3,9 +3,11 @@ "target": "es2015", "strict": true, "lib": ["es2020", "DOM"], - "module": "Node16", - "moduleResolution": "Node16", + "module": "Preserve", + "moduleResolution": "Bundler", "declaration": true, + "isolatedModules": true, + "isolatedDeclarations": true, "noImplicitAny": true, "noImplicitReturns": true, "noFallthroughCasesInSwitch": true, diff --git a/tsdown.config.mts b/tsdown.config.mts new file mode 100644 index 0000000..271b876 --- /dev/null +++ b/tsdown.config.mts @@ -0,0 +1,12 @@ +import { defineConfig } from "tsdown"; + +export default defineConfig({ + entry: ["src/index.ts"], + format: ["cjs", "esm"], + target: ["node16"], + external: [/package.json/], + outDir: "lib", + skipNodeModulesBundle: true, + publint: { strict: true, pack: "npm" }, + unused: true, +}); diff --git a/tsup.config.ts b/tsup.config.ts deleted file mode 100644 index 0bd8a93..0000000 --- a/tsup.config.ts +++ /dev/null @@ -1,9 +0,0 @@ -import { defineConfig } from "tsup"; - -export default defineConfig({ - clean: true, - dts: true, - entryPoints: ["src/index.ts"], - format: ["cjs", "esm"], - outDir: "lib", -}); From bfe1c4edc70b22b1711f7c95e72565baa675add4 Mon Sep 17 00:00:00 2001 From: Eli <88557639+lishaduck@users.noreply.github.com> Date: Mon, 28 Apr 2025 12:45:56 -0500 Subject: [PATCH 2/7] fix: don't drop node 16 Don't mark `package.json` as external. --- .prettierrc.js | 2 +- src/index.ts | 3 +-- src/meta.ts | 9 ++++++++- tsdown.config.mts | 1 - 4 files changed, 10 insertions(+), 5 deletions(-) diff --git a/.prettierrc.js b/.prettierrc.js index d740f9c..bbc920f 100644 --- a/.prettierrc.js +++ b/.prettierrc.js @@ -1,3 +1,3 @@ -module.exports = { +export default { plugins: ['prettier-plugin-svelte', 'prettier-plugin-astro'] } diff --git a/src/index.ts b/src/index.ts index bdcb6e4..217ff25 100644 --- a/src/index.ts +++ b/src/index.ts @@ -4,8 +4,7 @@ import { TSServiceManager } from "./ts"; import * as tsEslintParser from "@typescript-eslint/parser"; import { getProjectConfigFiles } from "./utils/get-project-config-files"; import { resolveProjectList } from "./utils/resolve-project-list"; -export * as meta from "./meta"; -export { name } from "./meta"; +export { default as meta, name } from "./meta"; const DEFAULT_EXTRA_FILE_EXTENSIONS = [".vue", ".svelte", ".astro"]; const tsServiceManager = new TSServiceManager(); diff --git a/src/meta.ts b/src/meta.ts index 96a0703..7f39fdb 100644 --- a/src/meta.ts +++ b/src/meta.ts @@ -1 +1,8 @@ -export { name, version } from "../package.json"; +import { name as pkgName, version } from "../package.json"; +import { TSESLint } from "@typescript-eslint/utils"; + +const meta: TSESLint.FlatConfig.PluginMeta = { name: pkgName, version }; + +export default meta; + +export const name: string = pkgName; diff --git a/tsdown.config.mts b/tsdown.config.mts index 271b876..c18535d 100644 --- a/tsdown.config.mts +++ b/tsdown.config.mts @@ -4,7 +4,6 @@ export default defineConfig({ entry: ["src/index.ts"], format: ["cjs", "esm"], target: ["node16"], - external: [/package.json/], outDir: "lib", skipNodeModulesBundle: true, publint: { strict: true, pack: "npm" }, From 5379f7e793c41f5d2fb9f3faef9a0c154206f17f Mon Sep 17 00:00:00 2001 From: Eli <88557639+lishaduck@users.noreply.github.com> Date: Mon, 28 Apr 2025 12:47:17 -0500 Subject: [PATCH 3/7] fix: mark @typescript-eslint/utils as direct dependency For us `hoist: false`ers. --- package.json | 1 + 1 file changed, 1 insertion(+) diff --git a/package.json b/package.json index ee4c81b..0bc192f 100644 --- a/package.json +++ b/package.json @@ -79,6 +79,7 @@ } }, "dependencies": { + "@typescript-eslint/utils": "^8.31.1", "tinyglobby": "^0.2.12" }, "devDependencies": { From 1cceb441a60856d3b62190c9c4e8ea0f64eebf5c Mon Sep 17 00:00:00 2001 From: Eli <88557639+lishaduck@users.noreply.github.com> Date: Mon, 28 Apr 2025 20:49:09 -0500 Subject: [PATCH 4/7] fix: stuff --- .eslintrc.js => .eslintrc.cjs | 0 src/meta.ts | 2 +- tsconfig.json | 3 ++- 3 files changed, 3 insertions(+), 2 deletions(-) rename .eslintrc.js => .eslintrc.cjs (100%) diff --git a/.eslintrc.js b/.eslintrc.cjs similarity index 100% rename from .eslintrc.js rename to .eslintrc.cjs diff --git a/src/meta.ts b/src/meta.ts index 7f39fdb..ce21c1f 100644 --- a/src/meta.ts +++ b/src/meta.ts @@ -1,5 +1,5 @@ import { name as pkgName, version } from "../package.json"; -import { TSESLint } from "@typescript-eslint/utils"; +import type { TSESLint } from "@typescript-eslint/utils"; const meta: TSESLint.FlatConfig.PluginMeta = { name: pkgName, version }; diff --git a/tsconfig.json b/tsconfig.json index 8f46683..c60e7b9 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -6,8 +6,9 @@ "module": "Preserve", "moduleResolution": "Bundler", "declaration": true, - "isolatedModules": true, "isolatedDeclarations": true, + "isolatedModules": true, + "verbatimModuleSyntax": true, "noImplicitAny": true, "noImplicitReturns": true, "noFallthroughCasesInSwitch": true, From 0b55a3bbcc11a2d2106ddd7d35c0f850a01586b8 Mon Sep 17 00:00:00 2001 From: Eli <88557639+lishaduck@users.noreply.github.com> Date: Mon, 28 Apr 2025 21:15:29 -0500 Subject: [PATCH 5/7] refactor: drop tseslint/utils dep Co-authored-by: Yosuke Ota --- package.json | 1 - src/meta.ts | 4 +--- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/package.json b/package.json index 0bc192f..ee4c81b 100644 --- a/package.json +++ b/package.json @@ -79,7 +79,6 @@ } }, "dependencies": { - "@typescript-eslint/utils": "^8.31.1", "tinyglobby": "^0.2.12" }, "devDependencies": { diff --git a/src/meta.ts b/src/meta.ts index ce21c1f..5601c32 100644 --- a/src/meta.ts +++ b/src/meta.ts @@ -1,8 +1,6 @@ import { name as pkgName, version } from "../package.json"; -import type { TSESLint } from "@typescript-eslint/utils"; - -const meta: TSESLint.FlatConfig.PluginMeta = { name: pkgName, version }; +const meta: { name: string; version: string } = { name: pkgName, version }; export default meta; export const name: string = pkgName; From 6bb741f49eaf9534dfcfa62f558ed7f1ff6808eb Mon Sep 17 00:00:00 2001 From: Yosuke Ota Date: Tue, 29 Apr 2025 16:52:31 +0900 Subject: [PATCH 6/7] Create eight-suits-provide.md --- .changeset/eight-suits-provide.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/eight-suits-provide.md diff --git a/.changeset/eight-suits-provide.md b/.changeset/eight-suits-provide.md new file mode 100644 index 0000000..6ec465d --- /dev/null +++ b/.changeset/eight-suits-provide.md @@ -0,0 +1,5 @@ +--- +"typescript-eslint-parser-for-extra-files": minor +--- + +Migrate to tsdown to fix dts output From 528908c464d40e007d12d2b916283f6732213d86 Mon Sep 17 00:00:00 2001 From: Eli <88557639+lishaduck@users.noreply.github.com> Date: Tue, 29 Apr 2025 08:41:29 -0500 Subject: [PATCH 7/7] chore: bump tsdown --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index ee4c81b..5910680 100644 --- a/package.json +++ b/package.json @@ -122,7 +122,7 @@ "svelte": "^4.0.0", "svelte-eslint-parser": "^1.0.0", "svelte2tsx": "^0.7.0", - "tsdown": "https://pkg.pr.new/tsdown@03230c4", + "tsdown": "^0.10.1", "typescript": "~5.8.0", "unplugin-unused": "^0.4.4", "vue": "^3.2.41",