eslint-json

JSON formatter (reporter) for ESLint

npm install eslint-json
7 downloads in the last week
19 downloads in the last month

eslint-json Build Status

JSON formatter (reporter) for ESLint

Makes it easy to use ESLint with other tools.

Install

Install with npm: npm install --save-dev eslint-json

Getting started

Use it with:

ESLint CLI

eslint --format node_modules/eslint-json/json.js file.js

grunt-eslint

grunt.initConfig({
    eslint: {
        options: {
            format: require('eslint-json')
        },
        target: ['file.js']
    }
});

grunt.loadNpmTasks('grunt-eslint');
grunt.registerTask('default', ['eslint']);

Example output

{
    "config": {},
    "results": [
        {
            "filePath": "test.js",
            "messages": [
                {
                    "ruleId": "no-undef",
                    "node": {
                        "type": "Identifier",
                        "name": "require",
                        "range": [
                            27,
                            34
                        ],
                        "loc": {
                            "start": {
                                "line": 2,
                                "column": 13
                            },
                            "end": {
                                "line": 2,
                                "column": 20
                            }
                        }
                    },
                    "message": "'require' is not defined.",
                    "line": 2,
                    "column": 13,
                    "source": "require"
                }
            ]
        }
    ]
}

License

MIT © Sindre Sorhus

npm loves you