Skip to content

Commit a389780

Browse files
authored
feat(typescript): add types (#10)
1 parent b8f0c1e commit a389780

22 files changed

+4967
-2117
lines changed

.babelrc

-3
This file was deleted.

.github/FUNDING.yml

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
github: gregberge

.github/ISSUE_TEMPLATE.md

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
## 👉 [Please follow one of these issue templates](https://github.com/gregberge/react-flatten-children/issues/new/choose) 👈
2+
3+
Note: to keep the backlog clean and actionable, issues may be immediately closed if they do not follow one of the above issue templates.

.github/ISSUE_TEMPLATE/bug.md

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
---
2+
name: 🐛 Bug report
3+
about: Create a report to help us improve
4+
---
5+
6+
## 🐛 Bug Report
7+
8+
A clear and concise description of what the bug is.
9+
10+
## To Reproduce
11+
12+
Steps to reproduce the behavior:
13+
14+
## Expected behavior
15+
16+
A clear and concise description of what you expected to happen.
17+
18+
## Link to repl or repo (highly encouraged)
19+
20+
Please provide a minimal repository on GitHub.
21+
22+
Issues without a reproduction link are likely to stall.
23+
24+
## Run `npx envinfo --system --binaries --npmPackages react-flatten-children,react,react-dom --markdown --clipboard`
25+
26+
Paste the results here:
27+
28+
```bash
29+
30+
```

.github/ISSUE_TEMPLATE/feature.md

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
---
2+
name: 🚀 Feature Proposal
3+
about: Submit a proposal for a new feature
4+
---
5+
6+
## 🚀 Feature Proposal
7+
8+
A clear and concise description of what the feature is.
9+
10+
## Motivation
11+
12+
Please outline the motivation for the proposal.
13+
14+
## Example
15+
16+
Please provide an example for how this feature would be used.
17+
18+
## Pitch
19+
20+
Why does this feature belong in the react-flatten-children ecosystem?

.github/ISSUE_TEMPLATE/question.md

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
---
2+
name: 💬 Questions / Help
3+
about: If you have questions, please read full readme first
4+
---
5+
6+
## 💬 Questions and Help
7+
8+
This project project is young, but please before asking your question:
9+
10+
- Read carefully the README of the project
11+
- Search if your answer has already been answered in old issues
12+
13+
After you can submit your question and we will be happy to help you!

.github/ISSUE_TEMPLATE/regression.md

+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
---
2+
name: 💥 Regression Report
3+
about: Report unexpected behavior that worked in previous versions
4+
---
5+
6+
## 💥 Regression Report
7+
8+
A clear and concise description of what the regression is.
9+
10+
## Last working version
11+
12+
Worked up to version:
13+
14+
Stopped working in version:
15+
16+
## To Reproduce
17+
18+
Steps to reproduce the behavior:
19+
20+
## Expected behavior
21+
22+
A clear and concise description of what you expected to happen.
23+
24+
## Link to repl or repo (highly encouraged)
25+
26+
Please provide a minimal repository on GitHub.
27+
28+
Issues without a reproduction link are likely to stall.
29+
30+
## `npx envinfo --system --binaries --npmPackages react-flatten-children,react,react-dom --markdown --clipboard`
31+
32+
Paste the results here:
33+
34+
```bash
35+
36+
```

.github/PULL_REQUEST_TEMPLATE.md

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<!-- Thanks for submitting a pull request! Please provide enough information so that others can review your pull request. The two fields below are mandatory. -->
2+
3+
## Summary
4+
5+
<!-- Explain the **motivation** for making this change. What existing problem does the pull request solve? -->
6+
7+
## Test plan
8+
9+
<!-- Demonstrate the code is solid. Example: The exact commands you ran and their output, screenshots / videos if the pull request changes UI. -->

.npmignore

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
/*
2-
!/dist/**/*.js
3-
!/src/**/*.js
4-
*.test.js
2+
!/dist/**/*.{ts,js,map}
3+
!/src/**/*.tsx?
4+
*.test.tsx?

.travis.yml

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
11
language: node_js
22

33
node_js:
4-
- 10
4+
- 14
55

6-
before_install:
7-
- curl -o- -L https://yarnpkg.com/install.sh | bash -s -- --version 1.10.1
8-
- export PATH="$HOME/.yarn/bin:$PATH"
6+
branches:
7+
only:
8+
- "master"
99

1010
notifications:
1111
email: false
1212

1313
cache:
1414
yarn: true
1515
directories:
16-
- 'node_modules'
16+
- "node_modules"
1717

1818
git:
1919
depth: 5

CHANGELOG.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
44

55
<a name="1.0.0"></a>
6-
# 1.0.0 (2018-10-01)
76

7+
# 1.0.0 (2018-10-01)
88

99
### Features
1010

11-
* initial release ([321d8ba](https://github.com/smooth-code/react-flatten-children/commit/321d8ba))
11+
- initial release ([321d8ba](https://github.com/gregberge/react-flatten-children/commit/321d8ba))

CODE_OF_CONDUCT.md

+46
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
# Contributor Covenant Code of Conduct
2+
3+
## Our Pledge
4+
5+
In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, nationality, personal appearance, race, religion, or sexual identity and orientation.
6+
7+
## Our Standards
8+
9+
Examples of behavior that contributes to creating a positive environment include:
10+
11+
- Using welcoming and inclusive language
12+
- Being respectful of differing viewpoints and experiences
13+
- Gracefully accepting constructive criticism
14+
- Focusing on what is best for the community
15+
- Showing empathy towards other community members
16+
17+
Examples of unacceptable behavior by participants include:
18+
19+
- The use of sexualized language or imagery and unwelcome sexual attention or advances
20+
- Trolling, insulting/derogatory comments, and personal or political attacks
21+
- Public or private harassment
22+
- Publishing others' private information, such as a physical or electronic address, without explicit permission
23+
- Other conduct which could reasonably be considered inappropriate in a professional setting
24+
25+
## Our Responsibilities
26+
27+
Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior.
28+
29+
Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful.
30+
31+
## Scope
32+
33+
This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers.
34+
35+
## Enforcement
36+
37+
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at contact@smooth-code.com. The project team will review and investigate all complaints, and will respond in a way that it deems appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately.
38+
39+
Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership.
40+
41+
## Attribution
42+
43+
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available at [http://contributor-covenant.org/version/1/4][version]
44+
45+
[homepage]: http://contributor-covenant.org
46+
[version]: http://contributor-covenant.org/version/1/4/

CONTRIBUTING.md

+69
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
# How to Contribute
2+
3+
react-flatten-children is a small project, it uses [tsdx](https://github.com/jaredpalmer/tsdx) to simplify the development.
4+
5+
## [Code of Conduct](https://github.com/gregberge/react-flatten-children/blob/master/CODE_OF_CONDUCT.md)
6+
7+
We expect project participants to adhere to our Code of Conduct. Please read [the full text](https://github.com/gregberge/react-flatten-children/blob/master/CODE_OF_CONDUCT.md) so that you can understand what actions will and will not be tolerated.
8+
9+
## Open Development
10+
11+
All work on react-flatten-children happens directly on [GitHub](/). Both core team members and external contributors send pull requests which go through the same review process.
12+
13+
### Workflow and Pull Requests
14+
15+
_Before_ submitting a pull request, please make sure the following is done…
16+
17+
1. Fork the repo and create your branch from `master`. A guide on how to fork a repository: https://help.github.com/articles/fork-a-repo/
18+
19+
Open terminal (e.g. Terminal, iTerm, Git Bash or Git Shell) and type:
20+
21+
```sh-session
22+
$ git clone https://github.com/<your_username>/react-flatten-children
23+
$ cd react-flatten-children
24+
$ git checkout -b my_branch
25+
```
26+
27+
Note: Replace `<your_username>` with your GitHub username
28+
29+
2. This project uses [Yarn](https://code.fb.com/web/yarn-a-new-package-manager-for-javascript/) for running development scripts. If you haven't already done so, please [install yarn](https://yarnpkg.com/en/docs/install).
30+
31+
3. Run `yarn install`. On Windows: To install [Yarn](https://yarnpkg.com/en/docs/install#windows-tab) on Windows you may need to download either node.js or Chocolatey<br />
32+
33+
```sh
34+
yarn install
35+
```
36+
37+
To check your version of Yarn and ensure it's installed you can type:
38+
39+
```sh
40+
yarn --version
41+
```
42+
43+
4. If you've added code that should be tested, add tests.
44+
45+
5. If you've changed APIs, update the documentation.
46+
47+
6. Ensure the test suite passes via `yarn test`.
48+
49+
```sh-session
50+
$ yarn test
51+
```
52+
53+
## Bugs
54+
55+
### Where to Find Known Issues
56+
57+
We will be using GitHub Issues for our public bugs. We will keep a close eye on this and try to make it clear when we have an internal fix in progress. Before filing a new issue, try to make sure your problem doesn't already exist.
58+
59+
### Reporting New Issues
60+
61+
The best way to get your bug fixed is to provide a reduced test case. Please provide a public repository with a runnable example.
62+
63+
## Code Conventions
64+
65+
This project uses [Prettier](https://prettier.io/).
66+
67+
## License
68+
69+
By contributing to this project, you agree that your contributions will be licensed under its MIT license.

LICENSE

+18-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,21 @@
1-
Copyright 2018 Smooth Code
1+
MIT License
22

3-
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
3+
Copyright (c) 2020 Greg Bergé
44

5-
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
611

7-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

+13-13
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
# react-flatten-children
22

3-
[![License](https://img.shields.io/npm/l/react-flatten-children.svg)](https://github.com/smooth-code/react-flatten-children/blob/master/LICENSE)
3+
[![License](https://img.shields.io/npm/l/react-flatten-children.svg)](https://github.com/gregberge/react-flatten-children/blob/master/LICENSE)
44
[![npm package](https://img.shields.io/npm/v/react-flatten-children/latest.svg)](https://www.npmjs.com/package/react-flatten-children)
5-
[![Build Status](https://img.shields.io/travis/smooth-code/react-flatten-children.svg)](https://travis-ci.org/smooth-code/react-flatten-children)
6-
[![DevDependencies](https://img.shields.io/david/dev/smooth-code/react-flatten-children.svg)](https://david-dm.org/smooth-code/react-flatten-children?type=dev)
5+
[![Build Status](https://img.shields.io/travis/gregberge/react-flatten-children.svg)](https://travis-ci.org/gregberge/react-flatten-children)
6+
[![DevDependencies](https://img.shields.io/david/dev/gregberge/react-flatten-children.svg)](https://david-dm.org/gregberge/react-flatten-children?type=dev)
77

88
React utility to flatten fragments 🗜
99

@@ -14,18 +14,18 @@ npm install react-flatten-children
1414
## Example
1515

1616
```js
17-
import React from 'react'
18-
import { Switch as BaseSwitch } from 'react-router'
19-
import flattenChildren from 'react-flatten-children'
20-
import PublicHome from './PublicHome'
21-
import PrivateHome from './PrivateHome'
22-
import Account from './Account'
23-
import Login from './Login'
17+
import React from "react";
18+
import { Switch as BaseSwitch } from "react-router";
19+
import flattenChildren from "react-flatten-children";
20+
import PublicHome from "./PublicHome";
21+
import PrivateHome from "./PrivateHome";
22+
import Account from "./Account";
23+
import Login from "./Login";
2424

2525
// Create a fragment ready Switch
2626
const Switch = ({ children }) => (
2727
<BaseSwitch>{flattenChildren(children)}</BaseSwitch>
28-
)
28+
);
2929

3030
const Routes = ({ isLoggedIn }) => (
3131
<Switch>
@@ -43,9 +43,9 @@ const Routes = ({ isLoggedIn }) => (
4343
<Route path="/about" component={About} />
4444
<Redirect to="/" />
4545
</Switch>
46-
)
46+
);
4747

48-
export default Routes
48+
export default Routes;
4949
```
5050

5151
👉 [Checkout an interactive example on CodeSandbox](https://codesandbox.io/s/nn6l3r30k0)

0 commit comments

Comments
 (0)