-
Notifications
You must be signed in to change notification settings - Fork 9.4k
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
Adds formatters for pretty and report outputs #301
Conversation
class Accessibilty extends Formatter { | ||
static getPrettyFormatter() { | ||
return function(info) { | ||
let output = ` - Rating: ${info.impact}\n`; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: just use a multiline string for the initial assignment.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
return this._formatters[name]; | ||
} | ||
|
||
static getPrettyFormatter() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
shoudl we do 1:1 matching against our --output
value options? so maybe getFormatter('pretty')
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what is the story for JSON output?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@paulirish The formatter matches the internal type, e.g. 'critical-render-path', 'accessibility', 'security'... it's essentially the formatter to use. Even if we 1:1 it, we'd still hard code the ReportGenerator to request HTML, and the CLI to request pretty, so I dunno we'd get much benefit.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The story for JSON is that we output the extendedInfo as-is.
Seems good. Needs a rebase |
Fixes smoke test
Ensures that each formatter provides the right functions
Works with a11y audit atm, but this change will allow support for CRP etc.