Skip to content

⬅️ Back to Table of Contents

📄 no-require-imports.ts

📊 Analysis Summary

Metric Count
🔧 Functions 2
📦 Imports 3
📊 Variables & Constants 1
📑 Type Aliases 2

📚 Table of Contents

🛠️ File Location:

📂 packages/eslint-plugin/src/rules/no-require-imports.ts

📦 Imports

Name Source
TSESTree @typescript-eslint/utils
AST_NODE_TYPES @typescript-eslint/utils
ASTUtils @typescript-eslint/utils

Variables & Constants

Name Type Kind Value Exported
allowAsImport any const options[0].allowAsImport

Functions

isImportPathAllowed(importPath: string): boolean | undefined

Code
function isImportPathAllowed(importPath: string): boolean | undefined {
      return allowPatterns?.some(pattern => importPath.match(pattern));
    }
  • Parameters:
  • importPath: string
  • Return Type: boolean | undefined
  • Calls:
  • allowPatterns?.some
  • importPath.match

isStringOrTemplateLiteral(node: TSESTree.Node): boolean

Code
function isStringOrTemplateLiteral(node: TSESTree.Node): boolean {
      return (
        (node.type === AST_NODE_TYPES.Literal &&
          typeof node.value === 'string') ||
        node.type === AST_NODE_TYPES.TemplateLiteral
      );
    }
  • Parameters:
  • node: TSESTree.Node
  • Return Type: boolean

Type Aliases

Options

type Options = [
  {
    allow?: string[];
    allowAsImport?: boolean;
  },
];

MessageIds

type MessageIds = 'noRequireImports';