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

eslint-plugin-fix-later

v2.1.0

Published

ESLint plugin to suppresses ESLint errors as warnings for future resolution

Downloads

38

Readme

📌 eslint-plugin-fix-later

This plugin automatically suppresses ESLint errors with "fix later" comments, turning them into warnings for future resolution.

console.log(data)

Error no-console Unexpected console statement

// eslint-disable-next-line no-console -- Fix later
console.log(data)

⚠️ Warning [REMINDER] Fix later

[!TIP] Use the git blame feature documented below to tag the author in the "fix later" comment.

Why?

In large projects with many developers, ESLint helps keep code consistent and high-quality. But, updating the ESLint config with new rules can be challenging when it surfaces many new errors. This would be too much for one dev to fix, and potentially risky if it's outside of their familiarity.

This plugin solves this by temporarily suppressing these errors into "fix later" warnings, allowing the right dev to address them when ready. This keeps the project moving forward without sacrificing code quality.

Install

pnpm i -D eslint-plugin-fix-later

Setup

In your ESLint config:

{
    plugins: [
        // ...
        'fix-later',
    ],
    rules: {
        // ...
        'fix-later/fix-later': ['warn', {
            // Options...
        }]
    }
}

Recommended workflow

  1. Activate this plugin

    Set up the fix-later rule to emit a warning (as opposed to errors).

  2. Automate linting on commit

    Use simple-git-hooks & lint-staged to auto-lint changed files when committing

  3. Disallow linting warnings on commit

    Configure your commit hook to reject warnings: eslint --max-warnings=0

    This encourages devs working in the file to address outstanding warnings if they can. If not, they can commit with --no-verify.

  4. Disallow linting errors on CI

    On CI, run ESLint with warnings allowed: eslint .

    This approach prevents errors from slipping through while accommodating "fix later" notes.

Suppressing auto-fixable errors (ESLint v8+)

Pass in the --fix-type=directive flag to ESLint to only apply the fix-later auto-fix.

Options

includeWarnings

Type: boolean

Default: false

Whether to suppress warnings in addition to errors.

insertDisableComment

Type: 'above-line' | 'end-of-line'

Default: 'end-of-line'

Whether to put the eslint-disable comment on the same line or on the line above.

commentTemplate

Type: string

Default: 'Fix later'

The template for the eslint-disable comment. The {{ eslint-disable }} handlebar is required to interpolate the eslint-disable type into.

Git blame

You can get the git blame author of the errorneous code:

Please fix: {{ blame.author }} <{{ blame.author-mail }}>

Which will create the following comment:

// eslint-disable-line -- Please fix: John Doe <[email protected]>

All properties from git blame are available:

{
    "author": "John Doe",
    "author-mail": "[email protected]",
    "author-time": "1708498454",
    "author-tz": "+0100",
    "committer": "John Doe",
    "committer-mail": "<[email protected]>",
    "committer-time": "1708498454",
    "committer-tz": "+0100"
}

CODEOWNER

You can get the CODEOWNER of the file:

Please fix: {{ codeowner }}