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 🙏

© 2026 – Pkg Stats / Ryan Hefner

eslint-rule-dev-toolkit

v1.0.1

Published

A toolkit of awesome helpers for developing advanced ESLint rules with ease!

Readme

ESLint Rule Development Toolkit

A library of awesome helpers for developing advanced ESLint rules with ease! Currently, only includes one central piece of functionality; tracing values mid-analysis.

The aim so to provide a more complete and sound analysis whenever identifiers are considered in ESLint rules.

Getting started

Below is a description of the details to consider when using the function.

The Trace Value algorithm

Function parameters

The function takes three parameters; an AST node, a rule context, and optionally a verifier function. Because this function is a helper function for rule developers, the AST node provided by the user, is whatever node the rule developer wants to check. The rule context is just the context of the rule being developed. The verifier function is a function that describes a recipe of how to verify the node/deem the node safe.

Function return

TraceValue returns an object containing a result and a trace. The result includes a boolean and an AST node. This node is the determining node from the process of verifying the provided node. The boolean describes whether the AST node can be deemed safe or not.

The nodeComponentTrace field is a representation of all the value nodes that were visited in the process of verifying the provided node. As a result of this approach, whenever the algorithm visits a node that can not be verified, the nodeComponentTrace will only include the nodes related to this unverified node. In cases where there are no unverified nodes, the nodeComponentTrace includes all visited nodes.

The type of the returned object:

{ 
  result: { 
    isVerified: boolean;
    determiningNode: TSESTree.Node;
  }
  nodeComponentTrace: ITraceNode[];
}

TraceValue examples

Determining the value of an object property reference

In the ESLint rule:

//... We locate an ObjectExpression node, where we want to analyse the Literal's value of property a.
const result = traceValue(Node, RuleContext, (node) => node.type === "Literal");

if(!result.isVerified) Context.report(node, "Failed to determine value of object.a");
else if(result.determiningNode.value !== "the exact value i want") Context.report(node, "Object.a must be the exact value i want.");

Javascript source code:

const obj_001 = { a: "This is a string", b: "Another string" };

In this example, the rule reports "Object.a must be the exact value I want.", on the node obj_001;

Javascript source code:

const obj_002 = { a: fetch('https://evilcorp.com/hacky-hacky'), a: "Safe string" };

In this example, the rule reports "Failed to determine value of object.a", on the node obj_002.

Analyzing the node identifier

If you want to analyze the identifier of the node instead of the value, you can use the AST returned from traceValue to analyze it yourself. For example if you wanted to make a rule that checks if all variable names are ice cream flavors, you can traverse the returned AST yourself, and do the checking.

Test suite

Approach

The test files in the test suite are separated based on different types of programming constructs. The traceValue algorithm might be able to correctly analyze additional programming constructs beyond what is present in these tests. Accompanying the test files are target files containing Javascript source code. These target files include different test cases for each type of programming construct. The tests in the test files are simply testing the result of tracing some value in a target file, for example arr_001, which is array case 1.

LIMITATION keyword

There are a number of tests prefixed with "LIMITATION" keyword, which means the result of the tracing is lackluster. Failing "LIMITATION" tests are not necessarily an issue. It could be due to an extension of functionality.