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 diff --git a/.eslintrc.js b/.eslintrc.cjs similarity index 100% rename from .eslintrc.js rename to .eslintrc.cjs 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/package.json b/package.json index a1eef31..5910680 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": "^0.10.1", "typescript": "~5.8.0", + "unplugin-unused": "^0.4.4", "vue": "^3.2.41", "vue-eslint-parser": "^10.0.0" }, 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..5601c32 100644 --- a/src/meta.ts +++ b/src/meta.ts @@ -1 +1,6 @@ -export { name, version } from "../package.json"; +import { name as pkgName, version } from "../package.json"; + +const meta: { name: string; version: string } = { name: pkgName, version }; +export default meta; + +export const name: string = pkgName; diff --git a/tsconfig.json b/tsconfig.json index 5add73d..c60e7b9 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -3,9 +3,12 @@ "target": "es2015", "strict": true, "lib": ["es2020", "DOM"], - "module": "Node16", - "moduleResolution": "Node16", + "module": "Preserve", + "moduleResolution": "Bundler", "declaration": true, + "isolatedDeclarations": true, + "isolatedModules": true, + "verbatimModuleSyntax": true, "noImplicitAny": true, "noImplicitReturns": true, "noFallthroughCasesInSwitch": true, diff --git a/tsdown.config.mts b/tsdown.config.mts new file mode 100644 index 0000000..c18535d --- /dev/null +++ b/tsdown.config.mts @@ -0,0 +1,11 @@ +import { defineConfig } from "tsdown"; + +export default defineConfig({ + entry: ["src/index.ts"], + format: ["cjs", "esm"], + target: ["node16"], + 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", -});