From 818647eefdcfa13b9da6644dec26f81d96d1e1ea Mon Sep 17 00:00:00 2001 From: Marek Rozmus Date: Tue, 14 Apr 2020 16:35:10 +0200 Subject: [PATCH] Code review fixes --- .eslintrc | 7 ++- README.md | 2 +- examples/.eslintrc | 12 +++- examples/src/App.js | 2 +- examples/src/animations/List.js | 80 ++++++++++++++----------- examples/src/app.module.css | 2 +- examples/src/basic/List.js | 22 ++++--- examples/src/complex/List.js | 35 ++++++----- examples/src/size-to-content/List.js | 38 ++++++------ src/SwipeableListItem.css | 6 +- src/SwipeableListItem.js | 25 ++++---- src/__tests__/SwipeableListItem.test.js | 18 +++--- src/index.js | 4 +- src/module.d.ts | 4 +- 14 files changed, 137 insertions(+), 120 deletions(-) diff --git a/.eslintrc b/.eslintrc index 345cf0b..0ba48a2 100644 --- a/.eslintrc +++ b/.eslintrc @@ -1,6 +1,7 @@ { "env": { "browser": true, + "es6": true, "node": true, "jest": true }, @@ -18,6 +19,10 @@ }, "rules": { "react-hooks/rules-of-hooks": "error", - "react-hooks/exhaustive-deps": "error" + "react-hooks/exhaustive-deps": "error", + "react/jsx-sort-props": [ + "error", + { "callbacksLast": true, "shorthandFirst": true } + ] } } diff --git a/README.md b/README.md index 7eedb66..8e09c77 100644 --- a/README.md +++ b/README.md @@ -143,7 +143,7 @@ Callback function that should be run when swipe is done beyond threshold. #### actionAnimation -Type: `ActionAnimation (RETURN | REMOVE | NONE)` (optional, default: RETURN) +Type: `ActionAnimations (RETURN | REMOVE | NONE)` (optional, default: RETURN) Animation type to be played swipe is done beyond threshold. diff --git a/examples/.eslintrc b/examples/.eslintrc index 7e77f99..292a469 100644 --- a/examples/.eslintrc +++ b/examples/.eslintrc @@ -1,6 +1,7 @@ { "env": { - "browser": true + "browser": true, + "es6": true }, "extends": ["plugin:prettier/recommended", "plugin:react/recommended"], "parser": "babel-eslint", @@ -13,6 +14,13 @@ "rules": { "no-undef": "error", "react-hooks/rules-of-hooks": "error", - "react-hooks/exhaustive-deps": "error" + "react-hooks/exhaustive-deps": "error", + "react/jsx-sort-props": [ + "error", + { + "callbacksLast": true, + "shorthandFirst": true + } + ] } } diff --git a/examples/src/App.js b/examples/src/App.js index 8b1e81e..9a3c7a3 100644 --- a/examples/src/App.js +++ b/examples/src/App.js @@ -62,7 +62,7 @@ class App extends PureComponent {

react-swipeable-list example

(try also mobile view in dev tools for touch events)
- {Examples.map(item => (