diff --git a/.babelrc b/.babelrc index e0ea56c5fa..b535556b8f 100644 --- a/.babelrc +++ b/.babelrc @@ -5,9 +5,17 @@ "@babel/preset-typescript", ], "plugins": [ - // Reuse babel"s injected headers + // Reuse babel's injected headers "@babel/plugin-transform-runtime", + // Polyfill + ["polyfill-corejs3", { + "method": "usage-global", + }], + ["polyfill-regenerator", { + "method": "usage-global", + }], + // Handle absolute imports ["babel-plugin-module-resolver", { "root": ["."], @@ -27,21 +35,12 @@ // Extends javascript support "@babel/plugin-syntax-dynamic-import", - "@babel/plugin-proposal-do-expressions", // Extends react support "@babel/plugin-transform-react-constant-elements", - "@babel/plugin-transform-react-inline-elements", + // "@babel/plugin-transform-react-inline-elements", // Extends graphql support 'babel-plugin-graphql-tag', - - // Polyfill - ["polyfill-corejs3", { - "method": "usage-global", - }], - ["polyfill-regenerator", { - "method": "usage-global", - }], ], } diff --git a/.eslintrc.js b/.eslintrc.js index bf1f88a7d0..214ecd86af 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -38,6 +38,7 @@ const config = { }, rules: { strict: 1, + 'default-param-last': 0, 'no-unused-vars': 0, '@typescript-eslint/no-unused-vars': 1, @@ -76,6 +77,12 @@ const config = { 'react/jsx-indent': [2, 4], 'react/jsx-indent-props': [2, 4], 'react/jsx-filename-extension': ['error', { extensions: ['.js', '.jsx', '.ts', '.tsx'] }], + 'react/jsx-props-no-spreading': 0, + 'react/jsx-key': ['warn', { + checkFragmentShorthand: true, + checkKeyMustBeforeSpread: true, + }], + 'react/prop-types': [1, { ignore: [], customValidators: [], skipUndeclared: false }], 'react/forbid-prop-types': [1], 'react/destructuring-assignment': [1, 'always', { ignoreClassFields: true }], @@ -89,12 +96,16 @@ const config = { ], }], 'react/no-unused-state': 'warn', - 'react/jsx-props-no-spreading': 0, 'react/require-default-props': ['warn', { ignoreFunctionalComponents: true }], 'react/default-props-match-prop-types': ['warn', { allowRequiredDefaults: true, }], + + 'react/function-component-definition': [2, { + 'namedComponents': 'function-declaration', + 'unnamedComponents': 'function-expression', + }], 'react-hooks/rules-of-hooks': 'error', 'react-hooks/exhaustive-deps': 'warn', diff --git a/Dockerfile b/Dockerfile index d5d36b2af8..10a069acbf 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,13 +1,13 @@ -FROM node:12.20-alpine +FROM node:lts-alpine MAINTAINER togglecorp info@togglecorp.com RUN apk update\ - && apk add --no-cache git bash + && apk add --no-cache git bash python3 g++ make WORKDIR /code COPY ./package.json ./yarn.lock /code/ -RUN yarn install --network-concurrency 1 +RUN yarn install --frozen-lockfile COPY . /code/ diff --git a/app/Base/components/AuthPopup/index.tsx b/app/Base/components/AuthPopup/index.tsx index 51d32de98a..ccd3c079fb 100644 --- a/app/Base/components/AuthPopup/index.tsx +++ b/app/Base/components/AuthPopup/index.tsx @@ -19,6 +19,8 @@ function AuthPopup() { return ( ( + USER_NOTIFICATIONS_COUNT, + { + pollInterval: NOTIFICATION_POLL_INTERVAL, + }, + ); + const [logout] = useMutation( LOGOUT, { onCompleted: (data) => { if (data.logout?.ok) { setUser(undefined); + } else { + alert.show( + 'Failed to logout.', + { variant: 'error' }, + ); } - // FIXME: handle failure }, - // FIXME: handle failure + onError: () => { + alert.show( + 'Failed to logout.', + { variant: 'error' }, + ); + }, }, ); @@ -70,18 +108,22 @@ function Navbar(props: Props) { message: 'Are you sure you want to logout?', }); + const notificationsCount = notifications?.notifications?.totalCount; + return (