From 13fe0eaec8dca3f77d80143183ff012bc4a7d212 Mon Sep 17 00:00:00 2001 From: Denis Sokolov Date: Wed, 20 Jan 2021 12:00:00 +0000 Subject: [PATCH 1/5] Format with Prettier --- src/index.js | 12 +++++++----- test/no-input.spec.js | 6 ++++-- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/src/index.js b/src/index.js index e0635f5..431349c 100644 --- a/src/index.js +++ b/src/index.js @@ -22,11 +22,13 @@ export function useMemoOne( const committed = useRef>(initial); // persist any uncommitted changes after they have been committed - const useCache: boolean = isFirstRun.current || Boolean( - inputs && - committed.current.inputs && - areInputsEqual(inputs, committed.current.inputs), - ); + const useCache: boolean = + isFirstRun.current || + Boolean( + inputs && + committed.current.inputs && + areInputsEqual(inputs, committed.current.inputs), + ); // create a new cache if required const cache: Cache = useCache diff --git a/test/no-input.spec.js b/test/no-input.spec.js index a943567..2f6f093 100644 --- a/test/no-input.spec.js +++ b/test/no-input.spec.js @@ -79,9 +79,11 @@ it('should start memoizing if inputs are provided', () => { it('should only call get result once on first pass', () => { const getResult = jest.fn().mockReturnValue({ hello: 'friend' }); const wrapper = mount( - {() => null}, + + {() => null} + , ); // initial call expect(getResult).toHaveBeenCalledTimes(1); -}) +}); From abc50f25a9db21ce811bc8a7d028fa866fb76619 Mon Sep 17 00:00:00 2001 From: Denis Sokolov Date: Wed, 20 Jan 2021 12:00:00 +0000 Subject: [PATCH 2/5] Fix linting errors --- test/no-input.spec.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/no-input.spec.js b/test/no-input.spec.js index 2f6f093..604c222 100644 --- a/test/no-input.spec.js +++ b/test/no-input.spec.js @@ -78,7 +78,7 @@ it('should start memoizing if inputs are provided', () => { it('should only call get result once on first pass', () => { const getResult = jest.fn().mockReturnValue({ hello: 'friend' }); - const wrapper = mount( + mount( {() => null} , From 37c0c68b660019adeb7ddc57bbf2ee14c57d0982 Mon Sep 17 00:00:00 2001 From: Denis Sokolov Date: Wed, 20 Jan 2021 12:00:00 +0000 Subject: [PATCH 3/5] Remove Travis configuration --- .travis.yml | 7 ------- 1 file changed, 7 deletions(-) delete mode 100644 .travis.yml diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index e62e532..0000000 --- a/.travis.yml +++ /dev/null @@ -1,7 +0,0 @@ -language: node_js -cache: yarn -node_js: - - '10.15.3' -script: - - yarn validate - - yarn test \ No newline at end of file From 8a9e29a229034442d9318ca9f51c328b10f1fe11 Mon Sep 17 00:00:00 2001 From: Denis Sokolov Date: Wed, 20 Jan 2021 12:00:00 +0000 Subject: [PATCH 4/5] Add GitHub Actions configuration --- .github/workflows/validate.yml | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 .github/workflows/validate.yml diff --git a/.github/workflows/validate.yml b/.github/workflows/validate.yml new file mode 100644 index 0000000..18cbe17 --- /dev/null +++ b/.github/workflows/validate.yml @@ -0,0 +1,11 @@ +name: Validate +on: [push] +jobs: + test: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-node@v1 + - run: yarn install + - run: yarn validate + - run: yarn test From e752ee5e345eb812000c15d2d288db91acb014af Mon Sep 17 00:00:00 2001 From: Denis Sokolov Date: Wed, 20 Jan 2021 12:00:00 +0000 Subject: [PATCH 5/5] Switch readme badges from Travis to GitHub Actions --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 0690922..ba67721 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ [`useMemo`](https://reactjs.org/docs/hooks-reference.html#usememo) and [`useCallback`](https://reactjs.org/docs/hooks-reference.html#usecallback) with a stable cache (semantic guarantee) -[![Build Status](https://travis-ci.org/alexreardon/use-memo-one.svg?branch=master)](https://travis-ci.org/alexreardon/use-memo-one) +[![Build Status](https://github.com/alexreardon/use-memo-one/actions?query=workflow%3AValidate)](https://github.com/alexreardon/use-memo-one/workflows/Validate/badge.svg) [![npm](https://img.shields.io/npm/v/use-memo-one.svg)](https://www.npmjs.com/package/use-memo-one) [![dependencies](https://david-dm.org/alexreardon/use-memo-one.svg)](https://david-dm.org/alexreardon/use-memo-one) [![min](https://img.shields.io/bundlephobia/min/use-memo-one.svg)](https://bundlephobia.com/result?p=use-memo-one)