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

lint-filter

v1.7.3

Published

Lint touched code stricter

Downloads

761

Readme

lint-filter

Only show style errors of things that have changed since master. This support tools that support exporting output in checkstyle format. This can be useful if you want to convert a project gradually towards a new config, (e.g. adding a new rule from the latest release of your linter). Another case were this is beneficial is were you do not want to break a build when updating the linter.

Build status Build status Join the conversation at gitter

Installation

npm install --save-dev lint-filter

Setup

The automated generation of a base lint configuration supports eslint. The setup command will create an extra lint configuration for you that you can use for a baseline without lint-filter. Since not all rules violation will happen at the same place as the changed code it is a good idea to have a baseline. Instead of keeping track of all the rules that might have violations on other lines than the those we change we will keep all rules without errors enabled for all files. This will result in two lint commands or a npm script combining two lint commands

To setup lint-filter make your linter config what you want it to be and then run

lint-filter generate-config > .base.eslintrc

Then you can add the following to your script section of your package.json.

"lint": "eslint -c .base.eslintrc .",
"lint:strict": "eslint . -f checkstyle | lint-filter",

A nice thing you might have realized is that the generate-config command can be run regurarly to update the baseline or when upgrading your favorite eslint configuration. This will make it a breeze to update linter configuration that adds new rules.

Usage

You can use this in two different ways, either by reading files or reading from stdin.

Reading from files

lint-filter checkstyle-report.xml

Reading from stdin

cat checkstyle-report.xml | lint-filter

# example usage with eslint
eslint . -f checkstyle | lint-filter

Options

$ lint-filter -h
  Usage: lint-filter [options] <subcommand|file ...>

  Options:

  -h, --help             Output usage information
  -V, --version          Output the version number
  -f, --format [format]  The output format. If prefixed with 'require:' the formatter will be loaded from an external package
  -b, --branch [branch]  The branch to diff against.
  -l, --linter [linter]  The linter that is used in the project.
  -w, --warning          Make all errors that make it through the filter a warning

Sub commands

The first argument can either be a file or a sub command. The available sub commands are listed below.

  • list-files - list the files in the current diff that lint-filter will use. Nice for faster linting.

External formatters

An external formatter should export a function takes two arguments (input and stats) and returns a string with the formatted output. Below are examples of the structure that the two arguments will be on. Input is a list of files with lint messages and stats is an object with severity as key and an object with the counts as value.

const input = [
  {
    filename: '~/dev/lint-filter/src/index.js',
    messages: [
      {
        line: '7',
        column: '23',
        severity: 'error',
        message: 'Extra semicolon. (semi)',
        source: 'eslint.rules.semi',
      },
    ],
  },
]

const stats = {
  errors: { in: 1, out: 9, total: 10 },
  warnings: { in: 3, out: 9, total: 11 },
}

Contributing

Firstly, all contributions is super appreciated :sparkles:

If you have questions, bug report or feature requests you are encouraged to drop by our gitter channel and say hi. If you are comfortable with it bug reports in form of a pull-request with a broken test would be awesome. Unsure about where the test belong? Then create a new file in the test folder with your test. Unsure about how to do create a pr? You can check out How to create a Pull Request on GitHub, a video tutorial by @kentcdodds or drop by the gitter channel and ask for help.