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

@patricktree/typescript-eslint-rules-requiring-type-info

v1.0.2

Published

## Problem

Readme

@patricktree/typescript-eslint-rules-requiring-type-info

Problem

Some typescript-eslint rules require type information. Enabling them provides real benefits, e.g. no-floating-promises catches cases in which one might forgot to await a promise.

However, if at least one rule requiring type information is enabled, the time it takes to lint increases significantly. See this page for more information.
This is usually OK if linting is done via the eslint CLI; however, in an IDE (especially if autofix-on-save is enabled), this can be very annoying.
Depending on the size of the TypeScript codebase, it might even happen that saving a file takes a couple of seconds because of these linting rules.

Solution

Only lint using rules requiring type information when the eslint CLI is used. Disable those rules when using an IDE like VS Code.
This way the IDE stays fast but running eslint from the terminal (or as pre-commit hook, in a CI/CD system, ...) still performs an "exhaustive" lint run.

This package exposes two functions to help accomplish this idea:

  • fetchAndStoreRules: fetches the list of rules from typescript-eslint.io/rules and stores all rules requiring type information in a JSON file.
  • removeTypeInfoRules: given a ESLint config and the JSON file, removes all rules which require type information from the ESLint config.

Installation (in four steps)

  1. Install the package:

    npm i --save-dev @patricktree/typescript-eslint-rules-requiring-type-info
  2. Run fetchAndStoreRules on a regular basis. You can run it using node in postinstall script of your package.json:

    {
      "scripts": {
        "postinstall": "node --input-type=module -e 'import { fetchAndStoreRules } from \"@patricktree/typescript-eslint-rules-requiring-type-info\"; void fetchAndStoreRules();'"
      }
    }
  3. Configure your .eslintrc.cjs file (picked up by IDEs) such that the rules are excluded, like so:

    const {
      removeTypeInfoRules,
    } = require('@patricktree/typescript-eslint-rules-requiring-type-info');
    
    const applyHeavyRules = process.env.APPLY_HEAVY_RULES === 'true';
    
    /**
     * @type {any}
     */
    const eslintConfig = {
      root: true,
      parser: '@typescript-eslint/parser',
      parserOptions: {
        tsconfigRootDir: __dirname,
        project: './tsconfig.json',
      },
      plugins: ['@typescript-eslint/eslint-plugin'],
      extends: [
        'eslint:recommended',
        'plugin:@typescript-eslint/recommended',
        'plugin:@typescript-eslint/recommended-requiring-type-checking',
      ],
    };
    
    /*
     * only if env variable APPLY_HEAVY_RULES is set, we will include the "heavy" @typescript-eslint rules
     */
    module.exports = applyHeavyRules ? eslintConfig : removeTypeInfoRules(eslintConfig);
  4. To run all rules when using the eslint CLI, configure a lint script in your package.json (and use that script from the terminal, in pre-commit hooks, in CI/CD, etc.):

    {
      "scripts": {
        "lint": "cross-env APPLY_HEAVY_RULES=true eslint --max-warnings 0 ."
      }
    }