Ecosyste.ms: Awesome

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

Awesome Lists | Featured Topics | Projects

https://github.com/pixelmatters/ts-check-filter

Filter TS type-check errors based on rules.
https://github.com/pixelmatters/ts-check-filter

Last synced: about 1 month ago
JSON representation

Filter TS type-check errors based on rules.

Awesome Lists containing this project

README

        






TS Check Filter


A filter for TypeScript errors.


This is useful when using code-generation tools or while migrating to a strict tsconfig.json, allowing a smother and incremental transition.



ts-check-filter license.


Current npm package version.


PRs welcome!


Follow @pixelmatters_

## Features

* Ignore files based on relative path or regular expression
* Ignore specific TS errors

## Why can not be excluded on TypeScript?

The `exclude` option in `tsconfig.json` makes tsc not directly check the file. Unfortunately, if the file is used from another checked file, it will report an error. This way, it will not solve some use cases.

## Usage

To install:

```bash
npm i @pixelmatters/ts-check-filter
```

To use the filter pipe the results into `ts-check-filter`:

```bash
tsc --noEmit | npx ts-check-filter
```

To define the paths to be ignored create a new `ts-check-filter.js` file on the project root:

```js
module.exports = {
pathFilterRules: [/src\/__generated__\/.*/],
}
```

The `pathFilterRules` is an array of `string`s or `RegExp`. In the example above, we use a regular expression to ignore all the files under the `__generated__` directory.

> **Note:** If you don't pep anything into the filter it will be waiting for ever for an input.

### Options

Display the list of options by executing:

```
npx ts-check-filter --help
```

## Development

For the development is recommended to use [PNPM](https://pnpm.io/), since is the tool that is being used to manage dependencies. So to install just run:

```bash
pnpm install
```

To test implementation and check if the code follows the right guidelines, please run:

```bash
pnpm test
```

## ๐Ÿค How to Contribute

Whether you're helping us fix bugs, improve the docs, or spread the word, thank you! ๐Ÿ’ช ๐Ÿงก

Check out our [**Contributing Guide**](https://github.com/Pixelmatters/tes-check-filter/blob/main/CONTRIBUTING.md) for ideas on contributing and setup steps.

## ๐Ÿ“ License

Licensed under the [BSD-2 License](./LICENSE).