# Class: CrossPackageDependencyDetector

@boll/rules-typescriptGlobalsCrossPackageDependencyDetector

# Class: CrossPackageDependencyDetector

CrossPackageDependencyDetector will detect usages of files stored directly in other packages that happen to be in a known location on disk.

Instead of referencing these files via file path, they should be referenced through their package name. (eg import { Foo } from "@company/package" instead of import Foo from '../../the-package/foo')

# Hierarchy

  • CrossPackageDependencyDetector

# Implements

  • PackageRule

# Index

# Accessors

# Methods

# Accessors

# name

get name(): string

Defined in cross-package-dependency-detector.ts:27

Returns: string

# Methods

# check

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

Defined in cross-package-dependency-detector.ts:31

Parameters:

Name Type
file FileContext

Returns: Promise‹Result[]›


# checkImportPaths

checkImportPaths(packageRoot: BollDirectory, sourceFilePath: BollFile, importPaths: ImportPathAndLineNumber[]): Result[]

Defined in cross-package-dependency-detector.ts:49

Parameters:

Name Type
packageRoot BollDirectory
sourceFilePath BollFile
importPaths ImportPathAndLineNumber[]

Returns: Result[]


# getFileImports

getFileImports(sourceFile: SourceFile): ImportPathAndLineNumber[]

Defined in cross-package-dependency-detector.ts:36

Parameters:

Name Type
sourceFile SourceFile

Returns: ImportPathAndLineNumber[]


# Private getPathFromNode

getPathFromNode(n: ImportDeclaration): string

Defined in cross-package-dependency-detector.ts:73

Parameters:

Name Type
n ImportDeclaration

Returns: string