@o3r/eslint-plugin
Version:
The module provides in-house eslint plugins to use in your own eslint configuration.
41 lines (40 loc) • 1.8 kB
TypeScript
import type { PackageJson } from 'type-fest';
/** List of packages information resulting of a package.json discovery */
export interface PackageProperty {
/** List of package.json file information */
packages: {
/** Parsed package.json content */
content: PackageJson;
/** Path to the file */
path: string;
/** Determine if the package.json has a workspace information */
isWorkspace?: boolean;
}[];
/** Determine if the package.json collection is the result of a default strategy (in the case no matching workspace has been found) */
hasDefaulted?: boolean;
}
/** Range discovered for a given dependency */
export interface RangeInformation {
/** Range as specified in the package.json dependencies */
range: string;
/** Path to the original package.json */
path: string;
}
/**
* Find the closest package.json file containing workspace definition in the parent directories
* @param directory Current directory to search for
* @param rootDir First directory of the recursion
*/
export declare const findWorkspacePackageJsons: (directory: string, rootDir?: string) => PackageProperty | undefined;
/**
* Compare and return the best range in the both given onces
* @param currentRange Current range in the memory stack
* @param range Range to compare the current one to
*/
export declare const getBestRange: (currentRange?: string, range?: string) => string | undefined;
/**
* Retrieve the best ranges for each dependencies in the given package.json files
* @param dependencyTypes Type of dependency files to analyze
* @param packages List of the package.json files
*/
export declare const getBestRanges: (dependencyTypes: string[], packages: PackageProperty["packages"]) => Record<string, RangeInformation>;