Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

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: 2 months ago
JSON representation

CLI tool to add @ts-expect-errors to typescript type errors

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)
Downloads
Version
License
GitHub stars

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.