Skip to content

Commit

Permalink
build: Upgrade polkadot-js 4 7 2 (#761)
Browse files Browse the repository at this point in the history
* upgrade polkadot and react-native

* test: disabled failing tests temporarily

* test: restore tests

* fix: lint

* test: fix ts-ignore updated rule

* fix: lint and types

* test: bump nodejs version

* test: bump wasm-crypto needed for tests

* fix: update metadata
  • Loading branch information
Slesarew authored May 3, 2021
1 parent 4cb7d39 commit d0c1bbf
Show file tree
Hide file tree
Showing 22 changed files with 1,744 additions and 1,274 deletions.
180 changes: 94 additions & 86 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,91 +1,99 @@
const commonRules = {
"no-bitwise": "off",
"comma-dangle": ["error", "never"],
"object-curly-spacing": ["error", "always"],
"quotes": ["error", "single", { "avoidEscape": true }],
"react-native/no-inline-styles": "off",
"sort-keys": ["error", "asc", {"caseSensitive": true, "natural": false, "minKeys": 2}],
"import/order": ["error", {
"newlines-between": "always"
}]
'comma-dangle': ['error', 'never'],
'import/order': [
'error',
{
'newlines-between': 'always'
}
],
'no-bitwise': 'off',
'object-curly-spacing': ['error', 'always'],
quotes: ['error', 'single', { avoidEscape: true }],
'react-native/no-inline-styles': 'off',
'sort-keys': [
'error',
'asc',
{ caseSensitive: true, minKeys: 2, natural: false }
]
};

module.exports = {
extends: [
"@react-native-community",
"plugin:prettier/recommended",
"plugin:import/errors",
"plugin:import/warnings",
"plugin:import/typescript"
],
globals: { inTest: "writable" },
overrides: [
{
files: ["e2e/*.spec.js", "e2e/init.js", "e2e/utils.js"],
rules: {
"no-undef": "off"
}
},
{
files: ["**/*.ts", "**/*.tsx"],
env: { "browser": true, "es6": true, "node": true },
extends: [
"@react-native-community",
"plugin:prettier/recommended",
"plugin:import/errors",
"plugin:import/warnings",
"plugin:import/typescript",
"plugin:@typescript-eslint/eslint-recommended",
"plugin:@typescript-eslint/recommended"
],
parser: "@typescript-eslint/parser",
parserOptions: {
ecmaFeatures: { "jsx": true },
ecmaVersion: 2018,
sourceType: "module",
project: "./tsconfig.json"
},
plugins: ["@typescript-eslint", "react-hooks"],
rules: {
...commonRules,
"@typescript-eslint/no-explicit-any": 0,
"@typescript-eslint/semi": ["error"],
// deprecated: https://palantir.github.io/tslint/rules/no-use-before-declare/
"@typescript-eslint/no-use-before-define": 0, // ["error", { "variables": false }], // enable defining variables after react component;
"@typescript-eslint/no-non-null-assertion": 0,
'@typescript-eslint/camelcase': 0,
'@typescript-eslint/ban-ts-ignore': 0,
"no-void": "off",
"react-hooks/rules-of-hooks": "error",
"react-hooks/exhaustive-deps": "warn",
"semi": "off"
}
}
],
parserOptions: {
"ecmaVersion": 6,
"sourceType": "module",
"ecmaFeatures": {
"jsx": true
},
},
settings: {
"import/resolver": {
"node": {
"extensions": [".js", ".jsx", ".ts", ".tsx"]
},
"typescript": {
"alwaysTryTypes": true // always try to resolve types under `<roo/>@types` directory even it doesn't contain any source code, like `@types/unist`
},
},
"import/ignore": "react-navigation",
react: {
"pragma": "React", // Pragma to use, default to "React"
"version": "16.9.0", // React version, default to the latest React stable release
},
},
rules: {
...commonRules,
"no-unused-vars": ["error", { "args": "none" }],
}
extends: [
'@react-native-community',
'plugin:prettier/recommended',
'plugin:import/errors',
'plugin:import/warnings',
'plugin:import/typescript'
],
globals: { inTest: 'writable' },
ignorePatterns: ['**/node_modules/*'],
overrides: [
{
files: ['e2e/*.spec.js', 'e2e/init.js', 'e2e/utils.js'],
rules: {
'no-undef': 'off'
}
},
{
env: { browser: true, es6: true, node: true },
extends: [
'@react-native-community',
'plugin:@typescript-eslint/eslint-recommended',
'plugin:@typescript-eslint/recommended',
'plugin:import/errors',
'plugin:import/typescript',
'plugin:import/warnings',
'plugin:prettier/recommended'
],
files: ['**/*.ts', '**/*.tsx'],
parser: '@typescript-eslint/parser',
parserOptions: {
ecmaFeatures: { jsx: true },
ecmaVersion: 2018,
project: './tsconfig.json',
sourceType: 'module'
},
plugins: ['@typescript-eslint', 'react-hooks'],
rules: {
...commonRules,
'@typescript-eslint/ban-ts-comment': 'warn',
'@typescript-eslint/camelcase': 0,
'@typescript-eslint/no-explicit-any': 0,
'@typescript-eslint/no-non-null-assertion': 0,
'@typescript-eslint/no-use-before-define': 0, // ["error", { "variables": false }], // enable defining variables after react component;
'@typescript-eslint/semi': ['error'],
'no-void': 'off',
'react-hooks/exhaustive-deps': 'warn',
'react-hooks/rules-of-hooks': 'error',
// deprecated: https://palantir.github.io/tslint/rules/no-use-before-declare/
semi: 'off'
}
}
],
parserOptions: {
ecmaFeatures: {
jsx: true
},
ecmaVersion: 6,
sourceType: 'module'
},
rules: {
...commonRules,
'no-unused-vars': ['error', { args: 'none' }]
},
settings: {
'import/ignore': 'react-navigation',
'import/resolver': {
node: {
extensions: ['.js', '.jsx', '.ts', '.tsx']
},
typescript: {
alwaysTryTypes: true // always try to resolve types under `<roo/>@types` directory even it doesn't contain any source code, like `@types/unist`
}
},
react: {
pragma: 'React', // Pragma to use, default to "React"
version: '16.9.0' // React version, default to the latest React stable release
}
}
};
2 changes: 1 addition & 1 deletion .github/workflows/yarn-tools.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
- name: Install NodeJS
uses: actions/setup-node@v1
with:
node-version: '13.x'
node-version: '15.x'
- name: Cache Npm
uses: actions/cache@v1
with:
Expand Down
3 changes: 2 additions & 1 deletion babel.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ module.exports = {
root: ['.']
}
],
['./scripts/rewrite-node-global']
['./scripts/rewrite-node-global'],
['@babel/plugin-transform-modules-commonjs']
],
presets: ['module:metro-react-native-babel-preset']
};
36 changes: 22 additions & 14 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,15 @@
"e2e": "yarn e2e:ios && yarn e2e:android"
},
"dependencies": {
"@polkadot/api": "3.9.3",
"@polkadot/metadata": "^3.9.3",
"@polkadot/api": "4.7.2",
"@polkadot/metadata": "^4.7.2",
"@polkadot/reactnative-identicon": "0.53.1",
"@polkadot/util": "5.4.4",
"@polkadot/util-crypto": "5.4.4",
"@polkadot/types": "4.7.2",
"@polkadot/util": "6.3.1",
"@polkadot/util-crypto": "6.3.1",
"@polkadot/wasm-crypto": "^4.0.2",
"@polkadot/wasm-crypto-asmjs": "^4.0.2",
"@polkadot/wasm-crypto-wasm": "^4.0.2",
"@react-native-community/async-storage": "^1.11.0",
"@react-native-community/masked-view": "^0.1.6",
"@react-native-community/netinfo": "^5.9.3",
Expand All @@ -62,13 +66,14 @@
"react": "^16.11.0",
"react-native": "0.63.4",
"react-native-camera": "^3.21.0",
"react-native-crypto": "^2.2.0",
"react-native-elements": "^1.2.6",
"react-native-gesture-handler": "^1.6.0",
"react-native-keyboard-aware-scroll-view": "0.9.3",
"react-native-markdown-renderer": "^3.2.8",
"react-native-navbar-color": "^1.0.3",
"react-native-popup-menu": "^0.15.6",
"react-native-randombytes": "^3.5.3",
"react-native-randombytes": "^3.6.1",
"react-native-screens": "^2.0.0-alpha.32",
"react-native-secure-storage": "git+https://github.com/paritytech/react-native-secure-storage.git#master",
"react-native-svg": "12.1.0",
Expand All @@ -81,39 +86,42 @@
"@babel/cli": "^7.8.4",
"@babel/core": "^7.9.6",
"@babel/plugin-proposal-class-properties": "^7.8.3",
"@babel/plugin-transform-modules-commonjs": "^7.13.8",
"@babel/plugin-transform-runtime": "^7.9.6",
"@babel/preset-typescript": "^7.9.0",
"@babel/runtime": "^7.9.6",
"@react-native-community/eslint-config": "^1.1.0",
"@types/detox": "^14.5.2",
"@types/jasmine": "^3.5.12",
"@types/jest": "^25.2.3",
"@types/jest": "^26.0.20",
"@types/react": "^16.9.34",
"@types/react-native": "0.63.35",
"@typescript-eslint/eslint-plugin": "^2.26.0",
"@typescript-eslint/parser": "^2.28.0",
"@typescript-eslint/eslint-plugin": "^4.22.0",
"@typescript-eslint/parser": "^4.22.0",
"babel-eslint": "10.1.0",
"babel-jest": "26.6.3",
"babel-plugin-module-resolver": "^4.0.0",
"babel-plugin-rewrite-require": "^1.14.5",
"babel-plugin-tester": "^9.0.1",
"detox": "17.14.9",
"eslint": "^6.8.0",
"eslint-config-prettier": "^6.10.1",
"eslint": "^7.22.0",
"eslint-config-prettier": "^8.1.0",
"eslint-import-resolver-typescript": "^2.0.0",
"eslint-plugin-import": "^2.20.1",
"eslint-plugin-prettier": "^3.1.2",
"eslint-plugin-prettier": "^3.3.1",
"eslint-plugin-react-hooks": "^3.0.0",
"eslint-plugin-simple-import-sort": "^7.0.0",
"jest": "26.6.3",
"jetifier": "^1.6.5",
"metro-react-native-babel-preset": "^0.59.0",
"prettier": "2.0.2",
"prettier": "2.2.1",
"react-native-safe-area-context": "0.7.3",
"react-native-typescript-transformer": "^1.2.13",
"react-test-renderer": "16.13.1",
"reactotron-react-native": "5.0.0",
"ts-jest": "^26.5.1",
"typescript": "^3.9.7"
"ts-jest": "^26.5.3",
"typescript": "^4.2.3",
"yargs": "^16.2.0"
},
"resolutions": {
"kind-of": ">=6.0.3"
Expand Down
4 changes: 2 additions & 2 deletions src/components/IdentitiesSwitch.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ function ButtonWithArrow(props: {
return <ButtonIcon {...props} {...i_arrowOptions} />;
}

function IdentitiesSwitch({}: {}): React.ReactElement {
function IdentitiesSwitch({}: Record<string, never>): React.ReactElement {
const accountsStore = useContext(AccountsContext);
const navigation: StackNavigationProp<RootStackParamList> = useNavigation();
const [visible, setVisible] = useState(false);
Expand All @@ -62,7 +62,7 @@ function IdentitiesSwitch({}: {}): React.ReactElement {
params?: RootStackParamList[RouteName]
): void => {
setVisible(false);
// @ts-ignore
// @ts-ignore: https://github.com/react-navigation/react-navigation/pull/8389/files breaks things
navigation.navigate(screenName, params);
};

Expand Down
5 changes: 4 additions & 1 deletion src/components/TextInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,10 @@ interface Props extends TextInputProps {
error?: boolean;
}

export default class TextInput extends React.PureComponent<Props, {}> {
export default class TextInput extends React.PureComponent<
Props,
Record<string, unknown>
> {
static defaultProps = {
focus: false
};
Expand Down
53 changes: 53 additions & 0 deletions src/constants/metadata_fetching_log.txt
Original file line number Diff line number Diff line change
Expand Up @@ -305,3 +305,56 @@ S OK
S OK
* Updating westend
S OK
======
Metadata fetching started: 2021-05-03 13:15:02.359708249 UTC

* Updating kusama:
* Version 2030 up to date.

* Updating westend:
* Version 50 up to date.

* Updating edgeware:
W No version found in constants
* No updates made. No version in both existing and retrieved metadata. No changes in metadata.

* Updating kulupu:
E Networking or low-level protocol error: Failed to resolve IP addresses for this hostname: 0

* Updating centrifuge:
W RuntimeMetadata version incompatible
* No updates made. No version in both existing and retrieved metadata. No changes in metadata.

* Updating centrifugeAmber:
W RuntimeMetadata version incompatible
* No updates made. No version in both existing and retrieved metadata. No changes in metadata.

* Updating polkadot:
S Updated: new version 30 was fetched. Older version 29 metadata was sent to historical record.

* Updating rococo:
S Updated: new version 233 was fetched. Older version 232 metadata was sent to historical record.

Metadata fetching finished: 2021-05-03 13:15:08.461969512 UTC

Updating networkSpecs.ts file
* Updating kusama
S OK
* Updating centrifuge
S OK
* Updating centrifugeAmber
S OK
* Updating edgeware
S OK
* Updating kulupu
S OK
* Updating kusama
S OK
* Updating kusama
S OK
* Updating polkadot
S OK
* Updating rococo
S OK
* Updating westend
S OK
8 changes: 4 additions & 4 deletions src/constants/networkMetadata.ts

Large diffs are not rendered by default.

Loading

0 comments on commit d0c1bbf

Please sign in to comment.