Skip to content

Commit

Permalink
Improve documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
meziantou authored Oct 24, 2022
1 parent 0796a39 commit 0a8be75
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 9 deletions.
2 changes: 1 addition & 1 deletion docs/Rules/MA0116.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

Detect when `[SupplyParameterFromQuery]` attributes are used without the `[Parameter]` attributes.

````c#
````razor
using Microsoft.AspNetCore.Components;
@code {
Expand Down
2 changes: 1 addition & 1 deletion docs/Rules/MA0117.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

Detect when `[EditorRequired]` attributes are used without the `[Parameter]` attribute.

````c#
````razor
using Microsoft.AspNetCore.Components;
@code {
Expand Down
2 changes: 1 addition & 1 deletion docs/Rules/MA0118.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

Methods marked as `[JSInvokable]` must be public.

````
````c#
using Microsoft.JSInterop;

class Test
Expand Down
5 changes: 5 additions & 0 deletions docs/Rules/MA0119.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,10 @@ class MyComponent : ComponentBase
{
await JS.InvokeVoidAsync("dummy"); // non-compliant
}

private async Task OtherMethod()
{
await JS.InvokeVoidAsync("dummy"); // ok
}
}
````
13 changes: 7 additions & 6 deletions docs/Rules/MA0120.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@

Simplify the usage of `IJSRuntime` or `IJSInProcessRuntime` when the returned value is not used.

````
IJSInProcessRuntime js = null;
await js.InvokeVoidAsync(""dummy""); // compliant
var result = await js.InvokeAsync<object>(""dummy""); // compliant
Console.WriteLine(await js.InvokeAsync<object>(""dummy"")); // compliant
````c#
IJSInProcessRuntime js = ...;

await js.InvokeVoidAsync("dummy"); // compliant
var result = await js.InvokeAsync<object>("dummy"); // compliant
Console.WriteLine(await js.InvokeAsync<object>("dummy")); // compliant
await js.InvokeAsync<object>(""dummy""); // not-compliant
await js.InvokeAsync<object>("dummy"); // not-compliant => use InvokeVoidAsync
````

0 comments on commit 0a8be75

Please sign in to comment.