Repository: vuejs/eslint-plugin-vue (JavaScript)

Issue:
Do not indentation on the contents of `<textarea>`
<!--
  Before posting the issue, please confirm that the problem you're getting
  is not related with your code editor configuration.
  To make sure it's not, run: yarn eslint src/your-file.vue
-->

**Tell us about your environment**	
* **ESLint version:**	5.2.0
* **eslint-plugin-vue version:**	5.0.0-beta.5
* **Node version:**	 v10.13.0

**Please show your full configuration:**
<!-- Paste content of your .eslintrc file -->
```json
{
  "rules": {
    "vue/html-indent": "error"
  }
}
```

**What did you do?**	
<!-- Please include the actual source code causing the issue. -->
```vue
<template>
  <textarea>
a
b</textarea>
</template>
```

**What did you expect to happen?**

Do not report indentation errors on the contents of `<textarea>`.

**What actually happened?**
<!-- Please include the actual, raw output from ESLint. -->

```
Expected indentation of 4 spaces but found 0 spaces. [vue/html-indent] (3, 1)
Expected indentation of 4 spaces but found 0 spaces. [vue/html-indent] (4, 1)
```



Discussion:

Patch:
diff --git a/lib/utils/indent-common.js b/lib/utils/indent-common.js
index 6e92b4912..893335569 100644
--- a/lib/utils/indent-common.js
+++ b/lib/utils/indent-common.js
@@ -19,6 +19,7 @@ const LT_CHAR = /[\r\n\u2028\u2029]/
 const LINES = /[^\r\n\u2028\u2029]+(?:$|\r\n|[\r\n\u2028\u2029])/g
 const BLOCK_COMMENT_PREFIX = /^\s*\*/
 const ITERATION_OPTS = Object.freeze({ includeComments: true, filter: isNotWhitespace })
+const PREFORMATTED_ELEMENT_NAMES = ['pre', 'textarea']
 
 /**
  * Normalize options.
@@ -324,6 +325,7 @@ module.exports.defineVisitor = function create (context, tokenStore, defaultOpti
       includeComments: true,
       filter: token => token != null && (
         token.type === 'HTMLText' ||
+        token.type === 'HTMLRCDataText' ||
         token.type === 'HTMLTagOpen' ||
         token.type === 'HTMLEndTagOpen' ||
         token.type === 'HTMLComment'
@@ -881,7 +883,7 @@ module.exports.defineVisitor = function create (context, tokenStore, defaultOpti
     },
 
     VElement (node) {
-      if (node.name !== 'pre') {
+      if (!PREFORMATTED_ELEMENT_NAMES.includes(node.name)) {
         const isTopLevel = node.parent.type !== 'VElement'
         const offset = isTopLevel ? options.baseIndent : 1
         processNodeList(node.children.filter(isNotEmptyTextNode), node.startTag, node.endTag, offset)


Test patch:
diff --git a/tests/lib/rules/html-indent.js b/tests/lib/rules/html-indent.js
index e8a229699..724ee961f 100644
--- a/tests/lib/rules/html-indent.js
+++ b/tests/lib/rules/html-indent.js
@@ -269,7 +269,7 @@ tester.run('html-indent', rule, loadPatterns(
       }]
     },
 
-    // Pre
+    // Pre, Textarea
     {
       filename: 'test.vue',
       code: unIndent`
@@ -282,6 +282,18 @@ tester.run('html-indent', rule, loadPatterns(
         </template>
       `
     },
+    {
+      filename: 'test.vue',
+      code: unIndent`
+        <template>
+          <textarea>
+        aaa
+          bbb
+            ccc
+          </textarea>
+        </template>
+      `
+    },
     {
       filename: 'test.vue',
       code: unIndent`
@@ -327,6 +339,17 @@ tester.run('html-indent', rule, loadPatterns(
         </template>
       `
     },
+    {
+      filename: 'test.vue',
+      code: unIndent`
+        <template>
+          <div><textarea>aaa
+        bbb ccc
+        ddd
+        fff</textarea></div>
+        </template>
+      `
+    },
     {
       filename: 'test.vue',
       code: unIndent`
@@ -619,7 +642,7 @@ tester.run('html-indent', rule, loadPatterns(
       ]
     },
 
-    // Pre
+    // Pre, Textarea
     {
       filename: 'test.vue',
       code: unIndent`
@@ -668,19 +691,61 @@ tester.run('html-indent', rule, loadPatterns(
         </template>
       `,
       output: unIndent`
-      <template>
-        <pre
-          :class="[
-            'a',
-            'b',
-            'c'
-          ]"
+        <template>
+          <pre
+            :class="[
+              'a',
+              'b',
+              'c'
+            ]"
+          >
+        aaa
+        bbb
+        ccc
+        </pre>
+        </template>
+      `,
+      errors: [
+        { message: 'Expected indentation of 2 spaces but found 0 spaces.', line: 2 },
+        { message: 'Expected indentation of 4 spaces but found 0 spaces.', line: 3 },
+        { message: 'Expected indentation of 6 spaces but found 0 spaces.', line: 4 },
+        { message: 'Expected indentation of 6 spaces but found 0 spaces.', line: 5 },
+        { message: 'Expected indentation of 6 spaces but found 0 spaces.', line: 6 },
+        { message: 'Expected indentation of 4 spaces but found 0 spaces.', line: 7 },
+        { message: 'Expected indentation of 2 spaces but found 0 spaces.', line: 8 }
+      ]
+    },
+    {
+      filename: 'test.vue',
+      code: unIndent`
+        <template>
+        <textarea
+        :class="[
+        'a',
+        'b',
+        'c'
+        ]"
         >
-      aaa
-      bbb
-      ccc
-      </pre>
-      </template>
+        aaa
+        bbb
+        ccc
+        </textarea>
+        </template>
+      `,
+      output: unIndent`
+        <template>
+          <textarea
+            :class="[
+              'a',
+              'b',
+              'c'
+            ]"
+          >
+        aaa
+        bbb
+        ccc
+        </textarea>
+        </template>
       `,
       errors: [
         { message: 'Expected indentation of 2 spaces but found 0 spaces.', line: 2 },