Skip to content

Commit

Permalink
Merge pull request #5 from rpearce/maintenance
Browse files Browse the repository at this point in the history
maintenance changes and v0.3.0
  • Loading branch information
rpearce authored Dec 29, 2019
2 parents 78d4810 + e65325c commit 258c35b
Show file tree
Hide file tree
Showing 23 changed files with 6,087 additions and 4,669 deletions.
4 changes: 1 addition & 3 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,2 @@
coverage/
dist/
docs/
node_modules/
src/
62 changes: 0 additions & 62 deletions .eslintrc

This file was deleted.

36 changes: 36 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
module.exports = {
env: {
browser: true,
es6: true,
jest: true,
node: true
},
extends: [
'eslint:recommended',
'plugin:jsx-a11y/recommended',
'plugin:prettier/recommended',
'plugin:react/recommended'
],
parserOptions: {
ecmaVersion: 2019,
sourceType: 'module'
},
plugins: [
'jsx-a11y',
'react'
],
rules: {
'indent': ['error', 2, { 'SwitchCase': 1 }],
'jsx-quotes': ['error', 'prefer-double'],
'jsx-a11y/no-onchange': 0,
'no-trailing-spaces': 'error',
'object-curly-spacing': ['error', 'always'],
'quotes': ['error', 'single', { 'allowTemplateLiterals': true }],
'semi': ['error', 'never']
},
settings: {
react: {
version: '16'
}
}
}
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -60,5 +60,6 @@ typings/
# next.js build output
.next

src/
dist/
*.tmp
.DS_Store
4 changes: 4 additions & 0 deletions .prettierrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
module.exports = {
semi: false,
singleQuote: true
}
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
language: node_js
node_js:
- "11"
- "13"
cache: yarn
after_success:
- npm run coverage
37 changes: 0 additions & 37 deletions API.md

This file was deleted.

14 changes: 14 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,20 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).

## [0.3.0] - 2019-12-29

### Added
* `browser` umd field
* `sideEffects: false` to `package.json`

### Changed
* now using `rollup` for builds
* updated `main` and `module` fields (not using `index.js` in root folder any
more)
* updated heaps of dependencies
* moved API docs back to README
* updated license from ISC to BSD-3

## [0.2.0] - 2019-10-17

### Added
Expand Down
31 changes: 27 additions & 4 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -1,7 +1,30 @@
ISC License (ISC)
Copyright (c) 2019, Robert Pearce

Copyright 2018 Robert Pearce
All rights reserved.

Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:

THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.

* Redistributions in binary form must reproduce the above
copyright notice, this list of conditions and the following
disclaimer in the documentation and/or other materials provided
with the distribution.

* Neither the name of Robert Pearce nor the names of other
contributors may be used to endorse or promote products derived
from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
61 changes: 54 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,58 @@ with whatever other `props` are passed in.
Please see the [`API Documentation`](./API.md) for usage.

## Links
* [`API Documentation`](./API.md)
* [`Authors`](./AUTHORS)
* [`Changelog`](./CHANGELOG.md)
* [`Contributing`](./CONTRIBUTING.md)
* [`Code of Conduct`](./CODE_OF_CONDUCT.md)
* [Installation](#installation)
* [Usage](#usage)
* [All Contributors](#usage)
* [Authors](./AUTHORS)
* [Changelog](./CHANGELOG.md)
* [Contributing](./CONTRIBUTING.md)
* [Code of Conduct](./CODE_OF_CONDUCT.md)

## Installation
```
npm i react-with-forwarded-ref
```
or
```
yarn add react-with-forwarded-ref
```

## Usage
Let's say you have a react component named `Comp`:

```js
// Comp.js file

const Comp = ({ children, className }) => (
<div className={className}>
{children}
</div>
)

export default Comp
```

If you're using [`React.createRef()`](https://reactjs.org/docs/refs-and-the-dom.html#creating-refs<Paste>)
and want to pass this `ref` to a child component, you need to utilize
[forwarded refs](https://reactjs.org/docs/forwarding-refs.html). This component
handles all the hassle by using the [higher-order component
(HOC)](https://reactjs.org/docs/higher-order-components.html) pattern to wrap
your component, accept the `ref`, and forward it to you as `forwardedRef`.

```js
// Comp.js file

import withForwardedRef from 'react-with-forwarded-ref'

const Comp = ({ children, className, forwardedRef }) => (
<div className={className} ref={forwardedRef}>
{children}
</div>
)

export default withForwardedRef(Comp)
```

## Contributors

Expand All @@ -28,8 +75,8 @@ Thanks goes to these wonderful people ([emoji key](https://github.com/kentcdodds
<!-- markdownlint-disable -->
<table>
<tr>
<td align="center"><a href="https://robertwpearce.com"><img src="https://avatars2.githubusercontent.com/u/592876?v=4" width="100px;" alt="Robert Pearce"/><br /><sub><b>Robert Pearce</b></sub></a><br /><a href="https://github.com/rpearce/react-with-forwarded-ref/commits?author=rpearce" title="Code">💻</a> <a href="https://github.com/rpearce/react-with-forwarded-ref/commits?author=rpearce" title="Documentation">📖</a> <a href="#example-rpearce" title="Examples">💡</a> <a href="#ideas-rpearce" title="Ideas, Planning, & Feedback">🤔</a> <a href="https://github.com/rpearce/react-with-forwarded-ref/commits?author=rpearce" title="Tests">⚠️</a></td>
<td align="center"><a href="https://zuffik.eu"><img src="https://avatars1.githubusercontent.com/u/7671752?v=4" width="100px;" alt="Kristián Žuffa"/><br /><sub><b>Kristián Žuffa</b></sub></a><br /><a href="https://github.com/rpearce/react-with-forwarded-ref/commits?author=zuffik" title="Code">💻</a></td>
<td align="center"><a href="https://robertwpearce.com"><img src="https://avatars2.githubusercontent.com/u/592876?v=4" width="100px;" alt=""/><br /><sub><b>Robert Pearce</b></sub></a><br /><a href="https://github.com/rpearce/react-with-forwarded-ref/commits?author=rpearce" title="Code">💻</a> <a href="https://github.com/rpearce/react-with-forwarded-ref/commits?author=rpearce" title="Documentation">📖</a> <a href="#example-rpearce" title="Examples">💡</a> <a href="#ideas-rpearce" title="Ideas, Planning, & Feedback">🤔</a> <a href="https://github.com/rpearce/react-with-forwarded-ref/commits?author=rpearce" title="Tests">⚠️</a></td>
<td align="center"><a href="https://zuffik.eu"><img src="https://avatars1.githubusercontent.com/u/7671752?v=4" width="100px;" alt=""/><br /><sub><b>Kristián Žuffa</b></sub></a><br /><a href="https://github.com/rpearce/react-with-forwarded-ref/commits?author=zuffik" title="Code">💻</a></td>
</tr>
</table>

Expand Down
5 changes: 1 addition & 4 deletions babel.config.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
const presets = [
'@babel/preset-env',
'@babel/preset-react'
]
const presets = ['@babel/preset-env', '@babel/preset-react']

module.exports = {
presets
Expand Down
Loading

0 comments on commit 258c35b

Please sign in to comment.