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-plugin-crank

v0.2.2

Published

ESLint plugin for the Crank JS framework

Readme

eslint-plugin-crank

ESLint plugin for Crank.js.

Installation

npm i -D eslint-plugin-crank

Usage

ESLint 9 (flat config)

// eslint.config.js
import crankPlugin from "eslint-plugin-crank";

export default [
  {
    files: ["**/*.{ts,tsx,js,jsx}"],
    plugins: {
      crank: crankPlugin,
    },
    rules: {
      ...crankPlugin.configs.recommended.rules,
    },
  },
];

ESLint 8 (eslintrc)

{
  "plugins": ["crank"],
  "extends": ["plugin:crank/recommended"]
}

Configurations

  • recommended — All rules enabled.

Rules

Core Rules

crank/prefer-props-iterator

Replaces while (true) with for ({} of this) in generator components.

// Bad
function* Counter() {
  while (true) {
    yield <div>{count}</div>;
  }
}

// Good
function* Counter() {
  for ({} of this) {
    yield <div>{count}</div>;
  }
}

crank/prop-destructuring-consistency

Ensures props accessed in loop body are destructured in the for...of pattern.

// Bad — count won't update when props change
function* Component({ title, count }) {
  for ({ title } of this) {
    yield <div>{title} {count}</div>;
  }
}

// Good
function* Component({ title, count }) {
  for ({ title, count } of this) {
    yield <div>{title} {count}</div>;
  }
}

crank/prefer-refresh-callback

Encourages this.refresh(() => { ... }) over separate mutation + this.refresh().

// Bad
const onclick = () => {
  count++;
  this.refresh();
};

// Good
const onclick = () =>
  this.refresh(() => {
    count++;
  });

crank/no-yield-in-lifecycle-methods

Prevents yield in lifecycle callbacks (schedule, after, cleanup). Also prevents return with a value in after(). Note: schedule() and cleanup() can be async, so returning values from them is allowed.

crank/require-cleanup-for-timers

Detects setInterval/setTimeout without cleanup. Recognizes this.cleanup(), post-loop cleanup, and try/finally patterns.

// All valid cleanup patterns:
this.cleanup(() => clearInterval(timer));

for ({} of this) { yield <div>{seconds}</div>; }
clearInterval(timer);

try {
  for ({} of this) { yield <div>{seconds}</div>; }
} finally {
  clearInterval(timer);
}

JSX Rules

crank/jsx-uses-crank

Marks createElement imports as used when JSX is present (prevents false no-unused-vars errors).

crank/jsx-uses-vars

Marks variables used in JSX as used (prevents false no-unused-vars errors).

crank/jsx-no-undef

Reports undefined variables in JSX.

crank/jsx-no-duplicate-props

Reports duplicate props in JSX elements.

DOM/SVG Attribute Rules

crank/no-react-props

classNameclass, htmlForfor, dangerouslySetInnerHTML={{ __html: v }}innerHTML={v}.

crank/no-react-event-props

onClickonclick. Crank uses standard DOM event names.

crank/no-react-svg-props

strokeWidthstroke-width, xlinkHrefxlink:href, etc. Crank uses standard SVG attribute names.

Deprecated API Rules

crank/no-deprecated-flush

Detects usage of the deprecated context.flush() method and suggests context.refresh().

crank/no-deprecated-special-props

Detects deprecated special props (crank-key, crank-ref) and suggests the current equivalents (c-key, c-ref).

License

MIT