Repository: eslint/eslint (js)

Issue:
`max-len` `ignoreStrings` does not ignore jsx prop strings
**Tell us about your environment**

* **ESLint Version:** v4.16.0
* **Node Version:** v8.9.1
* **npm Version:** v5.6.0

**What parser (default, Babel-ESLint, etc.) are you using?**
default

**Please show your full configuration:**

<details>
<summary>Configuration</summary>

<!-- Paste your configuration below: -->
```json
{
  "rules": {
    "max-len": [2, { "code": 5", "ignoreStrings": true }],
  },
}
```

</details>

**What did you do? Please include the actual source code causing the issue, as well as the command that you used to run ESLint.**

<!-- Paste the source code below: -->
```js
<input placeholder="something long" />
```

<!-- Paste the command you used to run ESLint: -->
```bash
eslint foo.js
```

**What did you expect to happen?**
No error.

**What actually happened? Please include the actual, raw output from ESLint.**
 1:1  error  Line 1 exceeds the maximum line length of 5  max-len

Pull request:
Fix: Make max-len ignoreStrings ignore JSXText (fixes #9954)
<!--
    ESLint adheres to the [JS Foundation Code of Conduct](https://js.foundation/community/code-of-conduct).
-->

**What is the purpose of this pull request? (put an "X" next to item)**

[ ] Documentation update
[x] Bug fix ([template](https://raw.githubusercontent.com/eslint/eslint/master/templates/bug-report.md))
[ ] New rule ([template](https://raw.githubusercontent.com/eslint/eslint/master/templates/rule-proposal.md))
[ ] Changes an existing rule ([template](https://raw.githubusercontent.com/eslint/eslint/master/templates/rule-change-proposal.md))
[ ] Add autofixing to a rule
[ ] Add a CLI option
[ ] Add something to the core
[ ] Other, please explain:


<!--
    If the item you've checked above has a template, please paste the template questions below and answer them. (If this pull request is addressing an issue, you can just paste a link to the issue here instead.)
-->

Fixes #9954.

<!--
    Please ensure your pull request is ready:

    - Read the pull request guide (https://eslint.org/docs/developer-guide/contributing/pull-requests)
    - Include tests for this change
    - Update documentation for this change (if appropriate)
-->

<!--
    The following is required for all pull requests:
-->

**What changes did you make? (Give an overview)**
Previously, `getAllStrings` only filter for tokens with type `String`. The filter should check if the token type is `JSXText` as well.


**Is there anything you'd like reviewers to focus on?**
Nothing in particular.



Patch:
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 3e64de426..a65976979 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,3 +1,9 @@
+v4.18.1 - February 20, 2018
+
+* f417506 Fix: ensure no-await-in-loop reports the correct node (fixes #9992) (#9993) (Teddy Katz)
+* 3e99363 Docs: Fixed typo in key-spacing rule doc (#9987) (Jaid)
+* 7c2cd70 Docs: deprecate experimentalObjectRestSpread (#9986) (Toru Nagashima)
+
 v4.18.0 - February 16, 2018
 
 * 70f22f3 Chore: Apply memoization to config creation within glob utils (#9944) (Kenton Jacobsen)
diff --git a/docs/rules/key-spacing.md b/docs/rules/key-spacing.md
index 6e2b90541..c94b11f6d 100644
--- a/docs/rules/key-spacing.md
+++ b/docs/rules/key-spacing.md
@@ -16,7 +16,7 @@ This rule has an object option:
 * `"afterColon": true (default) | false`
     * `true`: requires at least one space between the colon and the value in object literals.
     * `false`: disallows spaces between the colon and the value in object literals.
-* `"mode": "strict" (default) | "miniumum"`
+* `"mode": "strict" (default) | "minimum"`
     * `"strict"`: enforces exactly one space before or after colons in object literals.
     * `"minimum"`: enforces one or more spaces before or after colons in object literals.
 * `"align": "value" | "colon"`
diff --git a/docs/user-guide/configuring.md b/docs/user-guide/configuring.md
index 5d4f93d55..49d6f8149 100644
--- a/docs/user-guide/configuring.md
+++ b/docs/user-guide/configuring.md
@@ -32,7 +32,6 @@ Parser options are set in your `.eslintrc.*` file by using the `parserOptions` p
     * `globalReturn` - allow `return` statements in the global scope
     * `impliedStrict` - enable global [strict mode](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Strict_mode) (if `ecmaVersion` is 5 or greater)
     * `jsx` - enable [JSX](https://facebook.github.io/jsx/)
-    * `experimentalObjectRestSpread` - enable support for the experimental [object rest/spread properties](https://github.com/tc39/proposal-object-rest-spread) (**IMPORTANT:** This is an experimental feature that may change significantly in the future. It's recommended that you do *not* write rules relying on this functionality unless you are willing to incur maintenance cost when it changes.)
 
 Here's an example `.eslintrc.json` file:
 
@@ -53,6 +52,10 @@ Here's an example `.eslintrc.json` file:
 
 Setting parser options helps ESLint determine what is a parsing error. All language options are `false` by default.
 
+### Deprecated
+
+* `ecmaFeatures.experimentalObjectRestSpread` - enable support for the experimental [object rest/spread properties](https://github.com/tc39/proposal-object-rest-spread). This syntax has been supported in `ecmaVersion: 2018`. This option will be removed in the future.
+
 ## Specifying Parser
 
 By default, ESLint uses [Espree](https://github.com/eslint/espree) as its parser. You can optionally specify that a different parser should be used in your configuration file so long as the parser meets the following requirements:
diff --git a/lib/rules/max-len.js b/lib/rules/max-len.js
index 35ac803b6..5a6eaa72f 100644
--- a/lib/rules/max-len.js
+++ b/lib/rules/max-len.js
@@ -213,7 +213,8 @@ module.exports = {
          * @returns {ASTNode[]} An array of string nodes.
          */
         function getAllStrings() {
-            return sourceCode.ast.tokens.filter(token => token.type === "String");
+            return sourceCode.ast.tokens.filter(token => (token.type === "String" ||
+                (token.type === "JSXText" && sourceCode.getNodeByRangeIndex(token.range[0] - 1).type === "JSXAttribute")));
         }
 
         /**
diff --git a/lib/rules/no-await-in-loop.js b/lib/rules/no-await-in-loop.js
index d0a2a5893..ef0bda90b 100644
--- a/lib/rules/no-await-in-loop.js
+++ b/lib/rules/no-await-in-loop.js
@@ -84,7 +84,7 @@ module.exports = {
             while (parent && !isBoundary(parent)) {
                 if (isLooped(node, parent)) {
                     context.report({
-                        node,
+                        node: awaitNode,
                         messageId: "unexpectedAwait"
                     });
                     return;
diff --git a/package.json b/package.json
index a6c107111..fb4cf8397 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
 {
   "name": "eslint",
-  "version": "4.18.0",
+  "version": "4.18.1",
   "author": "Nicholas C. Zakas <nicholas+npm@nczconsulting.com>",
   "description": "An AST-based pattern checker for JavaScript.",
   "bin": {


Test patch:
diff --git a/tests/lib/rules/max-len.js b/tests/lib/rules/max-len.js
index 4180a8879..caa5f3d56 100644
--- a/tests/lib/rules/max-len.js
+++ b/tests/lib/rules/max-len.js
@@ -109,6 +109,11 @@ ruleTester.run("max-len", rule, {
             code: "var str = \"this is a very long string\\\nwith continuation\\\nand with another very very long continuation\\\nand ending\";",
             options: [29, 4, { ignoreStrings: true }]
         },
+        {
+            code: "var foo = <div className=\"this is a very long string\"></div>;",
+            options: [29, 4, { ignoreStrings: true }],
+            parserOptions: { ecmaFeatures: { jsx: true } }
+        },
         {
             code: "var foo = veryLongIdentifier;\nvar bar = `this is a very long string`;",
             options: [29, 4, { ignoreTemplateLiterals: true }],
@@ -553,6 +558,19 @@ ruleTester.run("max-len", rule, {
                 }
             ]
         },
+        {
+            code: "var foo = <div>this is a very very very long string</div>;",
+            options: [29, 4, { ignoreStrings: true }],
+            parserOptions: { ecmaFeatures: { jsx: true } },
+            errors: [
+                {
+                    message: "Line 1 exceeds the maximum line length of 29.",
+                    type: "Program",
+                    line: 1,
+                    column: 1
+                }
+            ]
+        },
 
         // Multi-code-point unicode glyphs
         {
diff --git a/tests/lib/rules/no-await-in-loop.js b/tests/lib/rules/no-await-in-loop.js
index 057223879..fcb6db061 100644
--- a/tests/lib/rules/no-await-in-loop.js
+++ b/tests/lib/rules/no-await-in-loop.js
@@ -8,7 +8,7 @@
 const rule = require("../../../lib/rules/no-await-in-loop"),
     RuleTester = require("../../../lib/testers/rule-tester");
 
-const error = { messageId: "unexpectedAwait" };
+const error = { messageId: "unexpectedAwait", type: "AwaitExpression" };
 
 const ruleTester = new RuleTester({ parserOptions: { ecmaVersion: 2018 } });
 
@@ -46,7 +46,10 @@ ruleTester.run("no-await-in-loop", rule, {
         // While loops
         { code: "async function foo() { while (baz) { await bar; } }", errors: [error] },
         { code: "async function foo() { while (await foo()) {  } }", errors: [error] },
-        { code: "async function foo() { while (baz) { for await (x of xs); } }", errors: [error] },
+        {
+            code: "async function foo() { while (baz) { for await (x of xs); } }",
+            errors: [Object.assign({}, error, { type: "ForOfStatement" })]
+        },
 
         // For of loops
         { code: "async function foo() { for (var bar of baz) { await bar; } }", errors: [error] },