Skip to content

Commit ab80aa3

Browse files
committed
Initial commit - Release
0 parents  commit ab80aa3

21 files changed

+21053
-0
lines changed

.editorconfig

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
root = true
2+
3+
[*]
4+
indent_style = space
5+
indent_size = 2
6+
end_of_line = lf
7+
charset = utf-8
8+
trim_trailing_whitespace = true
9+
insert_final_newline = true

.eslintignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
**/coverage/**
2+
dest

.eslintrc.js

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
module.exports = {
2+
extends: ['alloy', 'alloy/react', 'alloy/typescript'],
3+
env: {
4+
// Your environments (which contains several predefined global variables)
5+
//
6+
// browser: true,
7+
// node: true,
8+
// mocha: true,
9+
// jest: true,
10+
// jquery: true
11+
},
12+
globals: {
13+
// Your global variables (setting to false means it's not allowed to be reassigned)
14+
//
15+
// myGlobal: false
16+
},
17+
rules: {
18+
// Customize your rules
19+
},
20+
}

.gitattributes

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
* text=auto
2+
*.js text eol=lf

.github/ISSUE_TEMPLATE.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<!--
2+
Thanks for your interest in the project.
3+
I appreciate bugs filed and PRs submitted!
4+
I'll probably ask you to submit the fix (after giving some direction).
5+
-->
6+
7+
- version:
8+
- `node` version:
9+
- `npm` (or `yarn`) version:
10+
11+
**Do you want to request a *feature* or report a *bug*?:**
12+
13+
**What is the current behavior?:**
14+
15+
**What is the expected behavior?:**
16+
17+
**Suggested solution:**

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
<!--
2+
Thanks for your interest in the project. I appreciate bugs filed and PRs submitted!
3+
-->
4+
5+
<!-- What changes are being made? (What feature/bug is being fixed here?) -->
6+
**What**:
7+
8+
9+
<!-- Why are these changes necessary? -->
10+
**Why**:
11+
12+
13+
<!-- How were these changes implemented? -->
14+
**How**:
15+
16+
17+
**Checklist**:
18+
<!-- add "N/A" to the end of each line that's irrelevant to your changes to check an item, place an "x" in the box like so: "- [x] Documentation" -->
19+
20+
* [ ] Documentation
21+
* [ ] Tests
22+
* [ ] Ready to be merged <!-- In your opinion, is this ready to be merged as soon as it's reviewed? -->
23+
24+
<!-- feel free to add additional comments. -->

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
node_modules
2+
coverage
3+
dest

.prettierignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
dest
2+
coverage
3+
.github
4+
package.json

.prettierrc.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
semi: false
2+
singleQuote: true
3+
trailingComma: es5

.travis.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
language: node_js
2+
node_js:
3+
- '12'
4+
5+
cache:
6+
directories:
7+
- '.eslintcache'
8+
- 'node_modules'
9+
10+
script:
11+
- npm run build
12+
- npm run lint
13+
- npm run test:ci
14+
15+
notifications:
16+
email: false
17+
18+
branches:
19+
only: master

README.md

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
# babel-plugin-react-data-testid
2+
3+
[![Build Status](https://travis-ci.com/akameco/babel-plugin-react-data-testid.svg?branch=master)](https://travis-ci.com/akameco/babel-plugin-react-data-testid)
4+
[![tested with jest](https://img.shields.io/badge/tested_with-jest-99424f.svg)](https://github.com/facebook/jest)
5+
[![styled with prettier](https://img.shields.io/badge/styled_with-prettier-ff69b4.svg)](https://github.com/prettier/prettier) <!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section -->
6+
[![All Contributors](https://img.shields.io/badge/all_contributors-1-orange.svg?style=flat-square)](#contributors-)
7+
8+
<!-- ALL-CONTRIBUTORS-BADGE:END -->
9+
10+
> ## Example
11+
12+
#### in
13+
14+
```
15+
const Foo = () =>
16+
<Bar>
17+
<div>
18+
</Bar>
19+
```
20+
21+
#### out
22+
23+
```
24+
const Foo = () =>
25+
<Bar data-test-id="Foo-Bar">
26+
<div data-test-id="Foo-Bar-div">
27+
</Bar>
28+
```
29+
30+
## Useful with styled-components
31+
32+
#### in
33+
34+
```
35+
const Wrapper = styled.div`...`
36+
37+
const Bar = styled.div`...`
38+
39+
const Foo = () =>
40+
<Wrapper>
41+
<Bar>
42+
</Wrapper>
43+
```
44+
45+
#### out
46+
47+
```
48+
const Wrapper = styled.div`...`
49+
50+
const Bar = styled.div`...`
51+
52+
const Foo = () =>
53+
<Wrapper data-test="Foo-Wrapper">
54+
<Bar data-test="Foo-Wrapper-Bar">
55+
</Wrapper>
56+
```
57+
58+
## Install
59+
60+
`yarn add davidgustys/babel-plugin-react-add-data-attribute`
61+
62+
or
63+
64+
`npm install davidgustys/babel-plugin-react-add-data-attribute`
65+
66+
## Usage
67+
68+
in .babelrc
69+
70+
```
71+
"plugins": [
72+
"davidgustys/babel-plugin-react-add-data-attribute",
73+
...
74+
```

jest.config.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
module.exports = {
2+
preset: 'ts-jest',
3+
testEnvironment: 'node',
4+
modulePathIgnorePatterns: ['dest'],
5+
globals: {
6+
'ts-jest': {
7+
diagnostics: 'warn',
8+
},
9+
},
10+
}

lint-staged.config.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
module.exports = {
2+
'*.+(js|jsx|ts|tsx)': ['eslint --fix', 'jest --findRelatedTests'],
3+
'*.+(js|jsx|json|yml|yaml|css|less|scss|ts|tsx|md|graphql|mdx)': [
4+
'prettier --write',
5+
],
6+
}

0 commit comments

Comments
 (0)