Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/kawamataryo/suppress-ts-errors
CLI tool to add @ts-expect-errors to typescript type errors
https://github.com/kawamataryo/suppress-ts-errors
cli nodejs typescript
Last synced: 5 days ago
JSON representation
CLI tool to add @ts-expect-errors to typescript type errors
- Host: GitHub
- URL: https://github.com/kawamataryo/suppress-ts-errors
- Owner: kawamataryo
- License: mit
- Created: 2022-04-30T07:56:39.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2024-10-29T21:21:26.000Z (4 months ago)
- Last Synced: 2024-10-29T22:40:10.909Z (4 months ago)
- Topics: cli, nodejs, typescript
- Language: TypeScript
- Homepage: https://www.npmjs.com/package/suppress-ts-errors
- Size: 1.29 MB
- Stars: 116
- Watchers: 3
- Forks: 9
- Open Issues: 9
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
Awesome Lists containing this project
README
# suppress-ts-errors
[](https://github.com/kawamataryo/suppress-ts-errors/actions/workflows/ci.yml)
![]()
![]()
![]()
Cli tool to add comments to suppress typescript type errors.
Add [@ts-expect-error](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-9.html#-ts-expect-error-comments) or [@ts-ignore](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-2-6.html#suppress-errors-in-ts-files-using--ts-ignore-comments) comments to all locations where errors are occurring.
Support for `.ts`, `.tsx`, `.vue`.
## 🚀 Usage
### Running scripts to `.ts` and `.tsx`
Run the script in the directory where `tsconfig.json` is located.
```bash
$ npx suppress-ts-errors
```### Running scripts to `.vue`
When targeting vue sfc, the path of the vue component must be specified with the glob pattern.
**Notice:** It does not support commenting out type errors in the `` section of vue, only the `` section.```bash
$ npx suppress-ts-errors vue src/**/*.vue
```### options
| option | default | description |
| ------------------- | ----------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| -t, --tsconfig-path | `./tsconfig.json` | Path to tsconfig.json. |
| -c, --comment-type | `1` | Choice of inserted comment type. <br> `1` is [@ts-expect-error](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-9.html#-ts-expect-error-comments), `2` is [@ts-ignore](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-2-6.html#suppress-errors-in-ts-files-using--ts-ignore-comments). |
| -e, --error-code | `true` | Add error code to comment. e.g. TS2345. |
| -g, --glob | `undefined` | Add a specific glob for error suppression (prevents script from processing all files and their dependencies) |
| -m, --message | `undefined` | Add a custom message to the comment. |## ✨ Contributing
Contributions are welcome 🎉
We accept contributions via Pull Requests. See [this guide](https://github.com/kawamataryo/suppress-ts-errors/blob/main/CONTRIBUTING.md) on how to make a contribution.## 📄 License
suppress-ts-errors is available under the MIT License.