https://github.com/fortis/babel-plugin-react-data-name
Babel plugin for adding React Component name as data attribute
https://github.com/fortis/babel-plugin-react-data-name
Last synced: about 2 months ago
JSON representation
Babel plugin for adding React Component name as data attribute
- Host: GitHub
- URL: https://github.com/fortis/babel-plugin-react-data-name
- Owner: fortis
- License: mit
- Created: 2018-12-24T07:04:41.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2021-03-26T12:09:39.000Z (almost 5 years ago)
- Last Synced: 2024-10-02T09:24:38.342Z (over 1 year ago)
- Language: JavaScript
- Size: 448 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# babel-plugin-react-data-name
## Overview
Babel plugin for adding meaningful identifiers to React Components.
This allows our components to have a designated attribute for end-to-end integration tests (without having to add them manually).
## Installation
This package is available on npm as `babel-plugin-react-data-name`, and you can find it
[here](https://www.npmjs.com/package/babel-plugin-react-data-name).
To install the latest stable version with Yarn:
```sh
$ yarn add --dev babel-plugin-react-data-name
```
## Usage
#### BABEL CONFIG
```json
{
"env": {
"development": {
"plugins": ["react-data-name"]
}
}
}
```
#### CUSTOM ATTRIBUTE NAME
You can pass custom attribute name with your `.bablerc`.
```json
{
"env": {
"development": {
"plugins": [["react-data-name", { "property": "data-test" }]]
}
}
}
```
## License
[MIT][license]