3.0.0 • Published 2 days ago

jshint-json v3.0.0

Weekly downloads
531
License
MIT
Repository
github
Last release
2 days ago

jshint-json

JSON reporter for JSHint

Makes it easy to use JSHint with other tools.

Install

npm install --save-dev jshint-json

Usage

JSHint CLI

jshint --reporter node_modules/jshint-json/json.js file.js

grunt-contrib-jshint

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

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

Example output

{
	"result": [{
		"file": "test.js",
		"error": {
			"id": "(error)",
			"raw": "'{a}' is not defined.",
			"code": "W117",
			"evidence": "describe('jshint-json', function () {",
			"line": 6,
			"character": 1,
			"scope": "(main)",
			"a": "describe",
			"reason": "'describe' is not defined."
		}
	}, {
		"file": "test.js",
		"error": {
			"id": "(error)",
			"raw": "'{a}' is not defined.",
			"code": "W117",
			"evidence": "\tit('should be used by JSHint', function () {",
			"line": 7,
			"character": 5,
			"scope": "(main)",
			"a": "it",
			"reason": "'it' is not defined."
		}
	}],
	"data": [{
		"functions": [{
			"name": "\"jshint-json\"",
			"line": 6,
			"character": 35,
			"last": 26,
			"lastcharacter": 2,
			"metrics": {
				"complexity": 1,
				"parameters": 0,
				"statements": 1
			}
		}, {
			"name": "\"should be used by JSHint\"",
			"line": 7,
			"character": 46,
			"last": 25,
			"lastcharacter": 6,
			"metrics": {
				"complexity": 1,
				"parameters": 0,
				"statements": 5
			}
		}],
		"options": {
			"node": true,
			"esnext": true,
			"bitwise": true,
			"camelcase": true,
			"curly": true,
			"eqeqeq": true,
			"immed": true,
			"indent": 4,
			"(explicitIndent)": true,
			"latedef": true,
			"newcap": true,
			"noarg": true,
			"quotmark": "single",
			"regexp": true,
			"undef": true,
			"unused": true,
			"strict": true,
			"trailing": true,
			"smarttabs": true,
			"maxerr": 50
		},
		"errors": [{
			"id": "(error)",
			"raw": "'{a}' is not defined.",
			"code": "W117",
			"evidence": "describe('jshint-json', function () {",
			"line": 6,
			"character": 1,
			"scope": "(main)",
			"a": "describe",
			"reason": "'describe' is not defined."
		}, {
			"id": "(error)",
			"raw": "'{a}' is not defined.",
			"code": "W117",
			"evidence": "\tit('should be used by JSHint', function () {",
			"line": 7,
			"character": 5,
			"scope": "(main)",
			"a": "it",
			"reason": "'it' is not defined."
		}],
		"implieds": [{
			"name": "describe",
			"line": [
				6
			]
		}, {
			"name": "it",
			"line": [
				7
			]
		}],
		"globals": [
			"assert",
			"require",
			"jshint",
			"jsonReporter",
			"console"
		],
		"member": {
			"run": 1,
			"reporter": 2,
			"log": 2,
			"args": 1
		},
		"file": "test.js"
	}]
}
3.0.0

2 days ago

2.0.0

6 years ago

1.0.1

6 years ago

1.0.0

10 years ago

0.1.2

11 years ago

0.1.1

11 years ago

0.1.0

11 years ago