textlint output formatter
npm install @textlint/linter-formattertextlint output formatter.
```
npm install @textlint/linter-formatter
See formatters/.
Currently, you can use "stylish" (defaults), "checkstyle", "compact", "github", "jslint-xml", "json", "junit", "pretty-error", "table", "tap", and "unix".
`js
const { loadFormatter } = require("@textlint/linter-formatter");
const formatter = await loadFormatter({
formatterName: "stylish"
});
const output = formatter.format([
{
filePath: "./README.md",
messages: [
{
ruleId: "semi",
line: 1,
column: 23,
message: "Expected a semicolon."
}
]
}
]);
console.log(output);
/*
./README.md
1:23 warning Expected a semicolon semi
ā 1 problem (0 errors, 1 warning)
*/
`
`typescript`
export declare type FormatterConfig = {
color?: boolean;
formatterName: string;
};
export interface FormatterDetail {
name: string;
}
export declare function getFormatterList(): FormatterDetail[];
``
$ textlint -f json README.md --rule no-todo | textlint-formatter -f pretty-error --stdin
- azu/textlint-formatter-codecov: textlint formatter for codecov json.
- azu/textlint-formatter-lcov: textlint formatter for lcov format
1. Fork it!
2. Create your feature branch: git checkout -b my-new-featuregit commit -am 'Add some feature'
3. Commit your changes: git push origin my-new-feature`
4. Push to the branch:
5. Submit a pull request :D
MIT