Skip to content

Commit

Permalink
fix: test coverage by modifying implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
codejedi365 committed Oct 4, 2021
1 parent 6dd4737 commit 7abf140
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 21 deletions.
2 changes: 1 addition & 1 deletion lib/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Plugin Definition
//------------------------------------------------------------------------------

import {
import type {
RuleListener,
RuleMetaDataDocs,
RuleModule
Expand Down
26 changes: 6 additions & 20 deletions lib/rules/no-debug.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,10 @@
*/
import type {
CallExpression,
LeftHandSideExpression,
MemberExpression,
MetaProperty
MemberExpression
} from "@typescript-eslint/types/dist/ast-spec";
import { AST_NODE_TYPES } from "@typescript-eslint/experimental-utils";
import { createRule } from "../create-rule";

function hasPropertyAttr(
callee: LeftHandSideExpression
): callee is MemberExpression | MetaProperty {
return (
callee.type === AST_NODE_TYPES.MemberExpression ||
callee.type === AST_NODE_TYPES.MetaProperty
);
}

//------------------------------------------------------------------------------
// Rule Definition
//------------------------------------------------------------------------------
Expand All @@ -44,14 +32,12 @@ export default createRule({
create(context) {
return {
"CallExpression[callee.property.name='debug']": (
node: CallExpression
node: CallExpression & { callee: MemberExpression }
) => {
if (hasPropertyAttr(node.callee)) {
context.report({
node: node.callee.property,
messageId: "noDebugMessage"
});
}
context.report({
node: node.callee.property,
messageId: "noDebugMessage"
});
}
};
}
Expand Down
4 changes: 4 additions & 0 deletions tests/lib/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,7 @@ it("should have a recommended config with recommended rules", () => {
"testcafe-community/noSkip": "warn"
});
});

// it("should handle a config generation if a rule's RuleMetaDocs is obmitted", () => {
// //
// });

0 comments on commit 7abf140

Please sign in to comment.