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

diff-cleaner

v2.0.4

Published

De-noisify git diffs.

Downloads

59

Readme

diff-cleaner

De-noisify git diffs.

npm version

Features

Reading through git diffs should be a straightforward experience. Unfortunately, meaningless differences in trailing whitespace and end-of-file newlines clutters up diffs. diff-cleaner removes this noise.

  • Adds a git pre-commit hook which checks for trailing whitespace and an EOF newline, failing the commit as-necessary with a message to use npm run trim
  • Provides an npm run trim command which fixes the errors found in the pre-commit hook

Usage

Get started

  • npm install --save-dev diff-cleaner
  • npm install --save-dev husky
  • Add the following to your gulpfile.js:
require('diff-cleaner/precommit.js');
require('diff-cleaner/trim.js');
  • Add the following to your package.json scripts:
"precommit": "gulp precommit",
"trim": "gulp trim"

Options

Check out config.js for full options. A selection are shown below.

To change e.g. the included filetypes to just html and css, add the following to your gulpfile.js:

require('diff-cleaner').config.filetypes = '(html|css)';
  • filetypes. The file extensions that will be linted and updated. Must be in the form e.g. '(js|py|txt)'. Defaults to '(ts|js|css|scss|html|json)'.
  • logErrors. When truthy, log the full issue report on precommit linting errors.
  • specificGitignore. Use a .gitignore other than in the root directory.
  • customGlobs. Any custom globs to consider during precommit and trim.

Notes

Overriding pre-commit hook

To override the pre-commit hook, use git commit --no-verify.

Standardizing newlines

See dealing with line endings for how to standardize line endings using a .gitattributes file.

VS Code

Add "files.trimTrailingWhitespace": true to your user settings document to strip trailing whitespace automatically.