Skip to content

custom rule - how? #772

@Felicia5

Description

@Felicia5

Hi,
I am trying to add a custom rule using the logic of heading-has-content rule. But instead of headings I am looking for div elements. Also, in the util hasAccessibleChild I am not only looking for any text but a text that is equal to "apply".

#My questions:

  1. I don't know how to handle these errors. Can you suggest some solutions?
    I generated the rule files using the create-rule.md file. I added my changes to the rule and rule-test files. I run npm test and receive these errors:

    image

Do you have a further guide on these below?

2. How do I test if the rule and the rule-test works as I want it to? 
  I have read the [eslint documentation](https://eslint.org/docs/developer-guide/unit-tests) but I couldn't find a solution. 
  1. Without merging my rule to the master branch, how do I add my custom jsx-eslint /eslint-plugin-jsx-a11y plugin to test my code against the my new custom rule when I develop a new website?

here is my custom rule:
https://github.com/Felicia5/eslint-plugin-jsx-a11y/blob/first-rule-button/src/rules/first-rule-button.js

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions