Code Monkey home page Code Monkey logo

suppress-biome-errors's Introduction

suppress-biome-errors

npm Test License: MIT

If you have a large number of biome errors, you can use this tool to automatically add biome-ignore comments.

Warning

This tool uses @biomejs/js-api of alpha version.

Acknowledgments

This tool is forked from suppress-eslint-errors by Amanda Mitchell.

How it works

suppress-biome-errors is a codemod for jscodeshift that runs biome against your existing code. For each biome error it finds, it adds a little snippet:

// biome-ignore lint/suspicious/noExplicitAny: TODO: Fix this the next time the file is edited.

This way, you can get the benefits of the rule in new code without having to immediately work through a huge backlog.

Usage

suppress-biome-errors comes with a wrapper script so that you can call it directly without installing anything extra:

npx @ton1517/suppress-biome-errors [jscodeshift options] PATH...

The wrapper will call jscodeshift with the transformer and any other arguments that you pass to it. If it detects a .gitignore in the local directory, it will also specify that as the --ignore-config.

NOTE: jscodeshift has some bugs with respect to how it handles .gitignore files that sometimes causes it to ignore all files. If this tool detects that your .gitignore contains problematic patterns, the --ignore-config option will be skipped.

In some cases, the code produced by this codemod will make some unfortunate indentation decisions. Be sure to re-run any code formatting tools you use before committing!

Options

--message: Sets the comment to add biome-ignore explanation.

--rules: Comma-separated list of biome rule category to disable. When specified, violations of rules not in this set will be left in place.

--config-path The path to a biome configuration file that will be used to determine which rules to disable. If not specified, find biome.json or biome.jsonc automatically.

Examples

Suppress all errors in the index.js file, using a custom comment:

npx @ton1517/suppress-biome-errors ./index.js --message="TODO: Issue #123"

Suppress violations of the lint/suspicious/noExplicitAny and lint/style/noNonNullAssertion rules in .ts and .tsx files in the src directory:

npx @ton1517/suppress-biome-errors ./src --extensions=ts,tsx --parser=tsx --rules='lint/suspicious/noExplicitAny,lint/style/noNonNullAssertion'

suppress-biome-errors's People

Contributors

ton1517 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.