github-actions[bot] 3927b70e8d
Add html to rule S6844 (#3665)
Co-authored-by: ericmorand-sonarsource <ericmorand-sonarsource@users.noreply.github.com>
Co-authored-by: Ilia Kebets <104737176+ilia-kebets-sonarsource@users.noreply.github.com>
2024-02-22 14:20:39 +01:00

31 lines
669 B
Plaintext

include::../common/rule.adoc[tag=header]
=== Code examples
==== Noncompliant code example
[source,javascript,diff-id=1,diff-type=noncompliant]
----
const MyComponent = () => {
return <>
<a href="javascript:void(0)" onClick={foo}>Perform action</a>
<a href="#" onClick={foo}>Perform action</a>
<a onClick={foo}>Perform action</a>
</>;
};
----
==== Compliant solution
[source,javascript,diff-id=1,diff-type=compliant]
----
const MyComponent = () => {
return <>
<button onClick={foo}>Perform action</button>
<a href="#section" onClick={foo}>Perform action</a>
</>;
};
----
include::../common/rule.adoc[tag=footer]