@nextcloud/eslint-config
Version:
Eslint shared config for nextcloud apps and libraries
42 lines (41 loc) • 1.47 kB
TypeScript
/*!
* SPDX-FileCopyrightText: 2025 Nextcloud GmbH and Nextcloud contributors
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
import type { Rule } from 'eslint';
/**
* Check if a given path exists and is a directory
*
* @param filePath The path
*/
export declare function isDirectory(filePath: string): boolean;
/**
* Check if a given path exists and is a directory
*
* @param filePath The path
*/
export declare function isFile(filePath: string): boolean;
/**
* Find the path of nearest `appinfo/info.xml` relative to given path
*
* @param currentPath Path to lookup
* @return Either the full path including the `info.xml` part or `undefined` if no found
*/
export declare function findAppinfo(currentPath: string): string | undefined;
/**
* Make sure that versions like '25' can be handled by semver
*
* @param version The pure version string
* @return Sanitized version string
*/
export declare function sanitizeTargetVersion(version: string): string;
/**
* Create a callback that takes a version number an checks if the version
* is valid compared to configured version / detected version.
*
* @param options Options
* @param options.cwd The current working directory
* @param options.physicalFilename The real filename where ESLint is linting currently
* @param options.options The plugin options
*/
export declare function createVersionValidator({ cwd, physicalFilename, options }: Rule.RuleContext): ((version: string) => boolean);