forked from software-mansion/react-native-gesture-handler
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rewrite to TS (software-mansion#1327)
This PR combines three others (software-mansion#1273, software-mansion#1280, software-mansion#1291) and rewrites Gesture Handler and examples to TS. We tried to make non-breaking changes but this should be tested. Most types were overhauled, although they should remain compatible with old ones thanks to the type aliases in the `src/handlers/gestureHandlerTypesCompat.ts` file. CI for iOS was disabled due to strange fails. It should be reenabled when we add unit/e2e tests to RNGH. Fixes software-mansion#1076 - removed Flow from DrawerLayout Fixes software-mansion#1261 - added TS types Fixes software-mansion#998 - regenerated example app Fixes software-mansion#887 - removed prop types - Swipeable and DrawerLayout are now resolved by their own `package.json`s - React Native uses source code directly, browser and TS use files from `dist/` - Removed prop types - Removed unused babel config in the root dir, adjust Eslint config - Removed unused functions - Changed private names from `_name` to `private name` - Replaced `x && x()` syntax with `x.?()` - Added types compatibility layer for the new types (`gestureHandlerTypesCompat.ts`) - Added generation of declarations and declarations map when TS is transpiled - Moved types from declaration files to files with implementation - Added types to Android / iOS / shared JS code - Added basic types to the web version - Removed unused bits in examples - Regenerated Example app with latest RN - Removed stray files from examples/ - Updated Travis config to include newer Android build tools & iOS scheme name change - Organized Example code structure - Removed Example tests (they weren't testing anything) - Reconfigured web version of examples PRs that were merged into `ts-rewrite` branch were tested by using `npm pack` and adding it to the new app. In the case of software-mansion#1273 & software-mansion#1280, we additionally checked bundled diff for changes. We diffed master to generated dist/ directory using `diff --color -wryN -W 200 src/ dist/src`with imports removed by `find src -name "*.js" -type f -exec sed -i '' '/import/d' {} \;` Co-authored-by: WoLewicki <[email protected]> Co-authored-by: Jakub <[email protected]>
- Loading branch information
Showing
191 changed files
with
17,866 additions
and
12,528 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
{ | ||
"extends": [ | ||
"plugin:@typescript-eslint/recommended", | ||
"plugin:@typescript-eslint/recommended-requiring-type-checking", | ||
"satya164" | ||
], | ||
"settings": { | ||
"react": { "version": "16" }, | ||
"import/resolver": { | ||
"babel-module": {} | ||
} | ||
}, | ||
"parser": "@typescript-eslint/parser", | ||
"parserOptions": { | ||
"project": "./tsconfig.json" | ||
}, | ||
"env": { "browser": true, "node": true, "jest/globals": true }, | ||
"plugins": ["jest"], | ||
"ignorePatterns": ["dist/**/*"], | ||
"rules": { | ||
// temporary, remove after we type internals better | ||
"@typescript-eslint/restrict-template-expressions": "warn", | ||
"@typescript-eslint/no-unsafe-member-access": "warn", | ||
"@typescript-eslint/no-unsafe-call": "warn", | ||
"@typescript-eslint/no-unsafe-assignment": "warn", | ||
"@typescript-eslint/no-unsafe-return": "warn", | ||
|
||
// common | ||
"@typescript-eslint/explicit-module-boundary-types": "off", | ||
"import/named": "off", | ||
"react/sort-comp": "off", | ||
"prefer-const": [ | ||
"error", | ||
{ | ||
"destructuring": "all" | ||
} | ||
], | ||
"@typescript-eslint/no-unused-vars": [ | ||
"error", | ||
{ "argsIgnorePattern": "^_" } | ||
], | ||
"no-redeclare": "off", | ||
"@typescript-eslint/no-redeclare": "error", | ||
"no-use-before-define": "off", | ||
"@typescript-eslint/no-use-before-define": "error", | ||
"@typescript-eslint/ban-ts-comment": [ | ||
"error", | ||
{ | ||
"ts-ignore": "allow-with-description", | ||
"ts-expect-error": "allow-with-description" | ||
} | ||
] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"main": "../dist/src/components/DrawerLayout", | ||
"react-native": "../src/components/DrawerLayout", | ||
"browser": "../src/components/DrawerLayout", | ||
"types": "../dist/src/components/DrawerLayout.d.ts" | ||
} |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"main": "../dist/src/components/Swipeable", | ||
"react-native": "../src/components/Swipeable", | ||
"browser": "../src/components/Swipeable", | ||
"types": "../dist/src/components/Swipeable.d.ts" | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.