diff --git a/docs/rules/v-for-delimiter-style.md b/docs/rules/v-for-delimiter-style.md
index 7239ef0..486de70 100644
--- a/docs/rules/v-for-delimiter-style.md
+++ b/docs/rules/v-for-delimiter-style.md
@@ -34,12 +34,13 @@ Default is set to `in`.
```json
{
- "vue/v-for-delimiter-style": ["error", "in" | "of"]
+ "vue/v-for-delimiter-style": ["error", "in" | "of" | "contextual"]
}
```
- `"in"` (default) ... requires using `in`.
- `"of"` ... requires using `of`.
+- `"contextual"` ... requires using `in` when looping through object entries, and `of` for arrays.
### `"of"`
@@ -55,6 +56,31 @@ Default is set to `in`.
```
+### `"contextual"`
+
+
+
+```vue
+
+
+
+
+
+
+
+
+
+
+
+```
+
## :books: Further Reading
diff --git a/tests/lib/rules/v-for-delimiter-style.js b/tests/lib/rules/v-for-delimiter-style.js
index 4b232a2..e6ebdaa 100644
--- a/tests/lib/rules/v-for-delimiter-style.js
+++ b/tests/lib/rules/v-for-delimiter-style.js
@@ -53,6 +53,38 @@ tester.run('v-for-delimiter-style', rule, {
filename: 'test.vue',
code: '',
options: ['of']
+ },
+ {
+ filename: 'test.vue',
+ code: '',
+ options: ['contextual']
+ },
+ {
+ filename: 'test.vue',
+ code: '',
+ options: ['contextual']
+ },
+ {
+ filename: 'test.vue',
+ code: `
+
+ `,
+ options: ['contextual']
+ },
+ {
+ filename: 'test.vue',
+ code: `
+
+ `,
+ options: ['contextual']
}
],
invalid: [
@@ -123,6 +155,54 @@ tester.run('v-for-delimiter-style', rule, {
column: 23
}
]
+ },
+ {
+ filename: 'test.vue',
+ options: ['contextual'],
+ code: `
+
+ `,
+ output: `
+
+ `,
+ errors: [
+ {
+ message: "Expected 'of' instead of 'in' in 'v-for'.",
+ column: 23
+ }
+ ]
+ },
+ {
+ filename: 'test.vue',
+ options: ['contextual'],
+ code: `
+
+ `,
+ output: `
+
+ `,
+ errors: [
+ {
+ message: "Expected 'in' instead of 'of' in 'v-for'.",
+ column: 23
+ }
+ ]
}
]
})