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 🙏

© 2025 – Pkg Stats / Ryan Hefner

@mjfwebb/require-options-object

v1.6.0

Published

An eslint/teslint plugin that enforces using an options object for functions with more than three parameters.

Readme

@mjfwebb/require-options-object

An eslint/teslint plugin that enforces using an options object for functions with more than three parameters.

Installation

npm install --save-dev @mjfwebb/require-options-object

Usage

Import and register the plugin in your teslint configuration:

import requireOptionsObject from "@mjfwebb/require-options-object";

export default {
  plugins: {
    "require-options-object": requireOptionsObject,
  },
  rules: {
    // Require options object for functions with more than three parameters
    "require-options-object/require-options-object": "error",
  },
};

Rule: require-options-object/require-options-object

Enforces using an options object when a function has more than three parameters.

Examples

❌ Incorrect

function test(a, b, c, d) {
  return a + b + c + d;
}

const fn = (x, y = 2, z, w = "w") => x * y * z * parseInt(w);

const obj = {
  method(a, b, c, d) {
    return;
  },
};

class C {
  constructor(a, b, c, d) {}
}

class C2 {
  constructor(a: string, b: number, c: boolean, d: unknown) {}
}

✅ Correct

function test({ a, b, c, d }) {
  return a + b + c + d;
}

const fn = ({ x, y = 2, z, w = "w" }) => x * y * z * parseInt(w);

const obj = {
  method({ a, b, c, d }) {
    return;
  },
};

class C {
  constructor({ a, b, c, d }) {}
}

class C2 {
  constructor({
    a,
    b,
    c,
    d,
  }: {
    a: string,
    b: number,
    c: boolean,
    d: unknown,
  }) {}
}

// Property callbacks are also allowed (signatures may be controlled by external APIs)
const config = {
  listener: async (locationName, itemName, quantity, quality) => {
    console.log(locationName, itemName, quantity, quality);
  },
};

obj.callback = (x, y, z, w, v) => x + y + z + w + v;

// Callbacks passed as function arguments are also allowed
eventEmitter.on("data", async (id, payload, timestamp, metadata) => {
  await processData({ id, payload, timestamp, metadata });
});

Notes

  • Functions with three or fewer parameters are not affected.
  • Standard callbacks (e.g., replaceAll(x => x.toUpperCase())) are ignored.
  • Property callbacks are ignored (e.g., { listener: (a, b, c, d) => {} } or obj.callback = (a, b, c, d) => {}), as these function signatures may be controlled by external APIs.
  • Callbacks passed as function arguments are ignored (e.g., eventEmitter.on('event', (a, b, c, d) => {})), as these function signatures are typically controlled by external APIs.
  • The rule auto-fixes by converting parameters to a destructured options object.
  • If none of the original parameters had a type annotation, the generated destructured parameter will not have a type annotation either.
  • Functions with rest parameters (e.g., ...rest) are not affected.
  • Functions with destructured parameters as the first parameter are not auto-fixed.

License

MIT