...
 
Commits (4)
# html-validate changelog
# [1.10.0](https://gitlab.com/html-validate/html-validate/compare/v1.9.1...v1.10.0) (2019-09-19)
### Features
- **api:** better exposure of cli api ([2c16c5b](https://gitlab.com/html-validate/html-validate/commit/2c16c5b))
- **api:** new method `validateMultipleFiles` ([536be69](https://gitlab.com/html-validate/html-validate/commit/536be69))
## [1.9.1](https://gitlab.com/html-validate/html-validate/compare/v1.9.0...v1.9.1) (2019-09-19)
### Bug Fixes
......
{
"name": "html-validate",
"version": "1.9.1",
"version": "1.10.0",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
......
{
"name": "html-validate",
"version": "1.9.1",
"version": "1.10.0",
"description": "html linter",
"keywords": [
"html",
......
import { Report } from "../reporter";
import { expandFiles, ExpandOptions } from "./expand-files";
import { getFormatter } from "./formatter";
export class CLI {
public expandFiles(
patterns: string[],
options: ExpandOptions = {}
): string[] {
return expandFiles(patterns, options);
}
public getFormatter(formatters: string): (report: Report) => string {
return getFormatter(formatters);
}
}
......@@ -4,7 +4,7 @@ import path from "path";
const DEFAULT_EXTENSIONS = ["html"];
interface ExpandOptions {
export interface ExpandOptions {
/**
* Working directory. Defaults to `process.cwd()`.
*/
......
import { CLI } from "./cli";
export default CLI;
......@@ -3,7 +3,7 @@ import { Source } from "./context";
import { SourceHooks } from "./context/source";
import { Engine, EventDump, TokenDump } from "./engine";
import { Parser } from "./parser";
import { Report } from "./reporter";
import { Report, Reporter } from "./reporter";
import { RuleDocumentation } from "./rule";
/**
......@@ -72,6 +72,19 @@ class HtmlValidate {
return engine.lint(source);
}
/**
* Parse and validate HTML from multiple files. Result is merged together to a
* single report.
*
* @param filenames - Filenames to read and parse.
* @returns Report output.
*/
public validateMultipleFiles(filenames: string[]): Report {
return Reporter.merge(
filenames.map(filename => this.validateFile(filename))
);
}
/**
* Tokenize filename and output all tokens.
*
......
......@@ -2,6 +2,7 @@
export { default as HtmlValidate } from "./htmlvalidate";
export { AttributeData } from "./parser";
export { CLI } from "./cli/cli";
export { Config, ConfigData, ConfigLoader } from "./config";
export { DynamicValue } from "./dom/dynamic-value";
export { Rule } from "./rule";
......