Repository: eslint/eslint (JavaScript)

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


Discussion:
I have the same problem. Right now I'm using an ugly workaround:
```jsx
        <div
          className={
            'flex-100 layout-row layout-wrap ' +
            'layout-align-space-between-center input_box_full'
          }
        >
          <input type="text" value={editor.city} name="city" onChange={this.handleChange} />
        </div>
```

As you can see, it's very ugly and distracting/confusing
Working on this



Patch:
diff --git a/lib/rules/max-len.js b/lib/rules/max-len.js
index 35ac803b65e0..5a6eaa72f1eb 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")));
         }
 
         /**


Test patch:
diff --git a/tests/lib/rules/max-len.js b/tests/lib/rules/max-len.js
index 4180a887950b..caa5f3d56398 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
         {