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: about 16 hours 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 (over 2 years ago)
- Default Branch: main
- Last Pushed: 2024-10-29T21:21:26.000Z (19 days ago)
- Last Synced: 2024-10-29T22:40:10.909Z (19 days 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
[![CI](https://github.com/kawamataryo/suppress-ts-errors/actions/workflows/ci.yml/badge.svg)](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`.![Kapture 2022-05-01 at 15 35 50](https://user-images.githubusercontent.com/11070996/166135217-82e23b1e-7c9f-40c3-88ad-985b021b842a.gif)
## 🚀 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. |## ✨ 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.