UNPKG

@adguard/aglint

Version:

Universal adblock filter list linter.

52 lines (51 loc) 1.64 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; /** * Whether to fix fixable problems automatically. */ private fix; /** * Whether to use `.aglintignore` files. */ private ignore; /** * Whether any errors were found. */ 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>; }