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

@jsenv/eslint-plugin

v1.2.0

Published

Custom ESLint rules for jsenv projects

Readme

@jsenv/eslint-plugin

ESLint plugin for jsenv projects with advanced parameter validation rules.

Table of Contents

Rules

no-unknown-params

Detects unknown parameters in function calls and JSX component props that are not recognized anywhere in the function definition or call chain.

✅ Valid

// Function parameters match usage
function greet({ name }) {
  return `Hello ${name}`;
}
greet({
  name: "John",
});

// JSX props match component parameters
function Button({ title, onClick }) {
  return <button onClick={onClick}>{title}</button>;
}
<Button title="Click me" onClick={handleClick} />;

// Rest parameters with chaining
function processData({ id, ...rest }) {
  return sendToAPI({ ...rest });
}
function sendToAPI({ data, options }) {
  // processes data and options
}
processData({
  id: 1,
  data: "test",
  options: {},
});

// Property renaming in destructuring
function processUser({ name: userName, id: userId }) {
  console.log(userName, userId);
}
processUser({
  name: "John",
  id: 123,
});

// Wrapper functions
const MemoButton = memo(Button);
<MemoButton title="Click me" onClick={handleClick} />;

❌ Invalid

// Superfluous unused parameters
function greet({ name }) {
  return `Hello ${name}`;
}
greet({
  name: "John",
  age: 25, // ❌ 'age' is not used
});

// Superfluous JSX props
function Button({ onClick }) {
  return <button onClick={onClick}>Click me</button>;
}
<Button
  onClick={handleClick}
  disabled={true} // ❌ 'disabled' is not used
/>;

// Superfluous parameters in rest chains
function processUser({ id, ...rest }) {
  return processData(rest);
}
function processData({ name, email }) {
  return { name, email };
}
processData({
  id: 1,
  data: "test",
  unused: "superfluous", // ❌ 'unused' not used in chain
});

Features

🎯 Core Functionality

  • Function Parameter Detection - Analyzes object destructuring parameters in function calls
  • JSX Component Props - Validates React component prop usage with well-known props patterns
  • React HOCs Support - Works with forwardRef(), memo(), and other Higher Order Components
  • Multiple Parameters - Handles functions with multiple destructured parameters

🔗 Advanced Analysis

Performs sophisticated analysis including rest parameter chains, function chaining via spread operators, property renaming, and scope resolution with order-independent detection.

The rule automatically ignores external/imported functions without definitions (see IMPLEMENTATION.md for technical details).

Auto-Fix Support

The rule includes automatic fixing capabilities with intelligent suggestions:

Typo Detection and Correction

// Before auto-fix - likely typo detected
function greet({ name }) {
  return `Hello ${name}`;
}
greet({ nam: "John" }); // ❌ 'nam' not found in "name"

// After auto-fix - suggests best match
greet({ name: "John" }); // ✅ Fixed to 'name'

Parameter Removal

// Before auto-fix - unused parameters
greet({ name: "John", age: 25, city: "NYC" });

// After auto-fix - removes unused parameters
greet({ name: "John" });

Examples

Function Chaining

// Complex parameter propagation
function handleRequest({ url, method, ...options }) {
  return processOptions({ ...options });
}

function processOptions({ headers, timeout }) {
  // Implementation
}

// ✅ Valid - all parameters are used in the chain
handleRequest({
  url: "/api/data",
  method: "GET",
  headers: { Accept: "application/json" },
  timeout: 5000,
});

// ❌ Invalid - 'retry' is not used anywhere in the chain
handleRequest({
  url: "/api/data",
  method: "GET",
  headers: { Accept: "application/json" },
  retry: 3, // ❌ unused parameter
});

React Component Validation

// Component definition
function UserCard({ name, email, avatar }) {
  return (
    <div>
      <img src={avatar} alt={name} />
      <h3>{name}</h3>
      <p>{email}</p>
    </div>
  );
}

// Wrapper components
const MemoizedUserCard = memo(UserCard);
const ForwardedUserCard = forwardRef(UserCard);

// ✅ Valid usage
<MemoizedUserCard
  name="John Doe"
  email="[email protected]"
  avatar="/avatar.jpg"
/>

// ❌ Invalid - superfluous prop
<ForwardedUserCard
  name="John Doe"
  email="[email protected]"
  avatar="/avatar.jpg"
  theme="dark" // ❌ unused prop
/>

Installation

npm install @jsenv/eslint-plugin

Usage

// eslint.config.js
import jsenvPlugin from "@jsenv/eslint-plugin";

export default [
  {
    plugins: {
      "@jsenv": jsenvPlugin,
    },
    rules: {
      "@jsenv/no-unknown-params": "error",
    },
  },
];

The plugin is automatically included in @jsenv/eslint-config-relax. So if you use @jsenv/eslint-config-relax you already have it enabled.

The rule has no configuration options - it uses sensible defaults for all scenarios.

Contributing

The plugin uses a comprehensive test suite with 39 tests covering all supported patterns. See IMPLEMENTATION.md for technical details.