diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 60d19bad3..c0cd9bdf0 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -27,6 +27,9 @@ jobs: - name: Lint Files run: npm run lint + - name: Lint Files, Dependencies, & Exports + run: npm run lint:unused + - name: Check Formatting run: npm run fmt:check diff --git a/.github/workflows/manual-publish.yml b/.github/workflows/manual-publish.yml index d20b470cd..0a14bbad3 100644 --- a/.github/workflows/manual-publish.yml +++ b/.github/workflows/manual-publish.yml @@ -72,7 +72,7 @@ jobs: - name: Publish to JSR run: | if [ -f "jsr.json" ]; then - npx jsr publish + npx -y jsr publish else echo "No jsr.json file found, skipping JSR publish." fi diff --git a/knip.json b/knip.json new file mode 100644 index 000000000..cad406275 --- /dev/null +++ b/knip.json @@ -0,0 +1,37 @@ +{ + "$schema": "https://unpkg.com/knip@5/schema.json", + "ignore": ["templates/**/*"], + "workspaces": { + ".": { "entry": ["scripts/*.js", "tools/*.js", ".github/workflows/*.yml"] }, + "packages/compat": { + "ignoreDependencies": ["eslint"], + "entry": ["tests/**/*.{cts,js,ts}"], + "project": ["src/**/*.{cts,js,ts}", "tests/*.{cts,js,ts}"] + }, + "packages/config-array": { + "entry": ["tests/**/*.{cts,js,ts}", "rollup.std__path-config.js"], + "project": ["src/**/*.{cts,js,ts}", "tests/**/*.{cts,js,ts}"] + }, + "packages/config-helpers": { + "entry": ["tests/**/*.{cts,js,ts}"], + "project": ["src/**/*.{cts,js,ts}", "tests/**/*.{cts,js,ts}"] + }, + "packages/core": { "project": ["src/**/*.{cts,js,ts}"] }, + "packages/mcp": { + "entry": ["tests/**/*.{cts,js,ts}"], + "project": ["src/**/*.{cts,js,ts}", "tests/**/*.{cts,js,ts}"] + }, + "packages/migrate-config": { + "entry": ["src/migrate-config.js", "tests/**/*.{cts,js,ts}"], + "project": ["src/**/*.{cts,js,ts}", "tests/*.{cts,js,ts}"] + }, + "packages/object-schema": { + "entry": ["tests/**/*.{cts,js,ts}", "src/types.ts"], + "project": ["src/**/*.{cts,js,ts}", "tests/**/*.{cts,js,ts}"] + }, + "packages/plugin-kit": { + "entry": ["tests/**/*.{cts,js,ts}"], + "project": ["src/**/*.{cts,js,ts}", "tests/**/*.{cts,js,ts}"] + } + } +} diff --git a/package.json b/package.json index 3f3922244..a70ab5fd3 100644 --- a/package.json +++ b/package.json @@ -10,6 +10,7 @@ "prepare": "npm run build", "lint": "eslint", "lint:fix": "eslint --fix", + "lint:unused": "knip", "fmt": "prettier --write .", "fmt:check": "prettier --check .", "test:jsr": "npm run test:jsr --workspaces --if-present", @@ -34,9 +35,11 @@ "devDependencies": { "@eslint/config-helpers": "file:packages/config-helpers", "@types/mocha": "^10.0.7", + "@types/node": "^24.9.1", "c8": "^10.1.3", "eslint": "^9.35.0", "eslint-config-eslint": "^13.0.0", + "knip": "^5.62.0", "lint-staged": "^15.2.0", "mocha": "^11.5.0", "prettier": "^3.4.1", diff --git a/packages/compat/package.json b/packages/compat/package.json index ba9cb283d..a79fc31c8 100644 --- a/packages/compat/package.json +++ b/packages/compat/package.json @@ -27,7 +27,7 @@ "scripts": { "build:cts": "node ../../tools/build-cts.js dist/esm/index.d.ts dist/cjs/index.d.cts", "build": "rollup -c && tsc -p tsconfig.esm.json && npm run build:cts", - "test:jsr": "npx jsr@latest publish --dry-run", + "test:jsr": "npx -y jsr@latest publish --dry-run", "test": "mocha \"tests/**/*.test.js\"", "test:coverage": "c8 npm test" }, diff --git a/packages/compat/tsconfig.json b/packages/compat/tsconfig.json index 5d8149a44..4ba326f86 100644 --- a/packages/compat/tsconfig.json +++ b/packages/compat/tsconfig.json @@ -2,6 +2,7 @@ "extends": "../../tsconfig.base.json", "files": ["src/index.js"], "compilerOptions": { - "outDir": "dist/esm" + "outDir": "dist/esm", + "types": ["mocha", "node"] } } diff --git a/packages/config-array/package.json b/packages/config-array/package.json index af492d890..e07118ada 100644 --- a/packages/config-array/package.json +++ b/packages/config-array/package.json @@ -39,7 +39,7 @@ "pretest": "npm run build", "test": "mocha \"tests/**/*.test.js\"", "test:coverage": "c8 npm test", - "test:jsr": "npx jsr@latest publish --dry-run", + "test:jsr": "npx -y jsr@latest publish --dry-run", "test:types": "tsc -p tests/types/tsconfig.json" }, "keywords": [ diff --git a/packages/config-array/tsconfig.json b/packages/config-array/tsconfig.json index 5d8149a44..ba0bc9bf6 100644 --- a/packages/config-array/tsconfig.json +++ b/packages/config-array/tsconfig.json @@ -2,6 +2,7 @@ "extends": "../../tsconfig.base.json", "files": ["src/index.js"], "compilerOptions": { - "outDir": "dist/esm" + "outDir": "dist/esm", + "types": ["mocha"] } } diff --git a/packages/config-helpers/package.json b/packages/config-helpers/package.json index ece520cd8..5ea0f37ab 100644 --- a/packages/config-helpers/package.json +++ b/packages/config-helpers/package.json @@ -30,7 +30,7 @@ "build": "rollup -c && npm run build:dedupe-types && tsc -p tsconfig.esm.json && npm run build:cts", "test": "mocha \"tests/**/*.test.js\"", "test:coverage": "c8 npm test", - "test:jsr": "npx jsr@latest publish --dry-run", + "test:jsr": "npx -y jsr@latest publish --dry-run", "test:pnpm": "cd tests/pnpm && pnpm install && pnpm exec tsc", "test:types": "tsc -p tests/types/tsconfig.json" }, @@ -51,7 +51,6 @@ "@eslint/core": "^0.16.0" }, "devDependencies": { - "eslint": "^9.27.0", "rollup-plugin-copy": "^3.5.0" }, "engines": { diff --git a/packages/core/package.json b/packages/core/package.json index 999513124..693296cd8 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -19,7 +19,7 @@ "scripts": { "build:cts": "node -e \"fs.cpSync('dist/esm/types.d.ts', 'dist/cjs/types.d.cts')\"", "build": "tsc && npm run build:cts", - "test:jsr": "npx jsr@latest publish --dry-run", + "test:jsr": "npx -y jsr@latest publish --dry-run", "test:types": "tsc -p tests/types/tsconfig.json" }, "repository": { diff --git a/packages/migrate-config/tsconfig.json b/packages/migrate-config/tsconfig.json index 4e6f7b34c..379a70edb 100644 --- a/packages/migrate-config/tsconfig.json +++ b/packages/migrate-config/tsconfig.json @@ -2,6 +2,7 @@ "extends": "../../tsconfig.base.json", "files": ["src/migrate-config-cli.js"], "compilerOptions": { - "outDir": "dist/esm" + "outDir": "dist/esm", + "types": ["mocha"] } } diff --git a/packages/object-schema/package.json b/packages/object-schema/package.json index f5981d2f0..a44ede3f0 100644 --- a/packages/object-schema/package.json +++ b/packages/object-schema/package.json @@ -30,7 +30,7 @@ "build": "rollup -c && npm run build:dedupe-types && tsc -p tsconfig.esm.json && npm run build:cts", "test": "mocha \"tests/**/*.test.js\"", "test:coverage": "c8 npm test", - "test:jsr": "npx jsr@latest publish --dry-run", + "test:jsr": "npx -y jsr@latest publish --dry-run", "test:types": "tsc -p tests/types/tsconfig.json" }, "repository": { diff --git a/packages/object-schema/tsconfig.json b/packages/object-schema/tsconfig.json index 5d8149a44..ba0bc9bf6 100644 --- a/packages/object-schema/tsconfig.json +++ b/packages/object-schema/tsconfig.json @@ -2,6 +2,7 @@ "extends": "../../tsconfig.base.json", "files": ["src/index.js"], "compilerOptions": { - "outDir": "dist/esm" + "outDir": "dist/esm", + "types": ["mocha"] } } diff --git a/packages/plugin-kit/package.json b/packages/plugin-kit/package.json index 03dc6f23c..84e81570f 100644 --- a/packages/plugin-kit/package.json +++ b/packages/plugin-kit/package.json @@ -38,7 +38,7 @@ "pretest": "npm run build", "test": "mocha \"tests/**/*.test.js\"", "test:coverage": "c8 npm test", - "test:jsr": "npx jsr@latest publish --dry-run", + "test:jsr": "npx -y jsr@latest publish --dry-run", "test:types": "tsc -p tests/types/tsconfig.json" }, "keywords": [ diff --git a/packages/plugin-kit/tsconfig.json b/packages/plugin-kit/tsconfig.json index 779639cfe..50bbb3cf2 100644 --- a/packages/plugin-kit/tsconfig.json +++ b/packages/plugin-kit/tsconfig.json @@ -3,6 +3,7 @@ "files": ["src/index.js"], "compilerOptions": { "outDir": "dist/esm", - "strict": true + "strict": true, + "types": ["mocha"] } } diff --git a/scripts/publish.js b/scripts/publish.js index 8c2991d36..e4e6f3416 100644 --- a/scripts/publish.js +++ b/scripts/publish.js @@ -159,7 +159,7 @@ function publishPackagesToJsr(packageDirs) { console.log(`Publishing ${packageDir}...`); try { - exec(`npx jsr publish`, { + exec(`npx -y jsr publish`, { stdio: "inherit", env: process.env, cwd: packageDir, diff --git a/templates/package/package.json b/templates/package/package.json index 4bee178ec..6cfa73dcf 100644 --- a/templates/package/package.json +++ b/templates/package/package.json @@ -30,7 +30,7 @@ "build": "rollup -c && npm run build:dedupe-types && tsc -p tsconfig.esm.json && npm run build:cts", "test": "mocha \"tests/**/*.test.js\"", "test:coverage": "c8 npm test", - "test:jsr": "npx jsr@latest publish --dry-run", + "test:jsr": "npx -y jsr@latest publish --dry-run", "test:types": "tsc -p tests/types/tsconfig.json" }, "repository": {