Skip to content

Commit

Permalink
fix(no-restricted-class): error in empty value (#2425)
Browse files Browse the repository at this point in the history
  • Loading branch information
waynzh committed Mar 25, 2024
1 parent b22bd8b commit f0af008
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/rules/no-restricted-class.js
Expand Up @@ -132,7 +132,7 @@ module.exports = {
/**
* @param {VAttribute & { value: VLiteral } } node
*/
'VAttribute[directive=false][key.name="class"]'(node) {
'VAttribute[directive=false][key.name="class"][value!=null]'(node) {
for (const className of node.value.value.split(/\s+/)) {
reportForbiddenClass(
className,
Expand Down
2 changes: 2 additions & 0 deletions tests/lib/rules/no-restricted-class.js
Expand Up @@ -18,6 +18,8 @@ const ruleTester = new RuleTester({
ruleTester.run('no-restricted-class', rule, {
valid: [
`<template><div class="allowed">Content</div></template>`,
`<template><div class>Content</div></template>`,
`<template><div :class>Content</div></template>`,
{
code: `<template><div class="allowed"">Content</div></template>`,
options: ['forbidden']
Expand Down

0 comments on commit f0af008

Please sign in to comment.