-
-
Notifications
You must be signed in to change notification settings - Fork 681
⭐️New: Add vue/no-use-v-if-with-v-for
rule
#406
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
⭐️New: Add vue/no-use-v-if-with-v-for
rule
#406
Conversation
* [Update] Make `vue/max-attributes-per-line` fixable * [fix] bug and style * [fix] Switch indent calculation method with node and attribute * [fix] don't handle indentation * [add] autofix test max-attributes-per-line.js
* [Update] Make `vue/order-in-components` fixable This Commit makes `vue/order-in-components` fixable. In case of `The "A" property should be above the "B" property` error, autofix will move A before B * [fix] fail test at [email protected] * [fix] If there is a possibility of a side effect, don't autofix * [fix] failed test at node v4 * [update] use Traverser * [fix] failed test [email protected] * [fix] I used `output: null` to specify "not fix"
}] | ||
``` | ||
|
||
:+1: Examples of additional **correct** code for this rule with sample `"allowUsingIterationVar": true` options: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess this is supposed to be incorrect
right?
/> | ||
``` | ||
|
||
:-1: Examples of additional **incorrect** code for this rule with sample `"allowUsingIterationVar": true` options: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And this correct
lib/rules/no-use-v-if-with-v-for.js
Outdated
context.report({ | ||
node, | ||
loc: node.loc, | ||
message: "The 'v-for' list variable should be replace with a new computed property that returns your filtered list by this 'v-if' condition." |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we make list
to be dynamic value in this message? Also what do you think about this kind of message?
The 'someArray' variable inside 'v-for' directive should be replaced with a computed property that returns filtered array instead. You should not mix 'v-for' with 'v-if'.
@michalsnik Thank you for review! |
vue/no-use-v-if-with-v-for
rulevue/no-use-v-if-with-v-for
rule
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good job @ota-meshi !
This PR adds
vue/no-use-v-if-with-v-for
rule.This implements rule proposed in #403