Interlace ESLint
ESLint Interlace
Import NextRules

prefer-direct-import

Prefer direct imports over barrel imports for better tree-shaking and build performance

šŸ’¼ This rule is enabled in the following configs: recommended, typescript. šŸ’” This rule is automatically fixable by the --fix CLI option.

Prefer direct imports over barrel imports for better tree-shaking and build performance

Rule Details

This rule aims to prevent issues related to prefer-direct-import.

Options

[
  {
    "type": "object",
    "properties": {
      "mappings": {
        "type": "array",
        "items": {
          "type": "object",
          "properties": {
            "barrel": {
              "type": "string"
            },
            "directPath": {
              "type": "string"
            }
          },
          "required": [
            "barrel",
            "directPath"
          ]
        },
        "default": [],
        "description": "Mapping of barrel paths to direct import patterns"
      },
      "autoFix": {
        "type": "boolean",
        "default": true,
        "description": "Auto-fix the imports when possible"
      }
    },
    "additionalProperties": false
  }
]

Implementation

OWASP Foundation

  • Category: A00:2021 - General Security

On this page