From 8cee412e5871029934a1281729094400b0f28017 Mon Sep 17 00:00:00 2001 From: ABaldwinHunter Date: Fri, 16 Oct 2015 15:55:41 -0400 Subject: [PATCH 1/2] Add content for issues Once ESLint is updated to return a `docs` object containing rule name and doc content: (PR: https://github.com/codeclimate/eslint/commit/52701b16a36924df16705266992ef4585a36ea25) we can easily access that data for issue content. ESLint rule markdown docs here: https://github.com/eslint/eslint/tree/master/docs/rules If no doc is found, the content defaults to a suggestion to read more at Source: http://eslint.org/docs/rules/ --- bin/eslint.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/bin/eslint.js b/bin/eslint.js index 6aeb1b46e..d3adf30f7 100755 --- a/bin/eslint.js +++ b/bin/eslint.js @@ -3,6 +3,7 @@ process.chdir('/code'); var CLIEngine = require("eslint").CLIEngine; +var docs = require("eslint").docs(); var fs = require("fs"); var glob = require("glob"); var options = { extensions: [".js"], ignore: true, reset: false, useEslintrc: true }; @@ -31,6 +32,7 @@ function buildIssueJson(message, path) { categories: ["Style"], check_name: checkName, description: message.message, + content: contentBody(checkName), location: { path: path, positions: { @@ -49,6 +51,11 @@ function buildIssueJson(message, path) { return JSON.stringify(issue); } +function contentBody(check) { + var content = docs[check] || "For more information visit "; + return content + "Source: http://eslint.org/docs/rules/\n"; +} + function isFileWithMatchingExtension(file, extensions) { var stats = fs.lstatSync(file); var extension = "." + file.split(".").pop(); From 6268220aebf2924fb93e3a5847d10daeb57d20cf Mon Sep 17 00:00:00 2001 From: GordonDiggs Date: Tue, 20 Oct 2015 13:03:19 -0400 Subject: [PATCH 2/2] Update contentBody to use new function --- bin/eslint.js | 4 ++-- package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/bin/eslint.js b/bin/eslint.js index d3adf30f7..84f63d6cb 100755 --- a/bin/eslint.js +++ b/bin/eslint.js @@ -3,7 +3,7 @@ process.chdir('/code'); var CLIEngine = require("eslint").CLIEngine; -var docs = require("eslint").docs(); +var docs = require("eslint").docs; var fs = require("fs"); var glob = require("glob"); var options = { extensions: [".js"], ignore: true, reset: false, useEslintrc: true }; @@ -52,7 +52,7 @@ function buildIssueJson(message, path) { } function contentBody(check) { - var content = docs[check] || "For more information visit "; + var content = docs.get(check) || "For more information visit "; return content + "Source: http://eslint.org/docs/rules/\n"; } diff --git a/package.json b/package.json index 93823b3d4..8b3d60073 100644 --- a/package.json +++ b/package.json @@ -9,7 +9,7 @@ }, "dependencies": { "babel-eslint": "4.1.3", - "eslint": "codeclimate/eslint.git#d8eb059", + "eslint": "codeclimate/eslint.git#2bbebe6", "eslint-plugin-babel": "2.1.1", "eslint-plugin-react": "3.5.1", "glob": "5.0.14"