{"id":14978222,"url":"https://github.com/charlespalmerbf/eslint-plugin-react-require-testid","last_synced_at":"2025-10-28T08:31:56.631Z","repository":{"id":223510224,"uuid":"760523376","full_name":"charlespalmerbf/eslint-plugin-react-require-testid","owner":"charlespalmerbf","description":"This ESLint plugin helps ensure that React components have the necessary data-testid attribute, which is crucial for effective testing of React applications.","archived":false,"fork":false,"pushed_at":"2024-05-29T09:54:09.000Z","size":36,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"develop","last_synced_at":"2025-02-01T13:02:52.104Z","etag":null,"topics":["eslint-plugin","react","testid"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/eslint-plugin-react-require-testid","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/charlespalmerbf.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-02-20T15:21:29.000Z","updated_at":"2024-08-06T20:00:52.000Z","dependencies_parsed_at":"2024-02-20T16:56:41.000Z","dependency_job_id":"65a47c3b-dc7f-46f5-938f-351453709fad","html_url":"https://github.com/charlespalmerbf/eslint-plugin-react-require-testid","commit_stats":{"total_commits":11,"total_committers":2,"mean_commits":5.5,"dds":0.09090909090909094,"last_synced_commit":"0a6a29d24e2a0e21ac7038757575c5092c0d981f"},"previous_names":["charlespalmerbf/eslint-plugin-react-require-testid"],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/charlespalmerbf%2Feslint-plugin-react-require-testid","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/charlespalmerbf%2Feslint-plugin-react-require-testid/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/charlespalmerbf%2Feslint-plugin-react-require-testid/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/charlespalmerbf%2Feslint-plugin-react-require-testid/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/charlespalmerbf","download_url":"https://codeload.github.com/charlespalmerbf/eslint-plugin-react-require-testid/tar.gz/refs/heads/develop","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":238623177,"owners_count":19502992,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["eslint-plugin","react","testid"],"created_at":"2024-09-24T13:57:05.781Z","updated_at":"2025-10-28T08:31:51.350Z","avatar_url":"https://github.com/charlespalmerbf.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# eslint-plugin-react-require-testid\n\nThis ESLint plugin helps ensure that React components have the necessary data-testid attribute, which is crucial for effective testing of React applications.\n\n## Installation\n\n```shell\nyarn add eslint-plugin-react-require-testid --dev\n```\n\n## Usage\n\nAfter installation, you need to configure ESLint to use this rule. Here's an example configuration:\n\n```javascript\n{\n  \"plugins\": [\"react-require-testid\"],\n  \"rules\": {\n    \"react-require-testid/testid-missing\": [\"error\", {\n      \"disableDefaultComponents\": [],\n      \"enableComponents\": []\n    }]\n  }\n}\n```\n\nIn this configuration:\n\n-   `disableDefaultComponents` allows you to specify default components to exclude from the rule check.\n-   `enableComponents` allows you to specify additional components to include in the rule check.\n\n###### Rule Logic\n\n-   The rule iterates through JSX opening elements in your code.\n-   It filters out default React components based on the configuration.\n-   It merges the filtered default components with any additional components specified.\n-   For each JSX opening element, it checks if the component is allowed and if it has a `data-testid` attribute.\n-   If the component is allowed but lacks a `data-testid` attribute, a linting error is reported.\n\n###### Example\n\nConsider the following JSX code snippet:\n\n`\u003cMyCustomComponent /\u003e`\n\nWith the ESLint rule configured, it will raise a linting error if `MyCustomComponent` is included in the allowed components list but does not have a `data-testid` attribute.\n\n###### Contributing\n\nContributions to this ESLint rule are welcome! If you encounter issues or have suggestions for improvements, please open an issue or submit a pull request on GitHub.\n\n## Conventional Commits\n\nThis project uses a specification called **Conventional Commits**, please **ensure** this specification is followed when commiting code to this project.\n\nGuide: https://www.conventionalcommits.org/en/v1.0.0/\n\n## Pull Requests, Approvals \u0026 Releases\n\n###### Creating the develop release pull request\n\nPull Requests made to this project are required in order to merge to **develop** or **main**\n\nWhen submitting a Pull Request, at least one approval is required before merging.\n\nWhen constructing a release, ensure that a release branch is created based off of the contents of develop, the only changes contained within this branch should be the version numbers in **package.json** and android's **build.gradle**.\n\nThe Pull Request should be named as **[develop] release vX.Y.Z**\n\n###### Creating the main release pull request\n\nOnce this Pull Request has been created, you will need to generate a new Pull Request based off **main** comparing the **develop** release branch you have just created, this should ensure that all changes that have been made to **develop** since the last release are contained within this update.\n\nThe Pull Request should be named as **[main] release vX.Y.Z**\n\n###### Creating the release tag\n\nOnce this has been done and both Pull Requests have been merged, a release tag should be generated, named as **vX.Y.Z**","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcharlespalmerbf%2Feslint-plugin-react-require-testid","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcharlespalmerbf%2Feslint-plugin-react-require-testid","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcharlespalmerbf%2Feslint-plugin-react-require-testid/lists"}