vuejs / eslint-plugin-vue Public
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
Add vue/no-restricted-class rule #1639
Conversation
Thanks @ota-meshi for the help! Very helpful points -- I've applied your suggestions, and ensured that we handle array syntax. |
yield* extractClassNames(node.left, true) | ||
yield* extractClassNames(node.right, true) | ||
return | ||
} |
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 made a mistake in the if statement. We need to add the following:
} | |
} | |
if (textOnly) { | |
return | |
} |
<template><div :class="''+{forbidden:true}">Content</div></template>
is actually drawn as <div class="[object Object]">Content</div>
.
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.
Thank you; fixed -- and added a test case.
lib/rules/no-restricted-class.js
Outdated
if (!textOnly) { | ||
return | ||
} |
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.
if (!textOnly) { | |
return | |
} |
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.
Amended.
I had to refactor the rule somewhat from my original implementation to make it work with Typescript. This made it a bit harder to read, so any suggestions for improving that are welcome.