eslint 3.17.0 → 3.17.1

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,11 @@
1
+ v3.17.1 - March 6, 2017
2
+
3
+ * f8c8e6e Build: change mock-fs path without SSH (fixes #8207) (#8208) (Toru Nagashima)
4
+ * f713f11 Fix: nonblock-statement-body-position multiline error (fixes #8202) (#8203) (Teddy Katz)
5
+ * 41e3d9c Fix: `operator-assignment` with parenthesized expression (fixes #8190) (#8197) (alberto)
6
+ * 5e3bca7 Chore: add eslint-plugin-eslint-plugin (#8198) (Teddy Katz)
7
+ * 580da36 Chore: add missing `output` property to tests (#8195) (alberto)
8
+
1
9
  v3.17.0 - March 3, 2017
2
10
 
3
11
  * 4fdf6d7 Update: deprecate `applyDefaultPatterns` in `line-comment-position` (#8183) (alberto)
@@ -94,16 +94,6 @@ function hasMetaSchema(metaPropertyNode) {
94
94
  return getPropertyFromObject("schema", metaPropertyNode.value);
95
95
  }
96
96
 
97
- /**
98
- * Whether this `meta` ObjectExpression has a `fixable` property defined or not.
99
- *
100
- * @param {ASTNode} metaPropertyNode The `meta` ObjectExpression for this rule.
101
- * @returns {boolean} `true` if a `fixable` property exists.
102
- */
103
- function hasMetaFixable(metaPropertyNode) {
104
- return getPropertyFromObject("fixable", metaPropertyNode.value);
105
- }
106
-
107
97
  /**
108
98
  * Checks the validity of the meta definition of this rule and reports any errors found.
109
99
  *
@@ -112,7 +102,7 @@ function hasMetaFixable(metaPropertyNode) {
112
102
  * @param {boolean} ruleIsFixable whether the rule is fixable or not.
113
103
  * @returns {void}
114
104
  */
115
- function checkMetaValidity(context, exportsNode, ruleIsFixable) {
105
+ function checkMetaValidity(context, exportsNode) {
116
106
  const metaProperty = getMetaPropertyFromExportsNode(exportsNode);
117
107
 
118
108
  if (!metaProperty) {
@@ -142,11 +132,6 @@ function checkMetaValidity(context, exportsNode, ruleIsFixable) {
142
132
 
143
133
  if (!hasMetaSchema(metaProperty)) {
144
134
  context.report(metaProperty, "Rule is missing a meta.schema property.");
145
- return;
146
- }
147
-
148
- if (ruleIsFixable && !hasMetaFixable(metaProperty)) {
149
- context.report(metaProperty, "Rule is fixable, but is missing a meta.fixable property.");
150
135
  }
151
136
  }
152
137
 
@@ -177,7 +162,6 @@ module.exports = {
177
162
 
178
163
  create(context) {
179
164
  let exportsNode;
180
- let ruleIsFixable = false;
181
165
 
182
166
  return {
183
167
  AssignmentExpression(node) {
@@ -191,35 +175,13 @@ module.exports = {
191
175
  }
192
176
  },
193
177
 
194
- CallExpression(node) {
195
-
196
- // If the rule has a call for `context.report` and a property `fix`
197
- // is being passed in, then we consider that the rule is fixable.
198
- //
199
- // Note that we only look for context.report() calls in the new
200
- // style (with single MessageDescriptor argument), because only
201
- // calls in the new style can specify a fix.
202
- if (node.callee.type === "MemberExpression" &&
203
- node.callee.object.type === "Identifier" &&
204
- node.callee.object.name === "context" &&
205
- node.callee.property.type === "Identifier" &&
206
- node.callee.property.name === "report" &&
207
- node.arguments.length === 1 &&
208
- node.arguments[0].type === "ObjectExpression") {
209
-
210
- if (getPropertyFromObject("fix", node.arguments[0])) {
211
- ruleIsFixable = true;
212
- }
213
- }
214
- },
215
-
216
178
  "Program:exit"() {
217
179
  if (!isCorrectExportsFormat(exportsNode)) {
218
180
  context.report({ node: exportsNode, message: "Rule does not export an Object. Make sure the rule follows the new rule format." });
219
181
  return;
220
182
  }
221
183
 
222
- checkMetaValidity(context, exportsNode, ruleIsFixable);
184
+ checkMetaValidity(context, exportsNode);
223
185
  }
224
186
  };
225
187
  }
@@ -74,7 +74,8 @@ module.exports = {
74
74
  } catch (e) {
75
75
  context.report({
76
76
  node,
77
- message: `${e.message}.`
77
+ message: "{{message}}.",
78
+ data: e
78
79
  });
79
80
  }
80
81
 
@@ -109,6 +109,7 @@ module.exports = {
109
109
  if (matchedObjectProperty) {
110
110
  const message = matchedObjectProperty.message ? ` ${matchedObjectProperty.message}` : "";
111
111
 
112
+ // eslint-disable-next-line eslint-plugin/report-message-format
112
113
  context.report({ node, message: "'{{objectName}}.{{propertyName}}' is restricted from being used.{{message}}", data: {
113
114
  objectName,
114
115
  propertyName,
@@ -117,6 +118,7 @@ module.exports = {
117
118
  } else if (globalMatchedProperty) {
118
119
  const message = globalMatchedProperty.message ? ` ${globalMatchedProperty.message}` : "";
119
120
 
121
+ // eslint-disable-next-line eslint-plugin/report-message-format
120
122
  context.report({ node, message: "'{{propertyName}}' is restricted from being used.{{message}}", data: {
121
123
  propertyName,
122
124
  message
@@ -19,7 +19,7 @@ module.exports = {
19
19
  category: "Best Practices",
20
20
  recommended: false // TODO: set to true
21
21
  },
22
- fixable: false,
22
+ fixable: null,
23
23
  schema: [
24
24
  ]
25
25
  },
@@ -77,7 +77,7 @@ module.exports = {
77
77
  message: "Expected a linebreak before this statement.",
78
78
  fix: fixer => fixer.insertTextBefore(node, "\n")
79
79
  });
80
- } else if (tokenBefore.loc.end.line !== node.loc.end.line && option === "beside") {
80
+ } else if (tokenBefore.loc.end.line !== node.loc.start.line && option === "beside") {
81
81
  context.report({
82
82
  node,
83
83
  message: "Expected no linebreak before this statement.",
@@ -368,11 +368,12 @@ module.exports = {
368
368
  // Checks for property/method shorthand.
369
369
  if (isConciseProperty) {
370
370
  if (node.method && (APPLY_NEVER || AVOID_QUOTES && isStringLiteral(node.key))) {
371
+ const message = APPLY_NEVER ? "Expected longform method syntax." : "Expected longform method syntax for string literal keys.";
371
372
 
372
373
  // { x() {} } should be written as { x: function() {} }
373
374
  context.report({
374
375
  node,
375
- message: `Expected longform method syntax${APPLY_NEVER ? "" : " for string literal keys"}.`,
376
+ message,
376
377
  fix: fixer => makeFunctionLongform(fixer, node)
377
378
  });
378
379
  } else if (APPLY_NEVER) {
@@ -135,7 +135,7 @@ module.exports = {
135
135
  const equalsToken = getOperatorToken(node);
136
136
  const operatorToken = getOperatorToken(expr);
137
137
  const leftText = sourceCode.getText().slice(node.range[0], equalsToken.range[0]);
138
- const rightText = sourceCode.getText().slice(operatorToken.range[1], node.range[1]);
138
+ const rightText = sourceCode.getText().slice(operatorToken.range[1], expr.right.range[1]);
139
139
 
140
140
  return fixer.replaceText(node, `${leftText}${expr.operator}=${rightText}`);
141
141
  }
@@ -89,7 +89,7 @@ module.exports = {
89
89
  * @returns {void}
90
90
  */
91
91
  function report(reportNode, type) {
92
- context.report({ node: reportNode, message: `Use ${type} destructuring` });
92
+ context.report({ node: reportNode, message: "Use {{type}} destructuring.", data: { type } });
93
93
  }
94
94
 
95
95
  /**
package/lib/rules/yoda.js CHANGED
@@ -267,8 +267,8 @@ module.exports = {
267
267
  const operatorToken = sourceCode.getFirstTokenBetween(node.left, node.right, token => token.value === node.operator);
268
268
  const textBeforeOperator = sourceCode.getText().slice(sourceCode.getTokenBefore(operatorToken).range[1], operatorToken.range[0]);
269
269
  const textAfterOperator = sourceCode.getText().slice(operatorToken.range[1], sourceCode.getTokenAfter(operatorToken).range[0]);
270
- const leftText = sourceCode.getText().slice(sourceCode.getFirstToken(node).range[0], sourceCode.getTokenBefore(operatorToken).range[1]);
271
- const rightText = sourceCode.getText().slice(sourceCode.getTokenAfter(operatorToken).range[0], sourceCode.getLastToken(node).range[1]);
270
+ const leftText = sourceCode.getText().slice(node.range[0], sourceCode.getTokenBefore(operatorToken).range[1]);
271
+ const rightText = sourceCode.getText().slice(sourceCode.getTokenAfter(operatorToken).range[0], node.range[1]);
272
272
 
273
273
  return rightText + textBeforeOperator + OPERATOR_FLIP_MAP[operatorToken.value] + textAfterOperator + leftText;
274
274
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eslint",
3
- "version": "3.17.0",
3
+ "version": "3.17.1",
4
4
  "author": "Nicholas C. Zakas <nicholas+npm@nczconsulting.com>",
5
5
  "description": "An AST-based pattern checker for JavaScript.",
6
6
  "bin": {
@@ -81,6 +81,7 @@
81
81
  "coveralls": "^2.11.16",
82
82
  "dateformat": "^1.0.8",
83
83
  "ejs": "^2.3.3",
84
+ "eslint-plugin-eslint-plugin": "^0.7.1",
84
85
  "eslint-plugin-node": "^4.1.0",
85
86
  "eslint-release": "^0.10.0",
86
87
  "esprima": "^2.4.1",
@@ -96,7 +97,7 @@
96
97
  "load-perf": "^0.2.0",
97
98
  "markdownlint": "^0.3.1",
98
99
  "mocha": "^2.4.5",
99
- "mock-fs": "git://github.com/not-an-aardvark/mock-fs/#06868bbd7724707f9324b237bdde28f05f7a01d5",
100
+ "mock-fs": "not-an-aardvark/mock-fs#06868bbd7724707f9324b237bdde28f05f7a01d5",
100
101
  "npm-license": "^0.3.2",
101
102
  "phantomjs-prebuilt": "^2.1.7",
102
103
  "proxyquire": "^1.7.10",