eslint-plugin-crisp 1.0.89 → 1.0.90
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/rules/vue-ref-case.js +14 -11
package/package.json
CHANGED
package/rules/vue-ref-case.js
CHANGED
|
@@ -12,18 +12,21 @@ module.exports = {
|
|
|
12
12
|
create(context) {
|
|
13
13
|
return context.parserServices.defineTemplateBodyVisitor({
|
|
14
14
|
"VAttribute[directive=false][key.name='ref']"(node) {
|
|
15
|
-
|
|
15
|
+
// Check if the ref attribute is not bound to an expression
|
|
16
|
+
if (node.value && node.value.type === 'VLiteral') {
|
|
17
|
+
const refValue = node.value.value;
|
|
16
18
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
19
|
+
if (refValue && !/^[a-z]+(_[a-z]+)*$/.test(refValue)) {
|
|
20
|
+
context.report({
|
|
21
|
+
node,
|
|
22
|
+
message: "Ref attribute \"{{refValue}}\" should be snake-cased.",
|
|
23
|
+
data: {
|
|
24
|
+
refValue,
|
|
25
|
+
},
|
|
26
|
+
});
|
|
27
|
+
}
|
|
25
28
|
}
|
|
26
29
|
}
|
|
27
|
-
})
|
|
30
|
+
});
|
|
28
31
|
}
|
|
29
|
-
};
|
|
32
|
+
};
|