Skip to content

feat: add support for multiple test id attributes #211

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 10, 2020
Merged

feat: add support for multiple test id attributes #211

merged 1 commit into from
Aug 10, 2020

Conversation

skovy
Copy link
Collaborator

@skovy skovy commented Aug 10, 2020

This PR proposes adding support for multiple test id attributes (via testIdAttribute) to the consistent-data-testid rule.

Movitation

When making shared components, some prefer to expose a testId prop (example in Atlastkit) in addition to using the data-testid prop. Ideally, this linting rule could handle more than one test id attribute to handle cases like this.

Changes

The configuration was updated to allow either a string (existing API) or now an array of strings. This was done so the rule continues to work with existing configurations. I also considered adding regex support which could also achieve this and happy to update with that approach if preferred.

Copy link
Member

@Belco90 Belco90 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hello @skovy, thanks for your contribution! Interesting improvement, and the implementation looks good to me 🚀

@Belco90 Belco90 added the enhancement New feature or request label Aug 10, 2020
@Belco90 Belco90 merged commit 65d9c34 into testing-library:master Aug 10, 2020
@Belco90
Copy link
Member

Belco90 commented Aug 10, 2020

@all-contributors please add @skovy for code, test and doc.

@allcontributors
Copy link
Contributor

@Belco90

I've put up a pull request to add @skovy! 🎉

@Belco90
Copy link
Member

Belco90 commented Aug 10, 2020

🎉 This PR is included in version 3.6.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request released
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants