Skip to content

Commit 7abf140

Browse files
committed
fix: test coverage by modifying implementation
1 parent 6dd4737 commit 7abf140

File tree

3 files changed

+11
-21
lines changed

3 files changed

+11
-21
lines changed

lib/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// Plugin Definition
33
//------------------------------------------------------------------------------
44

5-
import {
5+
import type {
66
RuleListener,
77
RuleMetaDataDocs,
88
RuleModule

lib/rules/no-debug.ts

Lines changed: 6 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -4,22 +4,10 @@
44
*/
55
import type {
66
CallExpression,
7-
LeftHandSideExpression,
8-
MemberExpression,
9-
MetaProperty
7+
MemberExpression
108
} from "@typescript-eslint/types/dist/ast-spec";
11-
import { AST_NODE_TYPES } from "@typescript-eslint/experimental-utils";
129
import { createRule } from "../create-rule";
1310

14-
function hasPropertyAttr(
15-
callee: LeftHandSideExpression
16-
): callee is MemberExpression | MetaProperty {
17-
return (
18-
callee.type === AST_NODE_TYPES.MemberExpression ||
19-
callee.type === AST_NODE_TYPES.MetaProperty
20-
);
21-
}
22-
2311
//------------------------------------------------------------------------------
2412
// Rule Definition
2513
//------------------------------------------------------------------------------
@@ -44,14 +32,12 @@ export default createRule({
4432
create(context) {
4533
return {
4634
"CallExpression[callee.property.name='debug']": (
47-
node: CallExpression
35+
node: CallExpression & { callee: MemberExpression }
4836
) => {
49-
if (hasPropertyAttr(node.callee)) {
50-
context.report({
51-
node: node.callee.property,
52-
messageId: "noDebugMessage"
53-
});
54-
}
37+
context.report({
38+
node: node.callee.property,
39+
messageId: "noDebugMessage"
40+
});
5541
}
5642
};
5743
}

tests/lib/index.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,7 @@ it("should have a recommended config with recommended rules", () => {
2121
"testcafe-community/noSkip": "warn"
2222
});
2323
});
24+
25+
// it("should handle a config generation if a rule's RuleMetaDocs is obmitted", () => {
26+
// //
27+
// });

0 commit comments

Comments
 (0)