eslint-plugin-export-scope
Version:
Don't leak LOCAL utils, states, components into the global scope
41 lines (40 loc) • 1.85 kB
TypeScript
/** child is same as base or inside base (logical tree only). */
export declare const sameOrSubPath: (base: string, child: string) => boolean;
export declare const toPosix: (p: string) => string;
export declare const getPathOfTheNearestConfig: (originPath: string, configFileName: string | string[]) => string | null | undefined;
export declare const getRootDir: (originPath: string) => string | null;
export declare const getFullScopePath: (exportDir: string, scope: string) => string | null;
export interface PathValidationResult {
isValid: boolean;
resolvedPath?: string;
isAncestor?: boolean;
}
/**
* Check if a path is an ancestor of the current directory (or is the current directory)
*/
export declare const isAncestorPath: (currentDir: string, targetPath: string) => boolean;
/**
* Validate a scope path for export default, @scope, and @scopeDefault
* These should only allow ancestor directories or "*"
*/
export declare const validateScopePath: (currentDir: string, scopePath: string) => PathValidationResult;
/**
* Validate an exception path - can be any valid filesystem path
*/
export declare const validateExceptionPath: (currentDir: string, exceptionPath: string) => PathValidationResult;
/**
* Generate all possible ancestor paths for autocompletion
*/
export declare const generateAncestorPaths: (currentDir: string, rootDir: string) => string[];
/**
* Get path type for determining completion behavior
*/
export declare enum PathContextType {
SCOPE_DEFAULT_EXPORT = "scope_default_export",
SCOPE_JSDOC = "scope_jsdoc",
SCOPE_DEFAULT_JSDOC = "scope_default_jsdoc",
SCOPE_EXCEPTION_JSDOC = "scope_exception_jsdoc",
EXCEPTIONS_ARRAY = "exceptions_array"
}
export declare const getPathContext: (text: string, position: number) => PathContextType | null;
export { sameOrSubPath as isSubPath };