Rules Hub
Code Ruleset
Rule priority, scope & exceptions
Use this to align rules with the senior-level structure (P0/P1/P2, scope, exceptions/tradeoffs).
Use an arrow class property instead of a bind decorator/helper for handlers
For receiver-dependent class callbacks, prefer an arrow field when it fits the project pattern and avoids repeated binding.
Bad example
| 1 | @bind |
| 2 | private toggleMenu() { /* ... */ } |
Explanation (EN)
A receiver-dependent callback needs an explicit binding strategy when passed independently.
Objašnjenje (HR)
Good example
| 1 | private toggleMenu = () => { /* ... */ }; |
Explanation (EN)
Objašnjenje (HR)
Notes (EN)
For a class callback passed without its receiver, use the project-supported binding pattern and verify that the instance identity and this value remain stable.
Exceptions / Tradeoffs (EN)
Prototype methods with constructor binding are valid and allocate differently; do not replace supported decorators on the unsupported claim that all bind decorators are unreliable.