UNPKG

textlint

Version:

The pluggable linting tool for text and markdown.

58 lines 2.24 kB
import { TextlintKernelDescriptor, TextlintResult } from "@textlint/kernel"; import { TextlintFixResult } from "@textlint/types"; import { ScanFilePathResult } from "./util/find-util"; export type CreateLinterOptions = { descriptor: TextlintKernelDescriptor; ignoreFilePath?: string; quiet?: boolean; cache?: boolean; cacheLocation?: string; /** * The current working directory */ cwd?: string; }; export declare const createLinter: (options: CreateLinterOptions) => { /** * Lint files * Note: lintFiles respect ignore file * @param {String[]} filesOrGlobs An array of file path and directory names, or glob. * @returns {Promise<TextlintResult[]>} The results for all files that were linted. */ lintFiles(filesOrGlobs: string[]): Promise<TextlintResult[]>; /** * Lint text * Note: lintText does not respect ignore file * You can detect the file path is ignored or not by `scanFilePath()` * @param text * @param filePath */ lintText(text: string, filePath: string): Promise<TextlintResult>; /** * Lint files and fix them * Note: fixFiles respect ignore file * @param fileOrGlobs An array of file path and directory names, or glob. * @returns {Promise<TextlintFixResult[]>} The results for all files that were linted and fixed. */ fixFiles(fileOrGlobs: string[]): Promise<TextlintFixResult[]>; /** * Lint text and fix it * Note: fixText does not respect ignore file * You can detect the file path is ignored or not by `scanFilePath()` * @param text * @param filePath */ fixText(text: string, filePath: string): Promise<TextlintFixResult>; /** * Scan file path and return scan result * If you want to know the file is ignored by ignore file, use this function * Return { status "ok" | "ignored" | "error" } object: * - ok: found file and allow to lint/fix * - ignored: found file, and it is ignored by ignore file * - error: not found file * @param filePath * @returns {Promise<ScanFilePathResult>} */ scanFilePath(filePath: string): Promise<ScanFilePathResult>; }; //# sourceMappingURL=createLinter.d.ts.map