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

@nossbigg/eslint-workflows

v0.0.0-rc4

Published

**Surgically mute ESLint errors at scale 🤫⚡️**

Downloads

1

Readme

@nossbigg/eslint-workflows

Surgically mute ESLint errors at scale 🤫⚡️

🔪 Silence lint errors selectively at per-file + per-rule basis

💪 Great for monorepos / large teams / noisy rules

Problem / Solution

Problem

  1. Introducing a new ESLint rule usually adds a lot of errors/warnings.
  2. It's hard to address all these errors in one go.
  3. At the same time, you want to apply this new rule to all new code.

In a large monorepo with many developers adding new code all the time, you're essentially fighting a losing battle trying to fix lint errors faster than they come...

If only there was a better way... 🤔

Solution

eslint-workflows allows you to incrementally apply lint rules to your codebase, via the following features:

  1. Helps you mute lint errors at per-file + per-rule basis.

  2. Tracks all mutes via a human-readable .yml file.

  3. Autogenerates .yml changes from eslint output when you need to add new entries.

  4. Contains an intuitive CLI interface to let you to safely modify the .yml file.

Basic Usage Guide

1. Adding an entry to yml file

Scenario: You have just added a new eslint rule, but you want to incrementally make changes to adhere to the rule whilst preserving a clean eslint output.

  1. Run yarn lint:json to generate a fresh copy of your eslint results
  2. Run eslint-workflows entry add to add a new entry to the yml file
  3. Select the rule you wish to add
  4. Confirm that eslint-workflows had made changes to your yml file
  5. Confirm that lint errors related to the rule are no longer emitted by eslint

2. Removing an entry from yml file

Scenario: You have applied changes to adhere to rule, and want eslint to enforce the rule onto a given file.

  1. Run eslint-workflows entry remove to remove an entry from yml file
  2. Select the granularity (eg. Entry > Team > File)
  3. Follow requisite instructions as per selected granlarity
  4. Confirm that eslint-workflows had made changes to your yml file
  5. Confirm that lint errors related to the rule are now emitted by eslint

3. Viewing yml file contents

Scenario: You want to view the yml file contents in a pretty-printed format.

  1. Run eslint-workflows view to view the contents of the yml file in a pretty-printed format.

Setup

Initial setup

  1. Install eslint-workflows: yarn add -D @nossbigg/eslint-workflows

  2. In project root, run eslint-workflows init

    This step creates the following files:

    • .eslint-workflowsrc.js (config for eslint-workflows)
    • eslint-workflows-entries.yml (tracks mutes)
  3. Follow instructions to apply manual changes to your repo

  • package.json (Add lint:json task to package.json)
  • .gitignore (Add eslint output file to .gitignore)
  • .eslintrc.js (Add getWorfklowOverrides() to .eslintrc.js)

Recommended setup

For an ideal developer experience, it is recommended that your ESLint output is empty (ie. 0 errors, 0 warnings), so that developers know whether their changes has introduced any lint errors

You can do this with ESLint by using --max-warnings=0 argument, eg:

eslint --max-warnings=0 .

API: CLI

Top-level Commands

| Command | Detail | | ------- | ------------------------------------------- | | view | Print yml file contents | | entry | Interact with entries.yml file | | init | Set up eslint-workflows for current project |

Commands

  1. eslint-workflows view

    Print yml file contents, useful for quickly viewing yml file contents.

  2. eslint-workflows entry

    Interact with entries.yml file.

    Subcommands:

    • entry add: Add an entry
    • entry remove: Remove an entry or part of an entry
    • entry fmt: Apply formatter to yml file
  3. eslint-workflows init

    Set up baseline config for eslint-workflows usage in the current project

API: Node.js

  1. getWorkflowOverrides()

    Computes overrides from yml file to be applied to ESLint config.

Configuration

.eslint-workflowsrc.js

Config for eslint-workflows.

Schema:

module.exports = {
  eslintOutputPath: "eslint-workflows/eslint-output.json",
  codeownersPath: ".github/CODEOWNERS",
  workflowsEntriesPath: "eslint-workflows/eslint-workflows-entries.yml",
};

Properties:

  • eslintOutputPath (required): Path to eslint output json
  • codeownersPath (optional): Path to CODEOWNERS
  • workflowsEntriesPath (required): Path to yml file

Note:

  • For all path-related properties, you may use absolute paths or relative paths (will be resolved against process.cwd())

eslint-workflows-entries.yml

Tracks mutes at the file-level + rule-level.

Example:

entries:
  - ruleId: no-unused-vars
    teams:
      "@team-a":
        files:
          - src/team-a/file-a.js
      "@team-b":
        files:
          - src/team-b/file-b.js
      _NO_OWNER_:
        files:
          - src/no-owner/no-owner.js

Properties:

  • entries: Represents an entry in the yml file
  • entry: Represents a combination of a rule + teams
  • teams: Represents individual team with related files for muting

Developing

Please refer to this README.