UNPKG

@binkylabs/muzzle

Version:

A muzzle for your TypeSpec linting rules. It's experimental, slightly unethical, and definitely effective.

76 lines (51 loc) 1.63 kB
# TypeSpec Muzzle Welcome to the TypeSpec Muzzle project. This project aims to provide tooling to suppress TypeSpec linting issues from the CLI. This is useful if you want to establish a baseline suppression in your TypeSpec definition without having to disable the rules entirely. For example when starting a new project from an OpenAPI import, or trying to enable new rules with existing infringements on an existing projects. ## Usage ### CLI 1. Install the CLI with ```shell npm i -g @binkylabs/muzzle ``` 1. Ensure the ruleset you want to suppress is also installed ```shell # example you use the @typespec/http/recommended ruleset npm i @typespec/http ``` 1. Suppress all warnings generated by the ruleset ```shell muzzle main.tsp --rule-set "@typespec/http/recommended" -m "auto-suppression" ``` ### API 1. Install the package with ```shell npm i -S @binkylabs/muzzle ``` 1. Ensure the ruleset you want to suppress is also installed ```shell # example you use the @typespec/http/recommended ruleset npm i -S @typespec/http ``` 1. Use the suppression method ```TypeScript import { parseTypeSpecAndSuppressEverything } from "@binkylabs/muzzle"; await parseTypeSpecAndSuppressEverything( { entryPoint: "path/to/main.tsp", ruleSets: ["@typespec/http/recommended"], message: "auto-suppression" } ); ``` ## Debugging 1. Install dependencies with ```shell npm i ``` 1. Build the library with ```shell npm run build ``` 1. Run unit tests with ```shell npm run test ```