UNPKG

tslint-folders

Version:

Custom TSLint rules for checking imports between packages and their folders, and generating relevant diagrams.

23 lines (22 loc) 1.25 kB
import * as ts from "typescript"; import { ImportsBetweenPackagesRuleConfig, PackageFolder, PackageSubFolder } from "../model/ImportsBetweenPackagesRuleConfig"; import { TsConfig } from "./TsConfigParser"; export declare enum PathSource { SourceFilePath = 0, ImportText = 1 } export declare type PackageLocation = { packageName: string; packageFolder?: PackageFolder; packageSubFolder?: PackageSubFolder; }; export declare namespace ImportRuleUtils { const IS_DEBUG_ENABLED = false; function determinePackageLocationFromPath(filePath: string, ruleId: string, config: ImportsBetweenPackagesRuleConfig, pathSource: PathSource, tsConfig: TsConfig, thisPackageLocation?: PackageLocation): PackageLocation; function isRelativeImport(pathDir: string): boolean; function isThisPackageThirdParty(thisFolderLocation: PackageLocation, node: ts.Node): boolean; function isPackageThirdParty(folderLocation: PackageLocation): boolean; function logPackageAndImport(node: ts.Node, thisPackageLocation: PackageLocation, importPackageLocation: PackageLocation): void; function shouldIgnoreFile(node: ts.Node, ignorePaths: string[]): boolean; function shouldIgnorePath(path: string, ignorePaths: string[]): boolean; }