Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Require key for conditionally rendered repeated components #2280

Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
76ae5c7
create rule
felipemelendez Aug 28, 2023
11769be
create tests
felipemelendez Aug 28, 2023
7899246
add docs
felipemelendez Aug 28, 2023
a02a577
fix spacing
felipemelendez Aug 28, 2023
b7a7cbb
slots are abstract outlets and can possibly expand into multiple elem…
felipemelendez Aug 28, 2023
17323fa
add test for slot exclusion
felipemelendez Aug 28, 2023
a5d7879
use more efficient Set rather than Array
felipemelendez Aug 28, 2023
308e2a1
change vue 3 to vue 2
felipemelendez Aug 28, 2023
0daeb91
target custom components
felipemelendez Oct 25, 2023
c4871c6
rename
felipemelendez Oct 25, 2023
4aac97a
Merge branch 'master' into require-key-for-conditionally-rendered-rep…
felipemelendez Oct 25, 2023
88d57d4
proper name updating
felipemelendez Oct 25, 2023
4515954
Merge remote-tracking branch 'origin/require-key-for-conditionally-re…
felipemelendez Oct 25, 2023
c659339
removed references to html container elements
felipemelendez Oct 27, 2023
c89efd8
added test
felipemelendez Oct 27, 2023
1f81ded
Merge branch 'master' into require-key-for-conditionally-rendered-rep…
felipemelendez Oct 27, 2023
d1b5039
add valid test case
felipemelendez Oct 27, 2023
fdd59a5
add Related rule link to require-v-for-key and vice-versa
felipemelendez Oct 27, 2023
92bdc2f
remove md extension from brackets
felipemelendez Oct 27, 2023
3212653
turned off formatting settings so I can submit this - changing the th…
felipemelendez Oct 27, 2023
1206bbd
make if attribute required and finetune docstrings
felipemelendez Nov 1, 2023
8da18db
fix type
felipemelendez Nov 20, 2023
a8709d7
fix condition
felipemelendez Nov 20, 2023
f039fb7
use double quotes
felipemelendez Nov 20, 2023
2ff3a5f
fix conditional family completeness logic and add test
felipemelendez Nov 20, 2023
608b4b9
reform helper function - exists only to ease code readability
felipemelendez Nov 21, 2023
42500ce
inline logic for conditional family formation
felipemelendez Nov 21, 2023
51cef47
match test file name with rule name
felipemelendez Nov 29, 2023
e6d5c92
move conditionalFamilies map into create function
felipemelendez Nov 29, 2023
ceab4c3
Merge branch 'master' into require-key-for-conditionally-rendered-rep…
felipemelendez Nov 29, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions docs/rules/require-v-for-key.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ title: vue/require-v-for-key
description: require `v-bind:key` with `v-for` directives
since: v3.0.0
---

# vue/require-v-for-key

> require `v-bind:key` with `v-for` directives
Expand All @@ -20,12 +21,9 @@ This rule reports the elements which have `v-for` and do not have `v-bind:key` w
```vue
<template>
<!-- ✓ GOOD -->
<div
v-for="todo in todos"
:key="todo.id"
/>
<div v-for="todo in todos" :key="todo.id" />
<!-- ✗ BAD -->
<div v-for="todo in todos"/>
<div v-for="todo in todos" />
</template>
```

Expand All @@ -43,8 +41,10 @@ Nothing.
## :couple: Related Rules

- [vue/valid-v-for]
- [vue/v-if-else-key]

[vue/valid-v-for]: ./valid-v-for.md
[vue/v-if-else-key]: ./v-if-else-key.md

## :books: Further Reading

Expand Down
9 changes: 8 additions & 1 deletion docs/rules/v-if-else-key.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,12 @@ sidebarDepth: 0
title: vue/v-if-else-key
description: require key attribute for conditionally rendered repeated components
---

# vue/v-if-else-key

> require key attribute for conditionally rendered repeated components

- :exclamation: <badge text="This rule has not been released yet." vertical="middle" type="error"> ***This rule has not been released yet.*** </badge>
- :exclamation: <badge text="This rule has not been released yet." vertical="middle" type="error"> **_This rule has not been released yet._** </badge>
felipemelendez marked this conversation as resolved.
Show resolved Hide resolved
- :wrench: The `--fix` option on the [command line](https://eslint.org/docs/user-guide/command-line-interface#fixing-problems) can automatically fix some of the problems reported by this rule.

## :book: Rule Details
Expand Down Expand Up @@ -39,6 +40,12 @@ This rule is not required in Vue 3, as the key is automatically assigned to the

Nothing.

## :couple: Related Rules

- [vue/require-v-for-key.md]

[vue/require-v-for-key]: ./require-v-for-key.md

## :books: Further Reading
FloEdelmann marked this conversation as resolved.
Show resolved Hide resolved

- [Guide (for v2) - v-if without key](https://v2.vuejs.org/v2/style-guide/#v-if-v-else-if-v-else-without-key-use-with-caution)
Expand Down