Skip to content
This repository has been archived by the owner on Sep 22, 2021. It is now read-only.

api bump v-3.2.1 #1089

Merged
merged 11 commits into from
Jan 26, 2021
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ lint-back-end:
- cd auth-server
- yarn install
- yarn lint
- yarn tsc
- yarn tsc --resolveJsonModule
rules:
- changes:
- "auth-server/**/*"
Expand Down
8 changes: 4 additions & 4 deletions auth-server/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@
},
"homepage": "http://polkassembly.io/",
"dependencies": {
"@polkadot/api": "^2.10.1",
"@polkadot/util": "^4.2.1",
"@polkadot/util-crypto": "^4.2.1",
"@polkadot/api": "^3.4.1",
"@polkadot/util": "^5.2.3",
"@polkadot/util-crypto": "^5.2.3",
"@sendgrid/mail": "^6.5.5",
"apollo-server": "^2.14.2",
"apollo-server-express": "^2.14.2",
Expand Down Expand Up @@ -61,7 +61,7 @@
"validator": "^12.2.0"
},
"devDependencies": {
"@polkadot/types": "^2.10.1",
"@polkadot/types": "^3.4.1",
"@types/chai": "^4.2.11",
"@types/cookie-parser": "^1.4.2",
"@types/dotenv": "^8.2.0",
Expand Down
324 changes: 145 additions & 179 deletions auth-server/yarn.lock

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions front-end/.eslintcache

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion front-end/.eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
"react-hooks/rules-of-hooks": "error",
"react-hooks/exhaustive-deps": "warn",
"semi": [2, "always"],
"simple-import-sort/sort": "error",
"simple-import-sort/imports": "error",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a heads-up.
I bumped simple-import-sort, which resulted in lint error something like "cannot find simple-import-sort/sort rules".
You will 100% get the same in the other projects when bumping it as well.

"sort-keys": ["error", "asc", {"caseSensitive": true, "natural": false, "minKeys": 2}],
"switch-colon-spacing": ["error", {"after": true, "before": false}]
}
Expand Down
9 changes: 9 additions & 0 deletions front-end/config-overrides.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
module.exports = function override(webpackConfig) {
webpackConfig.module.rules.push({
test: /\.mjs$/,
include: /node_modules/,
type: "javascript/auto"
});

return webpackConfig;
}
96 changes: 49 additions & 47 deletions front-end/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,51 +19,51 @@
],
"dependencies": {
"@ardatan/graphql-tools": "^4.1.0",
"@polkadot/api": "^2.10.1",
"@polkadot/extension-dapp": "^0.35.1",
"@polkadot/extension-inject": "^0.35.1",
"@polkadot/react-identicon": "^0.61.1",
"@polkadot/ui-settings": "^0.62.1",
"@polkadot/util": "^4.2.1",
"@polkadot/util-crypto": "^4.2.1",
"@polkadot/api": "^3.4.1",
"@polkadot/extension-dapp": "^0.36.1",
"@polkadot/extension-inject": "^0.36.1",
"@polkadot/react-identicon": "^0.65.1",
"@polkadot/ui-settings": "^0.65.1",
"@polkadot/util": "^5.2.3",
"@polkadot/util-crypto": "^5.2.3",
"@polkassembly/util": "^0.2.0",
"@substrate/context": "^0.5.1",
"@xstyled/styled-components": "^1.17.1",
"@substrate/context": "^0.5.2",
"@xstyled/styled-components": "^2.1.0",
"apollo-cache": "^1.3.5",
"apollo-cache-inmemory": "^1.6.6",
"apollo-client": "^2.6.10",
"apollo-link": "^1.2.14",
"apollo-link-context": "^1.0.20",
"apollo-link-http": "^1.5.17",
"apollo-link-token-refresh": "^0.3.1",
"bn.js": "^5.1.2",
"detect-browser": "^5.1.0",
"graphql": "^15.1.0",
"graphql-tag": "^2.10.3",
"apollo-link-token-refresh": "^0.3.2",
"bn.js": "^5.1.3",
"detect-browser": "^5.2.0",
"graphql": "^15.4.0",
"graphql-tag": "^2.11.0",
"graphql-toolkit": "^0.7.5",
"jsonwebtoken": "^8.5.1",
"moment": "^2.26.0",
"query-string": "^6.13.0",
"react": "^16.13.1",
"moment": "^2.29.1",
"query-string": "^6.13.8",
"react": "^17.0.1",
"react-apollo": "^3.1.5",
"react-apollo-hooks": "^0.5.0",
"react-dom": "^16.13.1",
"react-dom": "^17.0.1",
"react-helmet": "^6.0.0",
"react-hook-form": "^5.7.2",
"react-icons": "^3.10.0",
"react-markdown": "^4.3.1",
"react-mde": "^10.1.0",
"react-icons": "^4.1.0",
"react-markdown": "^5.0.3",
"react-mde": "^11.0.0",
"react-router-dom": "^5.2.0",
"react-scripts": "^3.4.1",
"react-scripts": "^4.0.1",
"semantic-ui-css": "^2.4.1",
"semantic-ui-react": "^0.88.2",
"styled-components": "^5.1.1",
"typescript": "^3.9.5"
"styled-components": "^5.2.1",
"typescript": "^4.1.3"
},
"scripts": {
"analyze": "node scripts/analyze.js",
"start": "react-scripts start",
"build": "react-scripts build",
"build": "react-app-rewired build",
"test": "react-scripts test",
"eject": "react-scripts eject",
"codegen": "graphql-codegen --require dotenv/config --config codegen.yml",
Expand All @@ -89,43 +89,45 @@
]
},
"devDependencies": {
"@graphql-codegen/cli": "1.15.1",
"@graphql-codegen/typescript": "1.15.1",
"@graphql-codegen/typescript-operations": "1.15.1",
"@graphql-codegen/cli": "1.20.0",
"@graphql-codegen/typescript": "1.20.0",
"@graphql-codegen/typescript-operations": "1.17.13",
"@graphql-codegen/typescript-react-apollo": "1.15.1",
"@storybook/addon-actions": "^5.3.19",
"@storybook/addon-knobs": "^5.3.19",
"@storybook/addon-storyshots": "^5.3.19",
"@storybook/react": "^5.3.19",
"@types/jest": "^25.2.3",
"@types/jest": "^26.0.20",
"@types/jsonwebtoken": "^8.5.0",
"@types/node": "14.0.12",
"@types/react": "16.9.35",
"@types/react-dom": "16.9.8",
"@types/react-helmet": "^5.0.15",
"@types/node": "14.14.20",
"@types/react": "17.0.0",
"@types/react-dom": "17.0.0",
"@types/react-helmet": "^6.1.0",
"@types/react-router-dom": "^5.1.5",
"@types/storybook__addon-knobs": "^5.2.1",
"@types/storybook__addon-storyshots": "^5.3.1",
"@types/storybook__react": "^5.2.1",
"@types/styled-components": "^5.1.0",
"@typescript-eslint/eslint-plugin": "^3.2.0",
"@typescript-eslint/parser": "^3.2.0",
"@types/styled-components": "^5.1.7",
"@typescript-eslint/eslint-plugin": "^4.13.0",
"@typescript-eslint/parser": "^4.13.0",
"dotenv": "^8.2.0",
"eslint-config-semistandard": "^15.0.0",
"eslint-config-standard": "^14.1.1",
"eslint-plugin-header": "^3.0.0",
"eslint-plugin-import": "^2.21.1",
"eslint-config-semistandard": "^15.0.1",
"eslint-config-standard": "^16.0.2",
"eslint-plugin-header": "^3.1.0",
"eslint-plugin-import": "^2.22.1",
"eslint-plugin-node": "^11.1.0",
"eslint-plugin-promise": "^4.2.1",
"eslint-plugin-react": "^7.20.0",
"eslint-plugin-react-hooks": "^4.0.4",
"eslint-plugin-simple-import-sort": "^5.0.3",
"eslint-plugin-standard": "^4.0.1",
"eslint-plugin-react": "^7.22.0",
"eslint-plugin-react-hooks": "^4.2.0",
"eslint-plugin-simple-import-sort": "^7.0.0",
"eslint-plugin-standard": "^5.0.0",
"progress-bar-webpack-plugin": "^2.1.0",
"react-test-renderer": "^16.13.1",
"react-app-rewire-typescript-babel-preset": "^3.0.0",
"react-app-rewired": "^2.1.8",
"react-test-renderer": "^17.0.1",
"require-context.macro": "^1.2.2",
"ts-jest": "^26.1.0",
"webpack-bundle-analyzer": "^3.8.0"
"ts-jest": "^26.4.4",
"webpack-bundle-analyzer": "^4.3.0"
},
"resolutions": {
"bn.js": "^5.1.1",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,13 @@ const EndorseTip = ({
const [isCouncil, setIsCouncil] = useState(false);
const [forceEndorse, setForceEndorse] = useState(false);
const councilQueryresult = useGetCouncilMembersQuery();
const currentCouncil: string[] = [];
const [currentCouncil, setCurrentCouncil] = useState<string[]>([]);
const { api, isApiReady } = useContext(ApiPromiseContext);
const { addresses } = useContext(UserDetailsContext);

councilQueryresult.data?.councils?.[0]?.members?.forEach( member => {currentCouncil.push(member?.address);});
councilQueryresult.data?.councils?.[0]?.members?.forEach( member => {
setCurrentCouncil([...currentCouncil, member?.address]);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A if could be needed here, I don't see why member would be undefined, but adding something like the following wouln't hurt:

Suggested change
setCurrentCouncil([...currentCouncil, member?.address]);
if (member)
setCurrentCouncil([...currentCouncil, member.address]);
}

});

useEffect(() => {
// it will iterate through all addresses
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,13 @@ const VoteMotion = ({
const [isCouncil, setIsCouncil] = useState(false);
const [forceVote, setForceVote] = useState(false);
const councilQueryresult = useGetCouncilMembersQuery();
const currentCouncil: string[] = [];
const [currentCouncil, setCurrentCouncil] = useState<string[]>([]);
const { api, isApiReady } = useContext(ApiPromiseContext);
const { addresses } = useContext(UserDetailsContext);

councilQueryresult.data?.councils?.[0]?.members?.forEach( member => {currentCouncil.push(member?.address);});
councilQueryresult.data?.councils?.[0]?.members?.forEach( member => {
setCurrentCouncil([...currentCouncil, member?.address]);
});

useEffect( () => {
// it will iterate through all addresses
Expand Down
5 changes: 3 additions & 2 deletions front-end/src/screens/BountyPost/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,16 @@
// of the Apache-2.0 license. See the LICENSE file for details.

import React from 'react';
import { useParams } from 'react-router-dom';
import { useRouter } from 'src/hooks';

import Post from '../../components/Post/Post';
import { useBountyPostAndCommentsQuery } from '../../generated/graphql';
import FilteredError from '../../ui-components/FilteredError';
import Loader from '../../ui-components/Loader';

export default () => {
const { id } = useParams();
const { query } = useRouter();
Copy link
Collaborator

@Tbaut Tbaut Jan 13, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The reason I did all these changes is because TS was complaining that "id can't be found in type {}".
The obvious problem here is the typing that is wrong (and this comes from @types/react-router-dom). I kind of when around it by using a hook that was there, and type correctly what I received with as string.

Another, maybe better way would be to keep using the useParams<Record<string, string>>(). Up to you what you prefer.

const id = query['id'] as string;
const idNumber = Number(id) || 0;
const { data, error, refetch } = useBountyPostAndCommentsQuery({ variables: { 'id': idNumber } });

Expand Down
5 changes: 3 additions & 2 deletions front-end/src/screens/DiscussionPost/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// of the Apache-2.0 license. See the LICENSE file for details.

import React from 'react';
import { useParams } from 'react-router-dom';
import { useRouter } from 'src/hooks';

import Post from '../../components/Post/Post';
import { useDiscussionPostAndCommentsQuery } from '../../generated/graphql';
Expand All @@ -12,7 +12,8 @@ import Loader from '../../ui-components/Loader';

export default () => {

const { id } = useParams();
const { query } = useRouter();
const id = query['id'] as string;
const idNumber = Number(id) || 0;
const { data, error, refetch } = useDiscussionPostAndCommentsQuery({ variables: { 'id': idNumber } });

Expand Down
5 changes: 3 additions & 2 deletions front-end/src/screens/MotionPost/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,16 @@
// of the Apache-2.0 license. See the LICENSE file for details.

import React from 'react';
import { useParams } from 'react-router-dom';
import { useRouter } from 'src/hooks';

import Post from '../../components/Post/Post';
import { useMotionPostAndCommentsQuery } from '../../generated/graphql';
import FilteredError from '../../ui-components/FilteredError';
import Loader from '../../ui-components/Loader';

export default () => {
const { id } = useParams();
const { query } = useRouter();
const id = query['id'] as string;
const idNumber = Number(id) || 0;
const { data, error, refetch } = useMotionPostAndCommentsQuery({ variables: { 'id': idNumber } });

Expand Down
5 changes: 3 additions & 2 deletions front-end/src/screens/ProposalPost/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,16 @@
// of the Apache-2.0 license. See the LICENSE file for details.

import React from 'react';
import { useParams } from 'react-router-dom';
import { useRouter } from 'src/hooks';

import Post from '../../components/Post/Post';
import { useProposalPostAndCommentsQuery } from '../../generated/graphql';
import FilteredError from '../../ui-components/FilteredError';
import Loader from '../../ui-components/Loader';

export default () => {
const { id } = useParams();
const { query } = useRouter();
const id = query['id'] as string;
const idNumber = Number(id) || 0;
const { data, error, refetch } = useProposalPostAndCommentsQuery({ variables: { 'id': idNumber } });

Expand Down
5 changes: 3 additions & 2 deletions front-end/src/screens/ReferendumPost/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,16 @@
// of the Apache-2.0 license. See the LICENSE file for details.

import React from 'react';
import { useParams } from 'react-router-dom';
import { useRouter } from 'src/hooks';

import Post from '../../components/Post/Post';
import { useReferendumPostAndCommentsQuery } from '../../generated/graphql';
import FilteredError from '../../ui-components/FilteredError';
import Loader from '../../ui-components/Loader';

export default () => {
const { id } = useParams();
const { query } = useRouter();
const id = query['id'];
const idNumber = Number(id) || 0;
const { data, error, refetch } = useReferendumPostAndCommentsQuery({ variables: { 'id': idNumber } });

Expand Down
5 changes: 3 additions & 2 deletions front-end/src/screens/TipPost/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,16 @@
// of the Apache-2.0 license. See the LICENSE file for details.

import React from 'react';
import { useParams } from 'react-router-dom';
import { useRouter } from 'src/hooks';

import Post from '../../components/Post/Post';
import { useTipPostAndCommentsQuery } from '../../generated/graphql';
import FilteredError from '../../ui-components/FilteredError';
import Loader from '../../ui-components/Loader';

export default () => {
const { hash } = useParams();
const { query } = useRouter();
const hash = query['hash'] as string;
const { data, error, refetch } = useTipPostAndCommentsQuery({ variables: { hash } });

if (error?.message) return <FilteredError text={error.message}/>;
Expand Down
5 changes: 3 additions & 2 deletions front-end/src/screens/TreasuryPost/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,16 @@
// of the Apache-2.0 license. See the LICENSE file for details.

import React from 'react';
import { useParams } from 'react-router-dom';
import { useRouter } from 'src/hooks';

import Post from '../../components/Post/Post';
import { useTreasuryProposalPostAndCommentsQuery } from '../../generated/graphql';
import FilteredError from '../../ui-components/FilteredError';
import Loader from '../../ui-components/Loader';

export default () => {
const { id } = useParams();
const { query } = useRouter();
const id = query['id'] as string;
const idNumber = Number(id) || 0;
const { data, error, refetch } = useTreasuryProposalPostAndCommentsQuery({ variables: { 'id': idNumber } });

Expand Down
5 changes: 3 additions & 2 deletions front-end/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"declaration": true,
"downlevelIteration": true,
"esModuleInterop": true,
"jsx": "react",
"jsx": "react-jsx",
"lib": [
"dom",
"esnext"
Expand All @@ -19,7 +19,8 @@
"resolveJsonModule": true,
"isolatedModules": true,
"noEmit": true,
"allowJs": true
"allowJs": true,
"noFallthroughCasesInSwitch": true
},
"exclude": [
"**/generated/**/*",
Expand Down
Loading