Skip to content

Commit 516eb3f

Browse files
hartzisUrmit PatelJoviDeCroock
authored
V6 (#185)
* remove Swipeable component src * remove proptype dep * overhaul tests and use react testing library (#186) * clean up some deps, bundle with microbundle (#187) * v6 start typescript overhaul (#188) * V6 typescript examples (#193) * instead of testing if xy values are false, see if they are undefined * V6 ontap callback (#199) * V6 verify velocity (#202) * move types to separate file, re-order property destructuring (#207) * V6 passive event solution (#210) * 6.0.0-alpha.0 * V6 type exports readme updates (#211) * 6.0.0-alpha.0 * migration guide, readme, type exports, prettier run on test * 6.0.0-alpha.1 * import React so the TS-compiler doesn't insert a global scope (#213) * upgrade peer to include react17, update docs * 6.0.0-alpha.2 Co-authored-by: Urmit Patel <[email protected]> Co-authored-by: Jovi De Croock <[email protected]>
1 parent 2dc8905 commit 516eb3f

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+11243
-20670
lines changed

.babelrc

-17
This file was deleted.

.eslintignore

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
node_modules
2+
dist
23
lib
3-
es
4-
examples
4+
examples

.eslintrc

+22-32
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,31 @@
11
{
2-
"parser": "babel-eslint",
2+
"parser": "@typescript-eslint/parser",
3+
"parserOptions": {
4+
"project": "./tsconfig.all.json"
5+
},
36
"extends": [
47
"eslint:recommended",
5-
"plugin:import/recommended",
8+
"plugin:@typescript-eslint/eslint-recommended",
9+
"plugin:@typescript-eslint/recommended",
610
"plugin:react/recommended",
7-
"plugin:prettier/recommended"
11+
"prettier",
12+
"prettier/@typescript-eslint"
813
],
9-
"parserOptions": {
10-
"ecmaVersion": 6,
11-
"sourceType": "module",
12-
"ecmaFeatures": {
13-
"jsx": true,
14-
"experimentalObjectRestSpread": true
14+
"plugins": ["@typescript-eslint", "react-hooks"],
15+
"settings": {
16+
"react": {
17+
"version": "detect"
1518
}
1619
},
17-
"env": {
18-
"browser": true,
19-
"mocha": true,
20-
"node": true
21-
},
2220
"rules": {
23-
"prettier/prettier": [
24-
"error",
25-
{
26-
"singleQuote": true,
27-
"semi": false,
28-
"printWidth": 100
29-
}
30-
],
31-
"valid-jsdoc": 2,
32-
"react/jsx-uses-react": 1,
33-
"react/jsx-no-undef": 2,
34-
"react/jsx-wrap-multilines": 2,
35-
"react/no-string-refs": 0,
36-
"react/prop-types": [1, { "ignore": ["className", "children", "style"] }],
37-
"react-hooks/rules-of-hooks": 2,
38-
"react-hooks/exhaustive-deps": 1
39-
},
40-
"plugins": ["import", "react", "react-hooks"]
21+
"@typescript-eslint/no-unused-vars": ["error", { "varsIgnorePattern": "_" }],
22+
"@typescript-eslint/explicit-function-return-type": "off",
23+
"@typescript-eslint/no-empty-function": "off",
24+
"@typescript-eslint/no-explicit-any": "off",
25+
"@typescript-eslint/ban-ts-ignore": "off",
26+
"react/no-unescaped-entities": "off",
27+
"react/prop-types": "off",
28+
"react-hooks/rules-of-hooks": "error",
29+
"react-hooks/exhaustive-deps": "warn"
30+
}
4131
}

.gitignore

+5-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
node_modules
22
TODO
3-
npm-debug.log
3+
*.log
44
.DS_Store
5+
.vscode
56
lib
6-
es
7+
dist
78
examples/static
8-
coverage
9+
coverage
10+
package-lock.json

.prettierignore

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
package.json
2+
node_modules
3+
/lib
4+
/dist
5+
/coverage
6+
/examples

.prettierrc

-6
This file was deleted.

.prettierrc.json

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{}

.travis.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,6 @@ script: echo "Running tests against $(node -v)..."
77
jobs:
88
include:
99
- stage: Unit Lint Type Tests
10-
script: npm run test
10+
script: yarn run test
1111
- stage: Produce Coverage
1212
script: jest --coverage && cat ./coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js && rm -rf ./coverage

CHANGELOG.md

+44
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,47 @@
1+
# v6.0.0
2+
**New Features:**
3+
- include passive event listener option, by default, to internal uses of `addEventListener`
4+
- solves issue with chrome and lighthouse - [#167](https://github.com/FormidableLabs/react-swipeable/issues/167)
5+
- set `passive` to `false` only when `preventDefaultTouchmoveEvent` is `true`.
6+
- more details in [readme#passive-listener-issue](https://github.com/FormidableLabs/react-swipeable#passive-listener)
7+
- add new `onTap` event handler prop which executes its callback after a tap
8+
- Thank you [@upatel32](https://github.com/upatel32)!
9+
- add new `vxvy` event data property
10+
- `[ deltaX/time, deltaY/time]` - velocity per axis
11+
- Thank you [@upatel32](https://github.com/upatel32)!
12+
13+
**Breaking Changes:**
14+
- **remove** `<Swipeable>` component
15+
- see below for an example of how to make your own
16+
- [Swipeable component examples](https://github.com/FormidableLabs/react-swipeable/blob/main/migration.md#swipeable-component-examples)
17+
- **event data update** correctly calculate `deltaX` and `deltaY`
18+
- from `initial - current` **to** `current - initial`
19+
- fixes issue [#157](https://github.com/FormidableLabs/react-swipeable/issues/157)
20+
- Thank you [@upatel32](https://github.com/upatel32)!
21+
- **drop support for ie11**
22+
- using `addEventListener` options object needs to be polyfilled, [browser support](https://github.com/FormidableLabs/react-swipeable#browser-support)
23+
- **requires** react >= 16.8.3, additionally supports new react v17
24+
25+
**Bug fixes:**
26+
- Swipes can now start at edges (x or y === 0)
27+
- fixes [#182](https://github.com/FormidableLabs/react-swipeable/issues/182)
28+
- Thank you [@upatel32](https://github.com/upatel32)!
29+
30+
**Infrastructure:**
31+
- **typescript** Converted entire code base, tests, and examples to typescript
32+
- **changed type** `EventData` -> `SwipeEventData` - The event data provided for all swipe event callbacks
33+
- **removed type** `SwipeableOptions` - use `SwipeableProps` now
34+
- **removed types** associated with `<Swipeable>` component
35+
- **new type** `TapCallback` - callback for the new `onTap` prop handler
36+
- **new type** `SwipeDirections` - `"Left" | "Right" | "Up" | "Down"`
37+
- Converted tests to `@testing-library/react`, [react testing library](https://github.com/testing-library/react-testing-library)
38+
- Build bundles with `microbundle`. [microbundle](https://github.com/developit/microbundle)
39+
- export new "modern" build - via package.json `esmodule` property
40+
- [microbundle modern mode](https://github.com/developit/microbundle#-modern-mode-)
41+
42+
**Maintenance:**
43+
- Upgraded all dev dependencies, `jest`, `babel`, `webpack`, `eslint`, `prettier`
44+
145
# 5.5.0
246
* Add `first` property to `eventData` that is `true` for first swipe event [issue #160](https://github.com/formidablelabs/react-swipeable/issues/160) and [PR #162](https://github.com/formidablelabs/react-swipeable/pull/162)
347
* Thank you [@samanpwbb](https://github.com/samanpwbb)!

0 commit comments

Comments
 (0)