Skip to content

Commit

Permalink
docs: add explanatio about skip option
Browse files Browse the repository at this point in the history
  • Loading branch information
kazushisan committed Sep 16, 2024
1 parent 916be61 commit 22efd5b
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -100,15 +100,15 @@ The CLI will respect the `tsconfig.json` for loading source files.

Here's an example of using the cli. Make sure to skip your entrypoint file.

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

### Check

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 ts-remove-unused --check
```

Expand All @@ -122,20 +122,26 @@ import { remove } from '@line/ts-remove-unused';
remove({
configPath: '/path/to/project/tsconfig.json',
projectRoot: '/path/to/project',
skip: [/main.ts/],
skip: [/main\.ts/],
mode: 'write',
});
```

### Skip removing unused exports
### Skip

When you add a comment `// ts-remove-unused-skip` to your export declaration, the CLI will skip it from being removed
When you add a comment `// ts-remove-unused-skip` to your export declaration, the it will be skipped from being removed

```ts
// ts-remove-unused-skip
export const hello = 'world';
```

The `--skip` option is also available to skip files that match a given regex pattern. Note that you can pass multiple patterns.

```bash
npx ts-remove-unused --skip 'src/main\.ts' --skip '/pages/'
```

By default, `.d.ts` files are skipped. If you want to include `.d.ts` files, use the `--include-d-ts` option.

## Author
Expand Down

0 comments on commit 22efd5b

Please sign in to comment.