Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

XS✔ ◾ Improved "use-meaningful-modifiers" rule #9625

Merged
merged 1 commit into from
Nov 28, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions rules/use-meaningful-modifiers/rule.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,20 +29,20 @@ When creating custom controls, avoid vague or generic names like CustomStepper o

<!--endintro-->

## Why It Matters
## Why it matters

Meaningful modifiers make it clear what a class, module, or component does or how it differs from a standard version. This helps developers understand its role without digging through code and reduces the chance of naming conflicts with other libraries.

:::greybox
Naming a custom `DbContext` implementation `CustomDbContext` or a specialized input control `CustomInput` doesn’t provide any real information. It’s unclear what is customized, making it harder to understand and maintain.
Naming a custom **`DbContext`** implementation **`CustomDbContext`** or a specialized input control **`CustomInput`** doesn’t provide any real information. It’s unclear what is customized, making it harder to understand and maintain.
:::
:::bad
A modifier that doesn't tell you what has been modified is of no value
Bad example - A modifier that doesn't tell you what has been modified is of no value
:::

:::greybox
A more descriptive name, like `WriteOnlyDbContext` or `BorderlessTextInput`, indicates exactly what’s different about the component, making it easier to understand its function at a glance.
A more descriptive name, like **`WriteOnlyDbContext`** or **`BorderlessTextInput`**, indicates exactly what’s different about the component, making it easier to understand its function at a glance.
:::
:::good
A modifier that clearly conveys what is different from the original can save developers time reading through the code
Good example - A modifier that clearly conveys what is different from the original can save developers time reading through the code
:::
Loading