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

alliser

v0.6.7

Published

Detect & list not allowed file extensions in a project.

Downloads

4

Readme

Alliser

Detect & list not allowed file extensions in a project. Scans project & compares findings against list of allowed filetypes.

Also available for your CI as batteries included Github Action.

Install

yarn add alliser

Motivation

In some project setups, one can use incorrect file extension without actually breaking the project. An example of this would be a TypeScript project, where one accidentally writes Jest test-files in .js instead of .ts. Jest allows that, and project gets randomly littered with .js files that do work. Or maybe you just want to let team members know, that a particular filetype or programming language is discouraged.

Alliser goes through files, and lets you know if you have non-allowed file types within the project.

Wait, can't I do this with gitignore?

Depending on your use case, you might! There are differences though.

Gitignore is commonly used for completely blocking something from your repo. Things in there are artifacts you dont want in repo, maybe dist, builds or external deps. Things that Alliser checks are things you do want in your repo, like source code / tests you've written, but they may be of incorrect or discouraged format.

Usage

There are two main ways to use Alliser: run it yourself in JS/TS code, or run it via command line.

Command line usage

Command line version exits with status 0 if no conflicting files are found. If files are found, exit status is 1 and files are listed to console.

Run in one folder (src), looking for files that dont match one type (.ts)

alliser .ts src

Or in multiple folders & multiple extensions

alliser .ts,.tsx src,tests,bin

Possible output for incorrect files:

Alliser found errors: following files are not allowed formats (.ts)
tests/fixtures/index.cs
tests/fixtures/index.js
tests/fixtures/index.py
tests/fixtures/index.rs
tests/fixtures/subfolder1/submodule2.js
tests/fixtures/subfolder2/submodule.js
Programmatic use

You can also use Alliser to just fetch list of problematic files, and do your own thing with them.

import alliser from 'alliser';

// Accepts an array of extensions, and an array of folders.
const incorrectFiles = alliser.check(['.ts', '.tsx'], ['src', 'tests'])

console.log(incorrectFiles);
// [
//   tests/fixtures/index.cs
//   tests/fixtures/index.js
//   tests/fixtures/index.py
//   tests/fixtures/index.rs
//   tests/fixtures/subfolder1/submodule2.js
//   tests/fixtures/subfolder2/submodule.js
// ]

Default ignores

Alliser is smart enough not to list files from folders like node_modules or .git. If you feel like some common ignore is missing from defaults, PRs & issues are welcome.

What's in the name?

"Alliser" is picked from GRR Martins "A Song Of Ice And Fire". Alliser Thorne is a character who would definitely tell you if you're of "the wrong type".