Skip to content

⬅️ Back to Table of Contents

📄 no-var-requires.ts

📊 Analysis Summary

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

📚 Table of Contents

🛠️ File Location:

📂 packages/eslint-plugin/src/rules/no-var-requires.ts

📦 Imports

Name Source
TSESTree @typescript-eslint/utils
AST_NODE_TYPES @typescript-eslint/utils
ASTUtils @typescript-eslint/utils
createRule ../util
getStaticStringValue ../util

Variables & Constants

Name Type Kind Value Exported
parent any const `node.parent.type === AST_NODE_TYPES.ChainExpression
? node.parent.parent
: node.parent`

Functions

isImportPathAllowed(importPath: string): boolean

Code
function isImportPathAllowed(importPath: string): boolean {
      return allowPatterns.some(pattern => importPath.match(pattern));
    }
  • Parameters:
  • importPath: string
  • Return Type: boolean
  • 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[];
  },
];

MessageIds

type MessageIds = 'noVarReqs';