Skip to content

Enhancement: Support Lazy Loading Rules #11029

Open
@mr-sanders

Description

@mr-sanders

Before You File a Proposal Please Confirm You Have Done The Following...

Relevant Package

eslint-plugin

My proposal is suitable for this project

  • I believe my proposal would be useful to the broader TypeScript community (meaning it is not a niche proposal).

Description

I propose the addition of lazy loading support for rule definitions. As the number of rules grows, it becomes increasingly inefficient to load them all at once. Currently, all rules are loaded eagerly, which can lead to unnecessary memory usage and slower startup times, especially for configurations that use only a subset of rules (e.g., non-type-checking). Additionally, the lack of this mechanism breaks the lazy loading already implemented in the ESLint repository - all rules in the current repository that use the getESLintCoreRule utility eagerly load core rules.

Additional Info

ESLint Config

import tseslint from 'typescript-eslint';

export default tseslint.config({
  files: ['**/*.ts'],
  extends: [tseslint.configs.base],
});

eslint ./index.ts --debug

Expected Result

no eslint rules loaded

Actual Result

  ...
  eslint:rules Loading rule 'consistent-return' (remaining=289) +0ms
  eslint:rules Loading rule 'dot-notation' (remaining=288) +13ms
  eslint:rules Loading rule 'init-declarations' (remaining=287) +5ms
  eslint:rules Loading rule 'max-params' (remaining=286) +1ms
  eslint:rules Loading rule 'no-dupe-class-members' (remaining=285) +16ms
  eslint:rules Loading rule 'no-empty-function' (remaining=284) +4ms
  eslint:rules Loading rule 'no-invalid-this' (remaining=283) +10ms
  eslint:rules Loading rule 'no-loop-func' (remaining=282) +1ms
  eslint:rules Loading rule 'no-loss-of-precision' (remaining=281) +1ms
  eslint:rules Loading rule 'no-magic-numbers' (remaining=280) +1ms
  eslint:rules Loading rule 'no-restricted-imports' (remaining=279) +15ms
  eslint:rules Loading rule 'no-unused-expressions' (remaining=278) +32ms
  eslint:rules Loading rule 'no-useless-constructor' (remaining=277) +2ms
  eslint:rules Loading rule 'prefer-destructuring' (remaining=276) +7ms
  ...

Metadata

Metadata

Assignees

No one assigned

    Labels

    blocked by external APIBlocked by a tool we depend on exposing an API, such as TypeScript's Type Relationship APIenhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      pFad - Phonifier reborn

      Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

      Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


      Alternative Proxies:

      Alternative Proxy

      pFad Proxy

      pFad v3 Proxy

      pFad v4 Proxy