eslint 5.15.3 → 5.16.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,3 +1,15 @@
1
+ v5.16.0 - March 29, 2019
2
+
3
+ * [`dfef227`](https://github.com/eslint/eslint/commit/dfef227091955a2f8f3fa8c76ad79de8a77e7955) Build: gensite passes rulesMeta to formatter rendering (#11567) (Kevin Partington)
4
+ * [`c06d38c`](https://github.com/eslint/eslint/commit/c06d38c81bd9203c904587396a65d3c8cc7f2944) Fix: Allow HTML formatter to handle no meta data (#11566) (Ilya Volodin)
5
+ * [`87a5c03`](https://github.com/eslint/eslint/commit/87a5c034977cf4538ff3539d2f8776a987c5942a) Docs: `func-style`: clarify when `allowArrowFunctions` is used (#11548) (Oliver Joseph Ash)
6
+ * [`bc3e427`](https://github.com/eslint/eslint/commit/bc3e427ee8875c53eac6b6762884b50074f1adfc) Update: pass rule meta to formatters RFC 10 (#11551) (Chris Meyer)
7
+ * [`b452f27`](https://github.com/eslint/eslint/commit/b452f270bc0b523d88d5d827c95be3096f82e99d) Chore: Update README to pull in reviewer data (#11506) (Nicholas C. Zakas)
8
+ * [`afe3d25`](https://github.com/eslint/eslint/commit/afe3d25f8afb88caee43f7202d0eb96f33a92a6b) Upgrade: Bump js-yaml dependency to fix Denial of Service vulnerability (#11550) (Vernon de Goede)
9
+ * [`4fe7eb7`](https://github.com/eslint/eslint/commit/4fe7eb7cecdc2395cf1eeaa20921bda8460b00c2) Chore: use nyc instead of istanbul (#11532) (Toru Nagashima)
10
+ * [`f16af43`](https://github.com/eslint/eslint/commit/f16af439694aab473c647d8fae47c402bd489447) Chore: fix formatters/table test (#11534) (Toru Nagashima)
11
+ * [`78358a8`](https://github.com/eslint/eslint/commit/78358a8f66e95c4fcc921f2497e8a5ec5f1537ec) Docs: fix duplicate punctuation in CLI docs (#11528) (Teddy Katz)
12
+
1
13
  v5.15.3 - March 18, 2019
2
14
 
3
15
  * [`71adc66`](https://github.com/eslint/eslint/commit/71adc665b9649b173adc76f80723b8de20664ae1) Fix: avoid moving comments in implicit-arrow-linebreak (fixes #11521) (#11522) (Teddy Katz)
package/README.md CHANGED
@@ -193,12 +193,13 @@ According to our policy, any minor update may report more errors than the previo
193
193
 
194
194
  These folks keep the project moving and are resources for help.
195
195
 
196
+ <!-- NOTE: This section is autogenerated. Do not manually edit.-->
197
+ <!--teamstart-->
198
+
196
199
  ### Technical Steering Committee (TSC)
197
200
 
198
201
  The people who manage releases, review feature requests, and meet regularly to ensure ESLint is properly maintained.
199
202
 
200
- <!-- NOTE: This section is autogenerated. Do not manually edit.-->
201
- <!--tscstart-->
202
203
  <table><tbody><tr><td align="center" valign="top" width="11%">
203
204
  <a href="https://github.com/nzakas">
204
205
  <img src="https://github.com/nzakas.png?s=75" width="75" height="75"><br />
@@ -239,14 +240,15 @@ Kai Cataldo
239
240
  <img src="https://github.com/not-an-aardvark.png?s=75" width="75" height="75"><br />
240
241
  Teddy Katz
241
242
  </a>
242
- </td></tr></tbody></table><!--tscend-->
243
+ </td></tr></tbody></table>
244
+
245
+
246
+
243
247
 
244
248
  ### Committers
245
249
 
246
250
  The people who review and fix bugs and help triage issues.
247
251
 
248
- <!-- NOTE: This section is autogenerated. Do not manually edit.-->
249
- <!--committersstart-->
250
252
  <table><tbody><tr><td align="center" valign="top" width="11%">
251
253
  <a href="https://github.com/aladdin-add">
252
254
  <img src="https://github.com/aladdin-add.png?s=75" width="75" height="75"><br />
@@ -257,7 +259,10 @@ The people who review and fix bugs and help triage issues.
257
259
  <img src="https://github.com/g-plane.png?s=75" width="75" height="75"><br />
258
260
  Pig Fang
259
261
  </a>
260
- </td></tr></tbody></table><!--committersend-->
262
+ </td></tr></tbody></table>
263
+
264
+
265
+ <!--teamend-->
261
266
 
262
267
  ## Sponsors
263
268
 
package/lib/cli.js CHANGED
@@ -81,15 +81,23 @@ function translateOptions(cliOptions) {
81
81
  */
82
82
  function printResults(engine, results, format, outputFile) {
83
83
  let formatter;
84
+ let rules;
84
85
 
85
86
  try {
86
87
  formatter = engine.getFormatter(format);
88
+ rules = engine.getRules();
87
89
  } catch (e) {
88
90
  log.error(e.message);
89
91
  return false;
90
92
  }
91
93
 
92
- const output = formatter(results);
94
+ const rulesMeta = {};
95
+
96
+ rules.forEach((rule, ruleId) => {
97
+ rulesMeta[ruleId] = rule.meta;
98
+ });
99
+
100
+ const output = formatter(results, { rulesMeta });
93
101
 
94
102
  if (output) {
95
103
  if (outputFile) {
@@ -3,6 +3,6 @@
3
3
  <td class="clr-<%= severityNumber %>"><%= severityName %></td>
4
4
  <td><%- message %></td>
5
5
  <td>
6
- <a href="https://eslint.org/docs/rules/<%= ruleId %>" target="_blank" rel="noopener noreferrer"><%= ruleId %></a>
6
+ <a href="<%= ruleUrl %>" target="_blank" rel="noopener noreferrer"><%= ruleId %></a>
7
7
  </td>
8
8
  </tr>
@@ -62,9 +62,10 @@ function renderColor(totalErrors, totalWarnings) {
62
62
  * Get HTML (table rows) describing the messages.
63
63
  * @param {Array} messages Messages.
64
64
  * @param {int} parentIndex Index of the parent HTML row.
65
+ * @param {Object} rulesMeta Dictionary containing metadata for each rule executed by the analysis.
65
66
  * @returns {string} HTML (table rows) describing the messages.
66
67
  */
67
- function renderMessages(messages, parentIndex) {
68
+ function renderMessages(messages, parentIndex, rulesMeta) {
68
69
 
69
70
  /**
70
71
  * Get HTML (table row) describing a message.
@@ -74,6 +75,13 @@ function renderMessages(messages, parentIndex) {
74
75
  return lodash.map(messages, message => {
75
76
  const lineNumber = message.line || 0;
76
77
  const columnNumber = message.column || 0;
78
+ let ruleUrl;
79
+
80
+ if (rulesMeta) {
81
+ const meta = rulesMeta[message.ruleId];
82
+
83
+ ruleUrl = lodash.get(meta, "docs.url", null);
84
+ }
77
85
 
78
86
  return messageTemplate({
79
87
  parentIndex,
@@ -82,33 +90,37 @@ function renderMessages(messages, parentIndex) {
82
90
  severityNumber: message.severity,
83
91
  severityName: message.severity === 1 ? "Warning" : "Error",
84
92
  message: message.message,
85
- ruleId: message.ruleId
93
+ ruleId: message.ruleId,
94
+ ruleUrl
86
95
  });
87
96
  }).join("\n");
88
97
  }
89
98
 
90
99
  /**
91
100
  * @param {Array} results Test results.
101
+ * @param {Object} rulesMeta Dictionary containing metadata for each rule executed by the analysis.
92
102
  * @returns {string} HTML string describing the results.
93
103
  */
94
- function renderResults(results) {
104
+ function renderResults(results, rulesMeta) {
95
105
  return lodash.map(results, (result, index) => resultTemplate({
96
106
  index,
97
107
  color: renderColor(result.errorCount, result.warningCount),
98
108
  filePath: result.filePath,
99
109
  summary: renderSummary(result.errorCount, result.warningCount)
100
110
 
101
- }) + renderMessages(result.messages, index)).join("\n");
111
+ }) + renderMessages(result.messages, index, rulesMeta)).join("\n");
102
112
  }
103
113
 
104
114
  //------------------------------------------------------------------------------
105
115
  // Public Interface
106
116
  //------------------------------------------------------------------------------
107
117
 
108
- module.exports = function(results) {
118
+ module.exports = function(results, data) {
109
119
  let totalErrors,
110
120
  totalWarnings;
111
121
 
122
+ const metaData = data ? data.rulesMeta : {};
123
+
112
124
  totalErrors = 0;
113
125
  totalWarnings = 0;
114
126
 
@@ -122,6 +134,6 @@ module.exports = function(results) {
122
134
  date: new Date(),
123
135
  reportColor: renderColor(totalErrors, totalWarnings),
124
136
  reportSummary: renderSummary(totalErrors, totalWarnings),
125
- results: renderResults(results)
137
+ results: renderResults(results, metaData)
126
138
  });
127
139
  };
@@ -0,0 +1,16 @@
1
+ /**
2
+ * @fileoverview JSON reporter, including rules metadata
3
+ * @author Chris Meyer
4
+ */
5
+ "use strict";
6
+
7
+ //------------------------------------------------------------------------------
8
+ // Public Interface
9
+ //------------------------------------------------------------------------------
10
+
11
+ module.exports = function(results, data) {
12
+ return JSON.stringify({
13
+ results,
14
+ metadata: data
15
+ });
16
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eslint",
3
- "version": "5.15.3",
3
+ "version": "5.16.0",
4
4
  "author": "Nicholas C. Zakas <nicholas+npm@nczconsulting.com>",
5
5
  "description": "An AST-based pattern checker for JavaScript.",
6
6
  "bin": {
@@ -55,7 +55,7 @@
55
55
  "import-fresh": "^3.0.0",
56
56
  "imurmurhash": "^0.1.4",
57
57
  "inquirer": "^6.2.2",
58
- "js-yaml": "^3.12.0",
58
+ "js-yaml": "^3.13.0",
59
59
  "json-stable-stringify-without-jsonify": "^1.0.1",
60
60
  "levn": "^0.3.0",
61
61
  "lodash": "^4.17.11",
@@ -92,7 +92,6 @@
92
92
  "eslint-release": "^1.2.0",
93
93
  "eslump": "^2.0.0",
94
94
  "esprima": "^4.0.1",
95
- "istanbul": "^0.4.5",
96
95
  "jsdoc": "^3.5.5",
97
96
  "karma": "^3.1.4",
98
97
  "karma-chrome-launcher": "^2.2.0",
@@ -105,6 +104,7 @@
105
104
  "mocha": "^5.0.5",
106
105
  "mock-fs": "^4.8.0",
107
106
  "npm-license": "^0.3.3",
107
+ "nyc": "^13.3.0",
108
108
  "proxyquire": "^2.0.1",
109
109
  "puppeteer": "^1.12.2",
110
110
  "shelljs": "^0.8.2",