Skip to content

Commit

Permalink
fix(eslint-plugin-defaultvalue): exclude readonly member call express…
Browse files Browse the repository at this point in the history
…ions
  • Loading branch information
Killusions committed Jan 22, 2025
1 parent b456f33 commit 8e604c4
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
8 changes: 8 additions & 0 deletions eslint-plugin-defaultvalue/lib/rules/default-value.ts
Original file line number Diff line number Diff line change
Expand Up @@ -194,8 +194,16 @@ const extractCallExpression = (
// This will never have a defaultValue.
return undefined;
}
// Should not be documented.
if (readonly) {
return undefined;
}
return sourceCode.getText(callExpression);
default:
// Should not be documented.
if (readonly) {
return undefined;
}
return sourceCode.getText(callExpression);
}
};
Expand Down
5 changes: 5 additions & 0 deletions eslint-plugin-defaultvalue/tests/rule-tester.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,12 @@ class Test {
/** @internal */
internal = 'internal';
private tempFunc: () => any = () => {};
private tempFuncObj = { sub: tempFunc } as const;
readonly dontDefaultValueMe = 42;
readonly dontDefaultValueThisCall = this.temp();
readonly dontDefaultValueThisMemberCall = this.sub.temp();
signalValue = input.required<number>();
modelValue = model<string>();
}
Expand Down

0 comments on commit 8e604c4

Please sign in to comment.