Skip to content

Commit

Permalink
v1.0.90
Browse files Browse the repository at this point in the history
Update ref check
  • Loading branch information
eliottvincent committed Jul 4, 2024
1 parent b13e64d commit bd27f49
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 14 deletions.
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "eslint-plugin-crisp",
"version": "1.0.89",
"version": "1.0.90",
"description": "Custom ESLint Rules for Crisp",
"author": "Crisp IM SAS",
"main": "index.js",
Expand Down
25 changes: 14 additions & 11 deletions rules/vue-ref-case.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,21 @@ module.exports = {
create(context) {
return context.parserServices.defineTemplateBodyVisitor({
"VAttribute[directive=false][key.name='ref']"(node) {
const refValue = node.value && node.value.value;
// Check if the ref attribute is not bound to an expression
if (node.value && node.value.type === 'VLiteral') {
const refValue = node.value.value;

if (refValue && !/^[a-z]+(_[a-z]+)*$/.test(refValue)) {
context.report({
node,
message: "Ref attribute \"{{refValue}}\" should be snake-cased.",
data: {
refValue,
},
});
if (refValue && !/^[a-z]+(_[a-z]+)*$/.test(refValue)) {
context.report({
node,
message: "Ref attribute \"{{refValue}}\" should be snake-cased.",
data: {
refValue,
},
});
}
}
}
})
});
}
};
};

0 comments on commit bd27f49

Please sign in to comment.