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

@usehercules/eslint-plugin

v1.0.40

Published

ESLint plugin for Hercules

Readme

@usehercules/eslint-plugin

Opinionated ESLint plugin for Hercules with TypeScript support. This plugin provides rules to enforce best practices and prevent common mistakes.

Installation

npm install --save-dev @usehercules/eslint-plugin
# or
pnpm add -D @usehercules/eslint-plugin
# or
yarn add -D @usehercules/eslint-plugin

Peer Dependencies

This plugin requires:

  • ESLint 9.0.0 or higher
  • TypeScript 4.0.0 or higher (for type checking features)
  • @typescript-eslint/parser 7.0.0 or higher (for TypeScript support)

Quick Start

Create an eslint.config.js file in your project root:

import herculesPlugin from "@usehercules/eslint-plugin";

export default [
  // Use the recommended opinionated configuration
  herculesPlugin.configs.recommended,
];

Philosophy

This plugin is opinionated and enforces specific patterns that we believe lead to better, more maintainable code. The recommended configuration is not meant to be heavily customized - it represents our best practices.

Rules

no-empty-select-value (Opinionated, Non-configurable)

Always enabled in recommended config.

Prevents SelectItem components from having empty string values, which typically indicate a logic error or poor UX.

// ❌ Invalid
<SelectItem value="">Empty Value</SelectItem>
<SelectItem>Missing Value</SelectItem>
<SelectItem value={``}>Empty Template</SelectItem>

// ✅ Valid
<SelectItem value="option1">Option 1</SelectItem>
<SelectItem value="0">Zero</SelectItem>
<SelectItem value={selectedValue}>Dynamic Value</SelectItem>

This rule is intentionally non-configurable. If you need empty values in select options, consider using a different component or pattern.

no-invalid-function-args

Validates function arguments based on configured constraints. The recommended config includes sensible defaults for common functions.

Default Configuration (in recommended):

{
  functions: [
    // Prevent invalid fetch URLs
    {
      name: "fetch",
      arguments: [{ index: 0, notEmpty: true, pattern: "^https?://" }],
    },
    // Prevent null/empty localStorage operations
    {
      name: "setItem",
      arguments: [
        { index: 0, notEmpty: true },
        { index: 1, notNull: true },
      ],
    },
  ];
}

Examples

// ❌ Invalid
fetch(""); // Empty URL
fetch("ftp://example.com"); // Non-HTTP(S) protocol
localStorage.setItem("", "value"); // Empty key
localStorage.setItem("key", null); // Null value

// ✅ Valid
fetch("https://api.example.com");
localStorage.setItem("user", JSON.stringify({ id: 1 }));

no-invalid-component-props (Strict mode only)

Available in strict configuration for additional component prop validation.

Configurations

Recommended (Opinionated)

The recommended configuration includes our opinionated rules with sensible defaults:

import herculesPlugin from "@usehercules/eslint-plugin";

export default [herculesPlugin.configs.recommended];

Includes:

  • no-empty-select-value: Error (non-configurable)
  • no-invalid-function-args: Error (with defaults for fetch and localStorage)

Strict

For teams wanting additional validation:

import herculesPlugin from "@usehercules/eslint-plugin";

export default [herculesPlugin.configs.strict];

Includes everything from recommended, plus:

  • More function validations (getItem, removeItem)
  • Component prop validation (Button, Input, Form)

TypeScript

Optimized for TypeScript projects:

import herculesPlugin from "@usehercules/eslint-plugin";
import tsParser from "@typescript-eslint/parser";

export default [
  {
    files: ["**/*.{ts,tsx}"],
    languageOptions: {
      parser: tsParser,
      parserOptions: {
        project: "./tsconfig.json",
      },
    },
    ...herculesPlugin.configs.typescript,
  },
];

Custom Configuration

While we recommend using our opinionated defaults, you can customize if needed:

import herculesPlugin from "@usehercules/eslint-plugin";
import tsParser from "@typescript-eslint/parser";

export default [
  {
    files: ["**/*.{js,jsx,ts,tsx}"],
    languageOptions: {
      parser: tsParser,
      parserOptions: {
        ecmaVersion: 2020,
        sourceType: "module",
        ecmaFeatures: { jsx: true },
      },
    },
    plugins: {
      "@usehercules": herculesPlugin,
    },
    rules: {
      // Opinionated rule - not configurable
      "@usehercules/no-empty-select-value": "error",

      // Add your own function validations
      "@usehercules/no-invalid-function-args": [
        "error",
        {
          functions: [
            {
              name: "myCustomFunction",
              arguments: [{ index: 0, notEmpty: true, minLength: 3 }],
            },
          ],
        },
      ],
    },
  },
];

TypeScript Support

Both rules support TypeScript type checking when used with @typescript-eslint/parser. The rules will validate types at compile time for better accuracy.

Future Expansion

We plan to add more opinionated rules for common component patterns and function usage. The goal is to catch common mistakes early and enforce consistent patterns across Hercules projects.

Contributing

This plugin is intentionally opinionated. If you find a pattern that should be enforced or prevented, please open an issue with a clear use case and examples.

License

MIT