Skip to content

Commit

Permalink
docs: update explanation
Browse files Browse the repository at this point in the history
  • Loading branch information
kazushisan committed Sep 23, 2024
1 parent ffae1fc commit d4a6920
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,9 @@ However when this declaration is exported and is not referenced by any file in t
export const a = 'a';
```

This is when ts-remove-unused comes in handy. ts-remove-unused is a CLI tool made on top of TypeScript that reports/fixes unused exports. Here are some examples of how ts-remove-unused auto-fixes unused code.
This is when ts-remove-unused comes in handy. ts-remove-unused is a CLI tool built on top of TypeScript that finds unused exports and auto-fixes unused code.

Here are some examples of how ts-remove-unused auto-fixes unused code.

<!-- prettier-ignore-start -->

Expand Down Expand Up @@ -127,7 +129,7 @@ Options:
-v, --version Display version number
```

ts-remove-unused's behavior heavily depends on your `tsconfig.json`. TypeScript's compiler internally holds the list of project files by parsing relevant rules such as `include` and `exclude`. ts-remove-unused scans through this list and searches for references to determine if an export/file is "unused". You may need to maintain/update your `tsconfig` (or you can create another one for `--project`) so that the set of covered files are right.
ts-remove-unused's behavior heavily depends on your `tsconfig.json`. TypeScript's compiler internally holds the list of project files by parsing relevant rules such as `include` and `exclude`. ts-remove-unused scans through this list and searches for references to determine if an export/file is "unused". You may need to maintain/update your `tsconfig` (or you can create another file for `--project`) so that the set of covered files are right.

Here's an example of using the CLI. Your entry point file must be skipped or else every file will be removed.

Expand All @@ -143,7 +145,7 @@ npx @line/ts-remove-unused --skip 'src/main\.ts'
Use `--check` to check for unused files and exports without making changes to project files. The command will exit with exit code 1 if there are any unused files or exports discovered.

```bash
npx @line/ts-remove-unused --check
npx @line/ts-remove-unused --skip 'src/main\.ts' --check
```

### Use the JavaScript API
Expand Down

0 comments on commit d4a6920

Please sign in to comment.