Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expose available formatters in the Node API #2190

Merged
merged 3 commits into from
Dec 11, 2016
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
4 changes: 4 additions & 0 deletions docs/developer-guide/formatters.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,7 @@ A formatter is a function that accepts *an array of these stylelint result objec
ignored: false // This is `true` if the file's path matches a provided ignore pattern
}
```

## `stylelint.formatters`

stylelint's internal formatters are exposed publicly in `stylelint.formatters`.
7 changes: 7 additions & 0 deletions lib/__tests__/formatters.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
"use strict"

const stylelint = require("..")

it("formatters are exposed on stylelint object", () => {
expect(typeof stylelint.formatters.json).toBe("function")
})
2 changes: 2 additions & 0 deletions lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ const createRuleTester = require("./testUtils/createRuleTester")
const createStylelint = require("./createStylelint")
const postcssPlugin = require("./postcssPlugin")
const rules = require("./rules")
const formatters = require("./formatters")
const standalone = require("./standalone")

const api = postcssPlugin
Expand All @@ -20,6 +21,7 @@ api.utils = {

api.lint = standalone
api.rules = rules
api.formatters = formatters
api.createPlugin = createPlugin
api.createRuleTester = createRuleTester
api.createLinter = createStylelint
Expand Down