Skip to content

Commit

Permalink
Merge pull request #9 from rpearce/chore/upgrades
Browse files Browse the repository at this point in the history
Chore: dev upgrades, lint, and fix tslib not being included in deps
  • Loading branch information
rpearce committed Jul 31, 2020
2 parents 9bc2c9d + 5e0f481 commit c4e6fc7
Show file tree
Hide file tree
Showing 10 changed files with 1,766 additions and 1,858 deletions.
27 changes: 17 additions & 10 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,33 +3,39 @@ module.exports = {
browser: true,
es6: true,
jest: true,
node: true
node: true,
},
extends: [
'plugin:react/recommended',
'plugin:@typescript-eslint/recommended',
'prettier/@typescript-eslint',
'plugin:prettier/recommended',
'plugin:jsx-a11y/recommended'
'plugin:jsx-a11y/recommended',
],
parserOptions: {
ecmaVersion: 2020,
sourceType: 'module'
sourceType: 'module',
},
parser: '@typescript-eslint/parser',
plugins: ['jsx-a11y', 'react', 'react-hooks', '@typescript-eslint'],
rules: {
'@typescript-eslint/no-unused-vars': 'error',
'@typescript-eslint/no-explicit-any': 0, // because library is generic
'jsx-quotes': ['error', 'prefer-double'],
'jsx-a11y/no-onchange': 0,
'jsx-a11y/no-onchange': 'off',
'max-len': [
'error',
{
code: 80,
ignoreComments: true,
ignoreTemplateLiterals: true,
ignoreStrings: true,
}
],
'no-trailing-spaces': 'error',
'object-curly-spacing': ['error', 'always'],
quotes: ['error', 'single', { allowTemplateLiterals: true }],
'react-hooks/exhaustive-deps': 'error',
'react-hooks/rules-of-hooks': 'error',
'react/prop-types': 0,
semi: ['error', 'never']
'react/prop-types': 'off',
semi: ['error', 'never'],
},
settings: {
react: {
Expand All @@ -41,7 +47,8 @@ module.exports = {
files: ['*.js', '*.jsx'],
rules: {
'@typescript-eslint/explicit-function-return-type': 'off',
'@typescript-eslint/no-var-requires': 'off'
'@typescript-eslint/explicit-module-boundary-types': 'off',
'@typescript-eslint/no-var-requires': 'off',
}
}
]
Expand Down
4 changes: 0 additions & 4 deletions .prettierrc.js

This file was deleted.

6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@ 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.2] - 2020-07-31

### Fixed
* `tslib` not being included in dependencies when it :100: should be
* using `{}` as a type (should use `Record` instead)

## [0.3.1] - 2020-03-13

### Fixed
Expand Down
1 change: 1 addition & 0 deletions __tests__/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import React, { FC, ReactNode, RefObject, createRef } from 'react'
import { render } from '@testing-library/react'
import withForwardedRef from '../source'

// eslint-disable-next-line @typescript-eslint/no-explicit-any
interface Props<A = any> {
children: ReactNode
className: string
Expand Down
5 changes: 0 additions & 5 deletions husky.config.js

This file was deleted.

3 changes: 0 additions & 3 deletions lint-staged.config.js

This file was deleted.

63 changes: 30 additions & 33 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "react-with-forwarded-ref",
"version": "0.3.1",
"version": "0.3.2",
"description": "React higher-order component (HOC) for ref forwarding",
"main": "dist/cjs/index.js",
"module": "dist/esm/index.js",
Expand Down Expand Up @@ -47,41 +47,38 @@
"test": "jest"
},
"devDependencies": {
"@rollup/plugin-commonjs": "11.0.2",
"@rollup/plugin-node-resolve": "7.1.1",
"@testing-library/jest-dom": "5.1.1",
"@testing-library/react": "10.0.1",
"@types/jest": "25.1.4",
"@types/node": "13.9.1",
"@types/react": "16.9.23",
"@types/react-dom": "16.9.5",
"@typescript-eslint/eslint-plugin": "2.23.0",
"@typescript-eslint/parser": "2.23.0",
"all-contributors-cli": "6.14.0",
"babel-loader": "8.0.6",
"coveralls": "3.0.9",
"eslint": "6.8.0",
"eslint-config-prettier": "6.10.0",
"eslint-plugin-jest": "23.8.2",
"eslint-plugin-jsx-a11y": "6.2.3",
"eslint-plugin-prettier": "3.1.2",
"eslint-plugin-react": "7.19.0",
"eslint-plugin-react-hooks": "2.5.0",
"husky": "4.2.3",
"jest": "25.1.0",
"lint-staged": "10.0.8",
"@rollup/plugin-commonjs": "14.0.0",
"@rollup/plugin-node-resolve": "8.4.0",
"@testing-library/jest-dom": "5.11.2",
"@testing-library/react": "10.4.7",
"@types/jest": "26.0.8",
"@types/node": "14.0.27",
"@types/react": "16.9.43",
"@types/react-dom": "16.9.8",
"@typescript-eslint/eslint-plugin": "3.7.1",
"@typescript-eslint/parser": "3.7.1",
"all-contributors-cli": "6.17.0",
"babel-loader": "8.1.0",
"coveralls": "3.1.0",
"eslint": "7.5.0",
"eslint-plugin-jest": "23.20.0",
"eslint-plugin-jsx-a11y": "6.3.1",
"eslint-plugin-react": "7.20.5",
"eslint-plugin-react-hooks": "4.0.8",
"jest": "26.2.2",
"npm-run-all": "4.1.5",
"prettier": "1.19.1",
"react": "16.13.0",
"react-dom": "16.13.0",
"rollup": "2.0.6",
"rollup-plugin-terser": "5.3.0",
"rollup-plugin-typescript2": "0.26.0",
"ts-jest": "25.2.1",
"tslib": "1.11.1",
"typescript": "3.8.3"
"react": "16.13.1",
"react-dom": "16.13.1",
"rollup": "2.23.0",
"rollup-plugin-terser": "6.1.0",
"rollup-plugin-typescript2": "0.27.1",
"ts-jest": "26.1.4",
"typescript": "3.9.7"
},
"peerDependencies": {
"react": ">= 16.3"
},
"dependencies": {
"tslib": "^2.0.0"
}
}
2 changes: 1 addition & 1 deletion rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ const umd = [
file: './dist/umd/react-with-forwarded-ref.min.js',
exports: 'named',
format: 'umd',
globals: { react: 'react', 'react-dom': 'reactdom' },
globals: { react: 'React', 'react-dom': 'ReactDom' },
name: 'rwfr-umd',
sourcemap: false
},
Expand Down
7 changes: 5 additions & 2 deletions source/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,14 @@ import React, {
forwardRef
} from 'react'

interface WithForwardedRef<A = any> {
interface WithForwardedRef<A = unknown> {
ref?: RefObject<A>
}

export default function withForwardedRef<A = any, B = {}>(
export default function withForwardedRef<
A = unknown,
B = Record<string, unknown>
>(
Comp: ComponentType<B>
): ForwardRefExoticComponent<PropsWithoutRef<B> & RefAttributes<A>> {
const WrappedComp: ForwardRefRenderFunction<A, B> = (props, ref) => (
Expand Down

0 comments on commit c4e6fc7

Please sign in to comment.