Skip to content

Commit

Permalink
100% test coverage in rule.ts
Browse files Browse the repository at this point in the history
  • Loading branch information
AhmedBaset committed Sep 26, 2024
1 parent 23419e6 commit e5b828e
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 7 deletions.
8 changes: 3 additions & 5 deletions src/rules/no-phyisical-properties/rule.ts
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ function report({
node: TSESTree.JSXAttribute;
invalid: string;
valid: string;
token: Token | null;
token: Token;
}) {
return ctx.report({
node,
Expand All @@ -117,12 +117,10 @@ function report({
valid,
},
loc: {
start: token?.loc?.start ?? node.loc!.start,
end: token?.loc?.end ?? node.loc!.end,
start: token?.loc?.start,
end: token?.loc?.end,
},
fix: (fixer) => {
if (!token) return null;

return fixer.replaceText(token, token?.getRaw()?.replace(invalid, valid));
},
});
Expand Down
2 changes: 1 addition & 1 deletion src/rules/no-phyisical-properties/test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ vitest.describe(RULE_NAME, () => {
},
{
name: "JSXNamespacedName",
code: `<svg:circle cx="50" cy="50" r="40" prop="pl-1 mr-2" />`,
code: `<svg:circle cx="50" cy="50" r="40" prop:class="pl-1 mr-2" />`,
},
],
invalid: [
Expand Down
2 changes: 1 addition & 1 deletion src/utils/ast.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {
NO_PHYSICAL_CLASSESS,
type Context,
type MessageId,
} from "../rules/no-phyisical-properties/rule";
} from "../rules/no-phyisical-properties/rule.js";

const unimplemented = new Set<string>();

Expand Down

0 comments on commit e5b828e

Please sign in to comment.