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

JSON-formatted output via `-f json` #852

Closed
rstacruz opened this issue Apr 11, 2017 · 4 comments

Comments

@rstacruz
Copy link
Member

commented Apr 11, 2017

Eslint supports this -f json to output JSON-formatted output:

./node_modules/.bin/eslint '**/*.js*' -f json | jq .

[
  {
    "filePath": "/Users/rsc/Projects/lol/behaviors/role-select.js",
    "messages": [
      {
        "ruleId": "no-multiple-empty-lines",
        "severity": 2,
        "message": "Too many blank lines at the end of file. Max of 0 allowed.",
        "line": 94,
        "column": 1,
        "nodeType": "Program",
        "source": "",
        "endLine": 95,
        "endColumn": 1,
        "fix": {
          "range": [
            2301,
            2302
          ],
          "text": ""
          /* snip */

Motivation

We can use tools that consume Eslint's JSON output, eg, https://github.com/rstacruz/stylelint-disable-all.

@dcousens

This comment has been minimized.

Copy link
Member

commented Apr 11, 2017

To be clear, @rstacruz is asking about optionally outputting JSON for the warnings emitted by standard (from eslint), for consumption by other tools.

Not that standard could add a JSON formatting feature.

I think?

@rstacruz rstacruz changed the title Feature request: JSON-formatted output via `-f json` JSON-formatted output via `-f json` Apr 11, 2017

@rstacruz

This comment has been minimized.

Copy link
Member Author

commented Apr 11, 2017

Happy to help adding this to standard-engine if you welcome it :)

@feross

This comment has been minimized.

Copy link
Member

commented Apr 13, 2017

@rstacruz Have you tried using standard-json? It's a standalone tool that takes the output from standard and converts it to JSON.

standard --verbose | standard-json
@rstacruz

This comment has been minimized.

Copy link
Member Author

commented Apr 14, 2017

ohh, i suppose thats what I'm looking for. It's not as verbose as eslint's -f json flag but it'll do for most cases.

@rstacruz rstacruz closed this Apr 14, 2017

@feross feross added enhancement and removed enhancement labels May 10, 2018

@lock lock bot locked as resolved and limited conversation to collaborators Aug 8, 2018

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
3 participants
You can’t perform that action at this time.