Skip to content

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

License

Notifications You must be signed in to change notification settings

BinkyLabs/TypeSpec-Muzzle

Repository files navigation

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

    npm i -g @binkylabs/muzzle
  2. Ensure the ruleset you want to suppress is also installed

    # example you use the @typespec/http/recommended ruleset
    npm i @typespec/http
  3. Suppress all warnings generated by the ruleset

    muzzle main.tsp --rule-set "@typespec/http/recommended" -m "auto-suppression"

API

  1. Install the package with

    npm i -S @binkylabs/muzzle
  2. Ensure the ruleset you want to suppress is also installed

    # example you use the @typespec/http/recommended ruleset
    npm i -S @typespec/http
  3. Use the suppression method

    import { parseTypeSpecAndSuppressEverything } from "@binkylabs/muzzle";
    
    await parseTypeSpecAndSuppressEverything(
       {
          entryPoint: "path/to/main.tsp", 
          ruleSets: ["@typespec/http/recommended"],
          message: "auto-suppression"
       }
    );

Debugging

  1. Install dependencies with

    npm i
  2. Build the library with

    npm run build
  3. Run unit tests with

    npm run test

About

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

Topics

Resources

License

Stars

Watchers

Forks

Contributors 4

  •  
  •  
  •  
  •