Skip to content

Lint rules don't allow links with javascript:void href, or any alternative. #4141

Description

@peterbraden

For a variety of valid reasons, you may want to have html anchors with a href that is null for a time. One way of doing this is href='javascript:void(0)', however this triggers:
Script URL is a form of eval no-script-url" lint error.

Another way is href='#'. This triggers:
Links must not point to "#". Use a more descriptive href or use a button instead jsx-a11y/href-no-hash

Another way is <a href>, This triggers:
Warning: Received 'true' for a non-boolean attribute 'href'.

Are there ways to achieve the desired effect without lint errors, otherwise can one of these be removed?

See:
#808

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions