eslint-plugin-crisp 1.4.2 → 1.4.3
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
CHANGED
|
@@ -12,6 +12,7 @@ export default {
|
|
|
12
12
|
|
|
13
13
|
create(context) {
|
|
14
14
|
const SEPARATOR_PATTERN = /^--> (ACTIONS|HELPERS|EVENT LISTENERS) <--$/;
|
|
15
|
+
const SEPARATOR_LIKE_PATTERN = /^--> .+ <--$/;
|
|
15
16
|
|
|
16
17
|
return {
|
|
17
18
|
'ExportDefaultDeclaration Property[key.name="methods"]'(node) {
|
|
@@ -35,11 +36,29 @@ export default {
|
|
|
35
36
|
context.report({
|
|
36
37
|
node,
|
|
37
38
|
message:
|
|
38
|
-
"Methods block must contain at least one separator comment " +
|
|
39
|
-
"
|
|
40
|
-
"or '// --> EVENT LISTENERS <--'
|
|
39
|
+
"Methods block must contain at least one separator comment: " +
|
|
40
|
+
"'// --> ACTIONS <--', '// --> HELPERS <--', " +
|
|
41
|
+
"or '// --> EVENT LISTENERS <--'."
|
|
41
42
|
});
|
|
42
43
|
}
|
|
44
|
+
|
|
45
|
+
comments.forEach((comment) => {
|
|
46
|
+
if (comment.type === "Line") {
|
|
47
|
+
const trimmed = comment.value.trim();
|
|
48
|
+
|
|
49
|
+
if (
|
|
50
|
+
SEPARATOR_LIKE_PATTERN.test(trimmed) &&
|
|
51
|
+
!SEPARATOR_PATTERN.test(trimmed)
|
|
52
|
+
) {
|
|
53
|
+
context.report({
|
|
54
|
+
node: comment,
|
|
55
|
+
message:
|
|
56
|
+
"Invalid separator comment. Must be '// --> ACTIONS <--', " +
|
|
57
|
+
"'// --> HELPERS <--', or '// --> EVENT LISTENERS <--'."
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
});
|
|
43
62
|
}
|
|
44
63
|
};
|
|
45
64
|
}
|