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 🙏

© 2024 – Pkg Stats / Ryan Hefner

@knk/eslint-plugin

v1.0.5

Published

ESLint configuration and custom rules for Fluent UI

Downloads

8

Readme

@knk/eslint-plugin

ESLint configuration and custom rules for knk

Configs

Usage: in your ESLint config file, add { "extends": ["plugin:@knk/<name>"] } or { "extends": ["plugin:@knk/eslint-plugin/<name>"] } (the two are equivalent).

  • react: For @knk/* and related packages
    • react--legacy: Like react but requiring an I prefix for interfaces
    • node: Like react but for packages which run in a Node environment (not the browser)
    • node--legacy: Like node but requiring an I prefix for interfaces

Helpers for customizing configuration are exported under a configHelpers object.

Rules

ban-imports

Ban importing from certain paths or modules. You can either ban the entire path, or only certain names. (Inspired by TSLint's import-blacklist.)

Requires one or more options objects. Either path or pathRegex is required.

  • path (string): Path or module to ban importing from (non-regex)
  • pathRegex (string): Regex for path or module to ban importing from
  • names (string[], optional): If provided, only ban imports of these names. Otherwise, ban all imports from the path.
  • message (string[], optional): Custom message to show with errors

Example:

"@knk/ban-imports": [
  "error",
  { "path": "lodash" },
  { "path": "foo", "names": ["bar", "baz"] },
  { "pathRegex": "^\.", message: "no relative imports" },
  { "pathRegex": "^\.\./(foo|bar)$", "names": ["baz"] }
]

deprecated-keyboard-event-props

Prevent using deprecated KeyboardEvent props which and keyCode, and recommend using @knk/keyboard-key instead.

max-len

Enforces max line length, more performantly than ESLint's max-len.

This rule is significantly faster than the default max-len rule because it does not support:

  • Expanding tabs (only handles spaces for indentation)
  • Multi-byte unicode characters (they will be counted as multiple characters)
  • Extra options for handling comments, strings, or URLs

(Skipping these extra features lets us do a basic string length check before running any regular expressions or other extra logic, which makes the huge majority of line length checks very fast.)

Options

The rule requires an options object containing:

  • max (required): the maximum line length
  • ignorePatterns (optional): ignore the line if it matches any of these regular expressions

no-global-react

Ban references to the React global namespace (in favor of explicitly importing React). Implicit global references cause problems for API Extractor and potentially other tools.

no-tslint-comments

Ban tslint:disable and tslint:enable comments.

no-visibility-modifiers

Prevent visibility modifiers (public, protected, private) from being specified on class members/methods.