Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 24 additions & 4 deletions src/@lint-md/cli.d.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,35 @@
declare module '@lint-md/cli' {
export type RuleLevel = 0 | 1 | 2 | 'off' | 'warn' | 'error'

export interface CliConfig {
excludeFiles?: string[]
rules?: Record<string, RuleLevel>
}

export interface CliLintResult {
path: string
file: string
errors: LintMdError[]
}

export interface LintMdError {
level: string
type: string
text: string
start: { line: number; column: number }
end: { line: number; column: number }
}

export class Lint {
constructor(files: string[], config: any)
constructor(files: string[], config: CliConfig)
start(): Promise<void>
showResult(): void
printOverview(): void
countError(): { error: number; warning: number }
errorFiles: any[]
errorFiles: CliLintResult[]
}
export type CliConfig = any
}

declare module '@lint-md/cli/lib/index' {
export { Lint, CliConfig } from '@lint-md/cli'
export { Lint, CliConfig, CliLintResult, LintMdError, RuleLevel } from '@lint-md/cli'
}
6 changes: 3 additions & 3 deletions src/lint-md-action.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import * as fs from 'fs'
import * as path from 'path'
import * as core from '@actions/core'
import { Lint, CliConfig } from '@lint-md/cli/lib/index'
import { Lint, CliConfig, CliLintResult } from '@lint-md/cli/lib/index'

export class LintMdAction {
private readonly basePath!: string
Expand All @@ -31,7 +31,7 @@ export class LintMdAction {
.map(res => path.resolve(this.basePath, res))
}

getConfig() {
getConfig(): CliConfig {
const configPath = path.resolve(this.basePath, core.getInput('configFile'))
if (!fs.existsSync(configPath)) {
core.warning('The user does not have a configuration file to pass in, we will use the default configuration instead...')
Expand Down Expand Up @@ -94,7 +94,7 @@ export class LintMdAction {
}
}

getErrors() {
getErrors(): CliLintResult[] {
return this.linter.errorFiles
}
}
Loading