UNPKG

@adguard/aglint

Version:

Universal adblock filter list linter.

43 lines (42 loc) 1.45 kB
import { type LinterCliReporter } from './reporter'; /** * Implements CLI functionality for the linter. Typically used by the `aglint` command in Node.js environment. */ export declare class LinterCli { /** * The reporter to be used for the CLI. */ private readonly reporter; private fix; private ignore; private errors; /** * Creates a new `LinterCli` instance. * * @param reporter The reporter to be used for the CLI * @param fix Fix fixable problems automatically * @param ignore Use `.aglintignore` files */ constructor(reporter: LinterCliReporter, fix?: boolean, ignore?: boolean); /** * Lints a file with the given config. Also compatible with the `WalkEvent` type, * so it can be used with the `walk` function. * * @param file The file to be linted * @param config The active linter config (merged from parent directories) */ private lintFile; /** * Returns true if the linter found any errors. * * @returns `true` if the linter found any errors, `false` otherwise */ hasErrors: () => boolean; /** * Lints the current working directory. If you specify files, it will only lint those files. * * @param cwd The current working directory * @param files The files to be linted (if not specified, it will scan the cwd) */ run: (cwd: string, files?: string[]) => Promise<void>; }