# ts-no-unused

> Automatically remove unused locals and parameters detected by TypeScript.

Latest version **0.0.12** (published 2026-06-19) · MIT license · 0 weekly downloads

## Install

```sh
npm install ts-no-unused
pnpm add ts-no-unused
yarn add ts-no-unused
bun add ts-no-unused
```

Provides the command `ts-no-unused`.

## Health

**Score 55/100 (C)** — status: active.

Positive: esm support; no vulnerabilities; has provenance.

Warnings: low downloads; no types; pre 1.0.

## Facts

| | |
|---|---|
| Version | 0.0.12 |
| Published | 2026-06-19 |
| First published | 2021-07-28 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | ESM |
| Node | >=24.16.0 |
| Dependencies | 3 |
| Unpacked size | 16 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Provenance | attested (GitHub Actions) |
| Author | mkusaka |
| Maintainers | mkusaka |

## Links

- npm: https://www.npmjs.com/package/ts-no-unused
- Repository: https://github.com/mkusaka/ts-no-unused
- Homepage: https://github.com/mkusaka/ts-no-unused#readme
- Issues: https://github.com/mkusaka/ts-no-unused/issues
- npm.io page: https://npm.io/package/ts-no-unused

## Dependencies (3)

- [meow](https://npm.io/package/meow.md) ^14.1.0
- [ts-morph](https://npm.io/package/ts-morph.md) ^28.0.0
- [fast-glob](https://npm.io/package/fast-glob.md) ^3.3.3

## Recent versions

- 0.0.12 (latest) — 2026-06-19
- 0.0.11 — 2022-07-31
- 0.0.10 — 2021-10-02
- 0.0.9 — 2021-09-13
- 0.0.8 — 2021-08-01
- 0.0.7 — 2021-07-31
- 0.0.6 — 2021-07-28
- 0.0.5 — 2021-07-28
- 0.0.4 — 2021-07-28
- 0.0.3 — 2021-07-28
- 0.0.2 — 2021-07-28
- 0.0.1 — 2021-07-28

## README

# ts-no-unused

Automatically remove unused locals and parameters detected by TypeScript.

# motivation

If you use TypeScript with the `noUnusedLocals` or `noUnusedParameters`
option, the compiler raises an error when it detects an unused local or
parameter.

This CLI provides a way to remove unused locals and parameters automatically.

# install

```bash
npm install -g ts-no-unused
```

# usage

With no option, the CLI detects and fixes files in the current project.
`tsconfig.json` must exist in the current directory.

```bash
ts-no-unused
```

You can specify a `tsconfig.json` file with `--tsconfig-path`.

```bash
ts-no-unused --tsconfig-path ./relativeProject/tsconfig.json
```

The documented `--configPath` alias is also supported for compatibility.

You can filter target files with a glob pattern.

```bash
ts-no-unused --target './src/nest/*.ts'
```

# release

Release tags are staged on npm through GitHub Actions trusted publishing.

1. Bump `package.json` without creating a tag automatically.

```bash
npm version patch --no-git-tag-version
```

2. Run local checks, commit the version bump, then create and push the release
   tag.

```bash
pnpm run check
pnpm run publish:dry
git tag v0.0.12
git push origin HEAD
git push origin v0.0.12
```

The `Release` workflow runs `npm stage publish`, then creates a GitHub Release.
Approve the staged package on npmjs.com with 2FA to make it public.

Configure npm Trusted Publisher for this package with:

- Publisher: GitHub Actions
- Organization or user: `mkusaka`
- Repository: `ts-no-unused`
- Workflow filename: `release.yml`
- Allowed action: `npm stage publish`

---
_Source: https://npm.io/package/ts-no-unused · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
