Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor!: migrate to typescript #155

Merged
merged 35 commits into from Dec 29, 2021
Merged
Show file tree
Hide file tree
Changes from 33 commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
7500030
Remove old type definitions
Sep 12, 2021
185ff79
Init typescript
Sep 12, 2021
f4744fb
Migrate source to typescript
Sep 12, 2021
7aaa3a7
Remove use strict
Sep 12, 2021
266b99d
Replace 'import type' with 'import'
Sep 12, 2021
bb8b0a8
Export all types
Sep 12, 2021
dad8578
Lint source
Sep 12, 2021
a31e4d3
Unify array type syntax
Sep 12, 2021
ca6d13a
Fix tsconfig
Sep 12, 2021
d523da2
Remove unnecessary change
Sep 12, 2021
9e57a54
Change react-native value in package.json
Sep 12, 2021
d2c567c
Remove unnecessary changes
Sep 12, 2021
7053aad
Fix index
Sep 12, 2021
df11f25
Hot fix breaking changes and add TODOs
Sep 12, 2021
7441e66
Fix index exports
Sep 12, 2021
80ccd16
Add index todo
Sep 12, 2021
a5878b9
Lint source
Sep 12, 2021
19f24c2
Update Eslint and lint source
g-dimitry Sep 30, 2021
7b8310d
Typescript improvements
g-dimitry Oct 1, 2021
4b9ab00
yarn install and fix type error after rebase to master
rnike Dec 16, 2021
11f4ac3
fix prettier config
rnike Dec 16, 2021
164c6bb
perttier all files
rnike Dec 16, 2021
bc098d8
add .vscode to .gitignore
rnike Dec 16, 2021
eee60c2
batchCallback default value
rnike Dec 16, 2021
face86d
remove unnecessary todo in validate
rnike Dec 16, 2021
17daf39
refactor: simplify index.ts
rnike Dec 16, 2021
f3afaaa
remove flow related
rnike Dec 16, 2021
f9f1bf9
bump version for typescript
rnike Dec 16, 2021
445e32d
fix yarn test
rnike Dec 17, 2021
596fe1b
remove types from package.json
rnike Dec 17, 2021
b76b8db
remove "react-native": "src/index.ts" in package.json
rnike Dec 22, 2021
b69038d
remove unnecessary type declaration
rnike Dec 22, 2021
29766bc
fix types in FBGraphRequest
rnike Dec 22, 2021
2c695d0
correct the type of ProfileMap
rnike Dec 22, 2021
e1ebe6d
fix type warning
rnike Dec 22, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 7 additions & 1 deletion .eslintrc.js
Expand Up @@ -22,5 +22,11 @@
'use strict';

module.exports = {
extends: '@react-native-community',
root: true,
parser: '@typescript-eslint/parser',
plugins: ['@typescript-eslint'],
extends: ['@react-native-community', 'plugin:@typescript-eslint/recommended'],
rules: {
'prettier/prettier': 0,
},
};
69 changes: 0 additions & 69 deletions .flowconfig

This file was deleted.

3 changes: 3 additions & 0 deletions .gitignore
Expand Up @@ -40,3 +40,6 @@ yarn-error.log

# generated by bob
lib/

