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✔ ◾ 💄 EditorRequired Blazor Rule - Fix Titles #7197

Merged
merged 1 commit into from
Nov 7, 2023
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
17 changes: 13 additions & 4 deletions rules/editor-required-blazor-component-parameters/rule.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@ You should use the `[EditorRequired]` attribute to mark parameters that are requ

<!--endintro-->

`TestComponent.razor`
<br>

**TestComponent.razor**

```razor
<h3>@Name</h3>
Expand All @@ -28,8 +30,9 @@ You should use the `[EditorRequired]` attribute to mark parameters that are requ
public string? Name { get; set; }
}
```
<br>

`Index.razor`
**Index.razor**

```razor
@page "/"
Expand All @@ -44,7 +47,9 @@ Figure: Bad example - Developers could forget to pass a variable to the Name pro

:::

`TestComponent.razor`
<br>

**TestComponent.razor**

```razor
<h3>@Name</h3>
Expand All @@ -55,7 +60,9 @@ Figure: Bad example - Developers could forget to pass a variable to the Name pro
}
```

`Index.razor`
<br>

**Index.razor**

```razor
@page "/"
Expand All @@ -70,6 +77,8 @@ Figure: Bad example - Developers could forget to pass a variable to the Name pro

:::

<br>

You should configure this warning (RZ2012) as an error so your IDE will fail to build if you are missing a required parameter. Add `<WarningsAsErrors>RZ2012</WarningsAsErrors>` to your Blazor .csproj file:

```xml
Expand Down
Loading