"Working with custom formatters" page is out of date
See original GitHub issueI noticed a few problems when reading through the “Working with custom formatters” page in our documentation.
-
The
fixableWarningCount
andfixableErrorCount
properties aren’t included in the results objects, and they aren’t described in the section below. (This was an oversight from when the properties were added in https://github.com/eslint/eslint/commit/f5a7e4239071c5b56d2e476bced5c763b7e01c8d#diff-885d4b90cffa47361b72fc3c446d912a.) -
The example formatters have patterns like this:
module.exports = function(results) { var results = results || []; // ... }
However, the results array should never be null, so there is no need to redeclare the variable with a default like that.
-
Several of the example formatters use
console.log
to output results, which is not recommended (since it doesn’t work when the formatter is used by an integration). Instead, formatters should return a string. -
The example here for “Using a JSON formatter first” is unnecessarily complicated – I don’t think we need to walk people through how to create a separate script that reads from stdin. Also, we can tell people to use the built-in
json
formatter rather than creating their own custom formatter that does the same thing.
Issue Analytics
- State:
- Created 6 years ago
- Reactions:2
- Comments:8 (7 by maintainers)
Top GitHub Comments
Hi, if no one else is working on this I’d like to give it a go! I’m new to this but I’ll read through the contributing guidelines thoroughly and make sure I’m helping out rather than causing a hindrance. I reckon i could look into in the next couple of days.
Hi, I’m also new… would like to take on that last bullet point. Will shoot for completion by the end of the week at the latest (7/13/18). LMK if any issues with this. Thanks!