# vscode
.vscode
2 changes: 1 addition & 1 deletion README.md
Expand Up @@ -469,7 +469,7 @@ export default class Login extends Component {

#### Share dialogs

All of the dialogs included are used in a similar way, with differing content types. All content types are defined with [Flow](http://flowtype.org/) Type Annotation in js/models directory.
All of the dialogs included are used in a similar way, with differing content types.

```js
// ...
Expand Down
2 changes: 1 addition & 1 deletion RNFBSDKExample/.watchmanconfig
@@ -1 +1 @@
{}
{}
2 changes: 1 addition & 1 deletion RNFBSDKExample/app.json
@@ -1,4 +1,4 @@
{
"name": "RNFBSDKExample",
"displayName": "RNFBSDKExample"
}
}
@@ -1,38 +1,38 @@
{
"images" : [
"images": [
{
"idiom" : "iphone",
"size" : "29x29",
"scale" : "2x"
"idiom": "iphone",
"size": "29x29",
"scale": "2x"
},
{
"idiom" : "iphone",
"size" : "29x29",
"scale" : "3x"
"idiom": "iphone",
"size": "29x29",
"scale": "3x"
},
{
"idiom" : "iphone",
"size" : "40x40",
"scale" : "2x"
"idiom": "iphone",
"size": "40x40",
"scale": "2x"
},
{
"idiom" : "iphone",
"size" : "40x40",
"scale" : "3x"
"idiom": "iphone",
"size": "40x40",
"scale": "3x"
},
{
"idiom" : "iphone",
"size" : "60x60",
"scale" : "2x"
"idiom": "iphone",
"size": "60x60",
"scale": "2x"
},
{
"idiom" : "iphone",
"size" : "60x60",
"scale" : "3x"
"idiom": "iphone",
"size": "60x60",
"scale": "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
"info": {
"version": 1,
"author": "xcode"
}
}
}
@@ -1,6 +1,6 @@
{
"info" : {
"version" : 1,
"author" : "xcode"
"info": {
"version": 1,
"author": "xcode"
}
}
27 changes: 0 additions & 27 deletions flow/index.js.flow

This file was deleted.

2 changes: 1 addition & 1 deletion jest/mocks/index.js
@@ -1,5 +1,5 @@
/* eslint-env jest */
const LoginButton = require('../../lib/commonjs/FBLoginButton');
const LoginButton = require('../../lib/commonjs/FBLoginButton').default;


export const mockAppEvents = {
Expand Down
31 changes: 15 additions & 16 deletions package.json
Expand Up @@ -4,7 +4,7 @@
"description": "Facebook SDK support for React Native apps.",
"main": "lib/commonjs/index.js",
"module": "lib/module/index.js",
"react-native": "src/index.js",
"types": "lib/typescript/index.d.ts",
"sideEffects": false,
"author": {
"name": "Marcos Bérgamo"
Expand Down Expand Up @@ -50,18 +50,17 @@
"scripts": {
"start": "react-native start",
"prepare": "bob build",
"flow": "flow",
"lint": "eslint ./src",
"test": "yarn validate:prettier && yarn validate:eslint && yarn jest",
"validate:eslint": "eslint \"src/**/*\"",
"validate:flow": "flow",
"validate:prettier": "prettier \"src/**/*.js\" --check",
"validate:prettier": "prettier \"src/**/*.ts\" --check",
"validate:ts": "tsc --noEmit",
"example:start": "cd ./RNFBSDKExample && yarn start",
"example:ios": "cd ./RNFBSDKExample/ios && rm -f Podfile.lock && pod install && yarn ios",
"example:android": "cd ./RNFBSDKExample && yarn android --no-jetifier",
"example:clean": "cd RNFBSDKExample && \\rm -fr yarn.lock node_modules ios/Podfile.lock && cd ..",
"example:install": "cd RNFBSDKExample && yarn && cd ios && (rm -f Podfile.lock && pod install || true) && cd ../..",
"example:devcopy": "yarn prepare && cp -rv android ios lib src types *.podspec RNFBSDKExample/node_modules/react-native-fbsdk-next/",
"example:devcopy": "yarn prepare && cp -rv android ios lib src *.podspec RNFBSDKExample/node_modules/react-native-fbsdk-next/",
"semantic-release": "semantic-release",
"jest": "jest"
},
Expand All @@ -75,7 +74,6 @@
"LICENSE.txt",
"README.md",
"react-native-fbsdk-next.podspec",
"types",
"jest"
],
"dependencies": {},
Expand All @@ -92,38 +90,39 @@
"@semantic-release/github": "^8.0.2",
"@semantic-release/npm": "^8.0.3",
"@semantic-release/release-notes-generator": "^10.0.2",
"@types/react": "^16.14.15",
"@types/react-native": "^0.63.53",
"@typescript-eslint/eslint-plugin": "^5.7.0",
"@typescript-eslint/parser": "^5.7.0",
"babel-jest": "^27.3.1",
"babel-plugin-module-resolver": "^4.0.0",
"eslint": "^7",
"flow-bin": "^0.158.0",
"jest": "^27.3.1",
"metro-react-native-babel-preset": "^0.66.2",
"prettier": "^2.4.1",
"react": "17.0.2",
"react-native": "^0.66.2",
"react-test-renderer": "17.0.2",
"semantic-release": "^18.0.0"
"semantic-release": "^18.0.0",
"typescript": "^4.5.4"
},
"prettier": {
"requirePragma": true,
"singleQuote": true,
"trailingComma": "all",
"bracketSpacing": false,
"bracketSameLine": true,
"parser": "flow"
"parser": "typescript"
},
"@react-native-community/bob": {
"source": "src",
"output": "lib",
"targets": [
[
"commonjs",
{
"copyFlow": true
}
"commonjs"
],
"module"
"module",
"typescript"
]
},
"types": "types/index.d.ts"
}
}