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

fastlint

v1.1.0

Published

Lint faster by only running linters and other tools on files that have recently changed or files that are different from `master` in git.

Downloads

15,345

Readme

fastlint

Lint faster by only running linters and other tools on files that have recently changed or files that are different from master in git.

Installation

npm install -g fastlint

Changelog

  • v1.1.0: added --staged filter, added support for cwd-relative globs.

Usage examples

fastlint --status

Runs fastlint and shows the current set of filters (in stderr).

fastlint --status --print0 | xargs -0 eslint

Run eslint on all modified files in the working copy.

fastlint --status --print0 --working-copy HEAD~5 HEAD | xargs -0 eslint

Run eslint on all files changed in the working copy and in the last five commits in this branch.

fastlint origin/master HEAD | xargs -0 eslint

Run eslint on all files changed compared to the origin/master branch.

fastlint --status --print0 --glob '{src,tests}/**/*.{js,jsx}' origin/master HEAD | xargs -0 eslint

Run eslint on all .js and .jsx files in src/ or tests/ changed compared to the origin/master branch.

Integrating with package.json

Here is an example of a full integration inside package.json, runnable via npm run-script fastlint:

  "scripts": {
    "fastlint": "fastlint --status --print0 --glob '{src,tests}/**/*.{js,jsx}' --glob './webpack*.js' --working-copy --diff-filter=buxq origin/master HEAD | xargs -0 eslint --cache --fix --ext js,jsx || exit 0"
  },

CLI options

Filtering

--glob [glob]. Use a glob to filter the results. Can be specified multiple times. The matching is processed using multimatch, see their docs for details. You can use ./{glob} to specify that the glob should match local files (since v.1.1.0)

--working-copy. fastlint can also include files in the working copy, e.g. files that have been added/modified but not necessarily staged. For UX reasons this gets set if you don't pass anything in (because otherwise there would be nothing to show if you don't pass two branches to compare).

To only include untracked files, use --diff-filter=Q. To only include tracked files, use --diff-filter=q.

--diff-filter [(A|C|D|M|R|T|U|X|B|Q)]. Only select files that are Added (A), Copied (C), Deleted (D), Modified (M), Renamed (R), have their type (i.e. regular file, symlink, submodule, …​) changed (T), are Untracked (Q), Unmerged (U), are Unknown (X), or have had their pairing Broken (B). Any combination of the filter characters (including none) can be used.

Also, these upper-case letters can be downcased to exclude. E.g. --diff-filter=ad excludes added and deleted paths.

Note that "Deleted" does not necessarily mean the file was deleted - it may refer to the file being only modified by deleting lines.

--staged. Filter files by their staging status. Defaults to not applying any filtering. To select unstaged files, use --no-staged. This only applies to files in the working copy, since any committed files are considered staged.

Imagine you run git status. Here's how the output maps to the two filters:

| | diff-filter | staged | |---------------------------------|------------------------|-----------| | "Changes to be committed" | q (any, not untracked) | staged | | "Changes not staged for commit" | q (any, not untracked) | no-staged | | "Untracked files" | Q (untracked) | no-staged |

Human friendly status

--status logs out the list of selected files to stderr.

Result formatting

  • --delimiter [character]. Join the filenames using this delimiter. \n, \t, \r and \0 are converted to the appropriate character. Default: .
  • --print0. Same as --delimiter '\0'.
  • --paths cwd. Output paths relative to CWD. Default.
  • --paths full. Output full paths.
  • --paths gitroot. Output paths relative to the location of the closest .git folder, searching up from the current working directory.