CtrlK
BlogDocsLog inGet started
Tessl Logo

tessl/npm-rushstack--eslint-patch

Enhance ESLint with better support for large scale monorepos

Pending
Overview
Eval results
Files

custom-config-package-names.mddocs/

Custom Config Package Names

Custom Config Package Names patch removes ESLint's strict requirement that shareable config package names must include 'eslint-config' as a prefix, enabling more flexible naming patterns for rig packages and integrated tooling solutions.

Capabilities

Config Package Name Patch

Applies runtime patches to ESLint's ConfigArrayFactory to bypass the 'eslint-config' naming requirement for shareable configurations.

/**
 * Applies the custom config package names patch to ESLint
 * Must be required before ESLint processes any configuration
 */
require("@rushstack/eslint-patch/custom-config-package-names");

Usage Example:

// .eslintrc.js
require("@rushstack/eslint-patch/modern-module-resolution");
require("@rushstack/eslint-patch/custom-config-package-names");

module.exports = {
  extends: [
    '@your-company/build-rig/profile/default/includes/eslint/node' // No 'eslint-config' prefix required
  ],
  parserOptions: { tsconfigRootDir: __dirname }
};

Package Name Resolution

The patch modifies ESLint's config resolution to handle non-standard package names:

  1. Primary Resolution: Attempts to resolve using ESLint's normalized package name (with 'eslint-config-' prefix)
  2. Fallback Resolution: If MODULE_NOT_FOUND, attempts resolution using the original, non-normalized package name
  3. Error Propagation: Other errors are re-thrown unchanged
// Internal patch implementation (not directly callable)
interface ConfigArrayFactory {
  _loadExtendedShareableConfig(extendName: string): unknown;
}

interface Naming {
  normalizePackageName(name: string, prefix: string): string;
}

Rig Package Support

This patch specifically enables Rush Stack rig packages to provide ESLint configurations:

Rig Package Structure:

@your-company/build-rig/
├── package.json
├── profiles/
│   └── default/
│       └── includes/
│           └── eslint/
│               ├── node.js      # ESLint config for Node.js projects
│               └── browser.js   # ESLint config for browser projects

Consumer Usage:

module.exports = {
  extends: [
    '@your-company/build-rig/profile/default/includes/eslint/node'
  ]
};

Naming Pattern Examples

The patch enables these naming patterns:

  • @company/build-rig/profile/web (rig package with profile)
  • @company/tooling-config (generic tooling package)
  • company-tools/eslint (scoped tooling)
  • my-company-standards (company standards package)

ESLint Version Compatibility

Works across all supported ESLint versions:

  • ESLint 6.x: Patches ConfigArrayFactory._loadExtendedShareableConfig
  • ESLint 7.x: Compatible with @eslint/eslintrc changes
  • ESLint 8.x: Works with bundled eslintrc.cjs
  • ESLint 9.x: Supports both legacy and flat config modes

Integration with Modern Module Resolution

Often used together with the modern module resolution patch:

// Recommended combination for rig packages
require("@rushstack/eslint-patch/modern-module-resolution");
require("@rushstack/eslint-patch/custom-config-package-names");

module.exports = {
  extends: ['@company/build-rig/profile/web/eslint']
};

Error Handling

The patch gracefully handles resolution failures:

  • MODULE_NOT_FOUND with normalized name: Attempts resolution with original name
  • MODULE_NOT_FOUND with original name: Re-throws the error (config truly not found)
  • Other resolution errors: Re-thrown unchanged to preserve ESLint's error handling

Install with Tessl CLI

npx tessl i tessl/npm-rushstack--eslint-patch

docs

bulk-suppressions.md

custom-config-package-names.md

index.md

modern-module-resolution.md

tile.json