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

@reharik/eslint-plugin-smart-enum

v0.1.1

Published

Type-aware ESLint rules for @reharik/smart-enum

Readme

@reharik/eslint-plugin-smart-enum

Type-aware ESLint rules for @reharik/smart-enum.

Install

npm install --save-dev @reharik/eslint-plugin-smart-enum @typescript-eslint/parser eslint typescript

Peer dependencies: eslint >=9, @typescript-eslint/parser ^8, typescript >=5.

Usage (flat config)

1. Enable type information (required)

[!WARNING] This rule is type-aware. Without type information it does nothing useful. You must give the parser a TypeScript program via parserOptions.projectService: true or parserOptions.project. The plugin does not set a parser or parser options — you own that. If type information is missing, typescript-eslint throws a "requires type information" error; if your files are matched by a config block that has no .ts parser at all, the rule never runs.

// eslint.config.js
import tsParser from '@typescript-eslint/parser';
import smartEnum from '@reharik/eslint-plugin-smart-enum';

export default [
  {
    files: ['**/*.ts', '**/*.tsx'],
    languageOptions: {
      parser: tsParser,
      parserOptions: {
        projectService: true, // or: project: './tsconfig.json'
        tsconfigRootDir: import.meta.dirname,
      },
    },
  },
  // 2. add the rule here — see below
];

2. Add the rule

Pick one of these and add it to the array after the parser block.

Recommended config — turns the rule on as error for every file ESLint lints:

smartEnum.configs.recommended,

Explicit plugin and rule — use this to set the rule to 'warn' or to limit it to certain files:

{
  files: ['src/**/*.ts'],
  plugins: { 'smart-enum': smartEnum },
  rules: { 'smart-enum/no-smart-enum-reference-equality': 'warn' },
},

Rules

| Rule | Description | Recommended | | ------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------ | ----------- | | smart-enum/no-smart-enum-reference-equality | Disallow ===, !==, ==, != on smart-enum members; use .equals() | error |

no-smart-enum-reference-equality

=== on smart-enum members compares object identity, which breaks when two copies of @reharik/smart-enum end up in one app (nested installs, bundling, mixed ESM/CJS) and each builds its own member objects. .equals() compares by enum type and value, so it works across copies.

// ❌
if (status === Status.active) {
}
if (status !== Status.active) {
}

// ✅
if (status.equals(Status.active)) {
}
if (!status.equals(Status.active)) {
}

Members are detected structurally (any type, or union constituent, whose __smart_enum_brand property is literally true), not by importing the library's types, so members from a duplicate copy of the package are still caught. Nullish checks (status == null, status != undefined) are allowed.