Skip to content

Commit 27e782b

Browse files
authored
Merge pull request #2546 from hashicorp/dchyun/private-props-standardization
`RichTooltip` - Standardize private properties and methods
2 parents 41e4692 + 9218a8c commit 27e782b

File tree

3 files changed

+7
-6
lines changed

3 files changed

+7
-6
lines changed

packages/components/NEW-COMPONENT-CHECKLIST.md

+1
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,7 @@ The engineering checklist has six parts: creating the feature branch, component
112112
- write API comments in the [JS doc](https://jsdoc.app/) format (look at existing components for examples)
113113
- use the same naming as the Figma file for the components API, unless it conflicts with a pre-existing HTML attribute. If that is the case, document the difference in a comment.
114114
- booleans should start with a verb (is/has/etc)
115+
- private properites and methods should be declared as `private` and start with an `_`, e.g., `private _elementId`
115116
- assertions should match the content style of the other components, e.g., `'@text for "Hds::Button" must have a valid value'`,
116117
- program with intent; think about the invocation for the developer who will use the component. The goal is a terse invocation, but we also want to consider the big picture. Try to get feedback when you can.
117118
- [ ] **component style**

packages/components/src/components/hds/rich-tooltip/index.hbs

+3-3
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,14 @@
1515
(hash
1616
Toggle=(component
1717
"hds/rich-tooltip/toggle"
18-
popoverId=this.popoverId
18+
popoverId=this._popoverId
1919
setupPrimitiveToggle=PP.setupPrimitiveToggle
2020
isOpen=PP.isOpen
2121
)
2222
Bubble=(component
2323
"hds/rich-tooltip/bubble"
24-
arrowId=this.arrowId
25-
popoverId=this.popoverId
24+
arrowId=this._arrowId
25+
popoverId=this._popoverId
2626
setupPrimitivePopover=PP.setupPrimitivePopover
2727
isOpen=PP.isOpen
2828
)

packages/components/src/components/hds/rich-tooltip/index.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,9 @@ export interface HdsRichTooltipSignature {
3232
}
3333

3434
export default class HdsRichTooltip extends Component<HdsRichTooltipSignature> {
35-
elementId: string = getElementId(this);
36-
arrowId: string = `arrow-${this.elementId}`;
37-
popoverId: string = `popover-${this.elementId}`;
35+
private _elementId: string = getElementId(this);
36+
private _arrowId: string = `arrow-${this._elementId}`;
37+
private _popoverId: string = `popover-${this._elementId}`;
3838

3939
get enableSoftEvents(): boolean {
4040
return this.args.enableClickEvents !== true;

0 commit comments

Comments
 (0)