# Class: TransitiveDependencyDetector

@boll/rules-typescriptGlobalsTransitiveDependencyDetector

# Class: TransitiveDependencyDetector

TransitiveDependencyDetector will detect usages of non direct dependencies in import statements of typescript source files.

If package A depends on B, A is free to import things at will from package B. However, if B depends on C, A may be able to access C in some environments even without specifying a dependency in package.json.

This rule catches instances of this chain in typescript source files.

# Hierarchy

  • TransitiveDependencyDetector

# Implements

  • PackageRule

# Index

# Accessors

# Methods

# Accessors

# name

get name(): string

Defined in transitive-dependency-detector.ts:27

Returns: string

# Methods

# check

check(file: FileContext): Promise‹Result[]›

Defined in transitive-dependency-detector.ts:31

Parameters:

Name Type
file FileContext

Returns: Promise‹Result[]›


# getModuleImports

getModuleImports(sourceFile: SourceFile): ImportPathAndLineNumber[]

Defined in transitive-dependency-detector.ts:50

Parameters:

Name Type
sourceFile SourceFile

Returns: ImportPathAndLineNumber[]


# Private getPathFromNode

getPathFromNode(n: ImportDeclaration): string

Defined in transitive-dependency-detector.ts:63

Parameters:

Name Type
n ImportDeclaration

Returns: string


# isValidImport

isValidImport(packageDependencies: DependencyMap, importPath: string): any

Defined in transitive-dependency-detector.ts:45

Parameters:

Name Type
packageDependencies DependencyMap
importPath string

Returns: any