eslint-plugin-crisp 1.0.88 → 1.0.89
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/README.md +1 -0
- package/index.js +2 -1
- package/package.json +1 -1
- package/recommended-vue.js +2 -1
- package/rules/vue-ref-case.js +29 -0
package/README.md
CHANGED
|
@@ -200,6 +200,7 @@ Each item has emojis denoting:
|
|
|
200
200
|
| [crisp/vue-no-regex-data](https://github.com/crisp-oss/eslint-plugin-crisp/blob/master/rules/vue-no-regex-data.js) | Disallows regular expressions to be declared in Vue data object | | 🟢 |
|
|
201
201
|
| [crisp/vue-props-declaration-multiline](https://github.com/crisp-oss/eslint-plugin-crisp/blob/master/rules/vue-props-declaration-multiline.js) | Enforces props declarations to be multiline | | 🟢 |
|
|
202
202
|
| [crisp/vue-props-declaration-order](https://github.com/crisp-oss/eslint-plugin-crisp/blob/master/rules/vue-props-declaration-order.js) | Ensures props declarations are alphabetically ordered | | 🟢 |
|
|
203
|
+
| [crisp/vue-ref-case](https://github.com/crisp-oss/eslint-plugin-crisp/blob/master/rules/vue-ref-case.js) | Enforces `ref` attributes to snake case | | 🟢 |
|
|
203
204
|
|
|
204
205
|
## License
|
|
205
206
|
|
package/index.js
CHANGED
|
@@ -41,7 +41,8 @@ module.exports = {
|
|
|
41
41
|
"vue-html-indent": require("./rules/vue-html-indent"),
|
|
42
42
|
"vue-html-quotes": require("./rules/vue-html-quotes"),
|
|
43
43
|
"vue-no-regex-data": require("./rules/vue-no-regex-data"),
|
|
44
|
+
"vue-props-declaration-multiline": require("./rules/vue-props-declaration-multiline"),
|
|
44
45
|
"vue-props-declaration-order": require("./rules/vue-props-declaration-order"),
|
|
45
|
-
"vue-
|
|
46
|
+
"vue-ref-case": require("./rules/vue-ref-case")
|
|
46
47
|
}
|
|
47
48
|
};
|
package/package.json
CHANGED
package/recommended-vue.js
CHANGED
|
@@ -342,6 +342,7 @@ module.exports = {
|
|
|
342
342
|
"crisp/vue-html-quotes": "error",
|
|
343
343
|
"crisp/vue-no-regex-data": "error",
|
|
344
344
|
"crisp/vue-props-declaration-multiline": "error",
|
|
345
|
-
"crisp/vue-props-declaration-order": "error"
|
|
345
|
+
"crisp/vue-props-declaration-order": "error",
|
|
346
|
+
"crisp/vue-ref-case": "error"
|
|
346
347
|
}
|
|
347
348
|
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
module.exports = {
|
|
2
|
+
meta: {
|
|
3
|
+
type: "layout",
|
|
4
|
+
docs: {
|
|
5
|
+
description: "enforce ref attributes to be snake-cased",
|
|
6
|
+
category: "Stylistic Issues",
|
|
7
|
+
recommended: false,
|
|
8
|
+
},
|
|
9
|
+
fixable: null
|
|
10
|
+
},
|
|
11
|
+
|
|
12
|
+
create(context) {
|
|
13
|
+
return context.parserServices.defineTemplateBodyVisitor({
|
|
14
|
+
"VAttribute[directive=false][key.name='ref']"(node) {
|
|
15
|
+
const refValue = node.value && node.value.value;
|
|
16
|
+
|
|
17
|
+
if (refValue && !/^[a-z]+(_[a-z]+)*$/.test(refValue)) {
|
|
18
|
+
context.report({
|
|
19
|
+
node,
|
|
20
|
+
message: "Ref attribute \"{{refValue}}\" should be snake-cased.",
|
|
21
|
+
data: {
|
|
22
|
+
refValue,
|
|
23
|
+
},
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
})
|
|
28
|
+
}
|
|
29
|
+
};
|