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 🙏

© 2025 – Pkg Stats / Ryan Hefner

@blaahaj/lint-git-tree

v1.1.1

Published

Check a git tree for case clashes and invalid / non-normal UTF-8 encoding

Readme

@blaahaj/lint-git-tree

Check that the file / directory names in a Git repository:

  • are valid, normalised UTF-8;
  • are case-insensitively unique within each directory.

How to run it

lint-git-tree can be run via GitHub Actions, or via npx.

As a GitHub action

The key is to have a step which includes:

uses: blaahaj/[email protected]

For example, you could have a .github/workflows/lint-git-tree.yml file with the following:

---
name: lint-git-tree

on:
  push:
    branches:
      - main
  pull_request:
    types:
      - opened
      - synchronize
      - reopened

jobs:
  build:
    name: lint-git-tree
    runs-on: ubuntu-latest

    steps:
      - name: lint-git-tree
        uses: blaahaj/[email protected]

Via npx

Simply invoke using npx from the root of your git working tree:

npx @blaahaj/[email protected]

What is checked

lint-git-tree only checks the file and directory names in a Git repository. It does not look inside the files at all. In other words, it's essentially checking the output of git ls-tree -r --name-only HEAD.

Names must be valid UTF-8

Each file / directory name must be valid UTF-8. Any name that fails this check will be reported like this:

ERROR: invalid utf-8 in 'n�r' <Buffer 6e c3 72> (full path: 'a/n�r')

In this example, inside the directory a, there is a file or directory whose name consists of the three bytes 6e c3 72. This is not valid UTF-8.

Solution: rename the item to have a valid UTF-8 name.

Names must be normalized UTF-8

Each file / directory name must be normalized UTF-8. Any name that fails this check will be reported like this:

ERROR: non-normalised utf-8 encoding når' <Buffer 6e 61 cc 8a 72> (full path: 'a/når')

In this example, inside the directory a, there is a file or directory whose name is "når", encoded as the five bytes 6e 61 cc 8a 72. While this is valid UTF-8, it is not normalized UTF-8.

Solution: rename the item to use normalized encoding.

Note: when trying to fix this error, some tools might not recognised that anything has actually changed, and therefore they might not let you commit. If this happens, you might find it helpful to solve this by renaming twice: rename to some temporary name, then commit; then rename to the correct name, and commit again.

Names must be case-insensitively unique within each directory

Within each directory, each file or directory must have a unique name, ignoring case.

For example, it is not permitted to have both a "foo" and a "Foo" in the same directory.

Any combination of names that fails this check will be reported like this:

ERROR: case clash between 'FOO' and 'foo' under directory 'x'

Solution: Ensure there are no case clashes.

Note: if lint-git-tree is reporting this error, but when looking at your files and directories, you can't see the problem, try looking using git ls-tree HEAD.

For example, if git ls-tree shows:

100644 blob 98797936214eb95b087a9b842bc9c30b1f29a018  A-FILE
100644 blob 18aa34a98515b843471406d4677c2b02fc5f482a  a-file

Once you can see the problem, you should be able to rectify it by manipulating the git index directly: git rm --cached thing-to-remove, then commit.