npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

suppress-eslint-errors

v3.0.2

Published

A codemod that suppresses existing violations of eslint rules.

Downloads

14,029

Readme

suppress-eslint-errors

Release

Have you ever tried to turn on a new eslint rule only to be discouraged by hundreds or thousands of errors in an existing codebase? So have we.

Sometimes, there isn't a great business case for updating all of the existing (working!) code, especially in a larger, legacy codebase. For those times, suppress-eslint-errors has you covered.

How it works

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

// TODO: Fix this the next time the file is edited.
// eslint-disable-next-line cool-new-rule

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

Usage

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

npx suppress-eslint-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.

suppress-eslint-errors must be used with a locally installed copy of eslint. If it can't find one, it will bail out early.

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 above eslint-disable-next-line comments.

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

Examples

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

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

Suppress violations of the eqeqeq and @typescript-eslint/no-explicit-any rules in .ts and .tsx files in the src directory:

npx suppress-eslint-errors ./src --extensions=ts,tsx --parser=tsx --rules=eqeqeq,@typescript-eslint/no-explicit-any

Nuances

Like the name of the tool says, this only suppresses eslint errors. If you have warnings that you'd like to suppress, change your eslint config to turn them into errors before running the tool or specify the rules using the --rules flag.

Is it perfect?

Definitely not. PRs are welcome for any edge cases that you encounter.