From e54da2b1110ebda0f1dd5997adf2ebeeb3bd4da9 Mon Sep 17 00:00:00 2001 From: Michael Schramm Date: Mon, 3 Jan 2022 00:38:44 +0100 Subject: [PATCH] upgrade to nextjs 12, add visible logic check --- .eslintrc.js | 52 +- .gitignore | 1 + CHANGELOG.md | 2 + Dockerfile | 3 +- components/auth/footer.tsx | 76 +- components/form/admin/design.tab.tsx | 16 +- components/form/admin/end.page.tab.tsx | 20 +- .../form/admin/export.submission.action.tsx | 4 +- components/form/admin/field.card.tsx | 79 +- components/form/admin/fields.tab.tsx | 23 +- components/form/admin/logic.block.tsx | 52 +- components/form/admin/notification.card.tsx | 32 +- components/form/admin/notifications.tab.tsx | 2 +- components/form/admin/start.page.tab.tsx | 20 +- components/form/admin/submission.values.tsx | 2 - components/form/admin/types/date.type.tsx | 8 +- components/form/admin/types/slider.type.tsx | 12 +- components/form/layouts/card/field.tsx | 2 +- components/form/layouts/card/index.tsx | 59 +- components/form/layouts/card/page.tsx | 2 +- components/form/layouts/slider/field.tsx | 3 +- components/form/layouts/slider/index.tsx | 101 +- .../form/layouts/slider/page.module.scss | 1 + components/form/layouts/slider/page.tsx | 2 +- components/structure.tsx | 51 +- components/styled/button.tsx | 8 +- components/styled/color.change.ts | 61 - components/styled/date.input.tsx | 4 +- components/styled/input.tsx | 4 +- components/styled/markdown.tsx | 11 +- components/styled/number.input.tsx | 4 +- components/styled/select.tsx | 4 +- components/styled/textarea.input.tsx | 4 +- components/use.imerative.query.ts | 4 +- components/use.math.ts | 20 +- components/use.router.ts | 4 +- components/use.submission.ts | 10 +- components/user/admin/base.data.tab.tsx | 8 +- graphql/fragment/form.fragment.ts | 2 + graphql/mutation/form.create.mutation.ts | 2 +- graphql/mutation/form.delete.mutation.ts | 2 +- graphql/mutation/form.update.mutation.ts | 2 +- graphql/mutation/login.mutation.ts | 2 +- graphql/mutation/profile.update.mutation.ts | 2 +- graphql/mutation/register.mutation.ts | 2 +- .../mutation/submission.finish.mutation.ts | 2 +- .../mutation/submission.set.field.mutation.ts | 3 +- graphql/mutation/submission.start.mutation.ts | 2 +- graphql/mutation/user.delete.mutation.ts | 2 +- graphql/mutation/user.update.mutation.ts | 2 +- graphql/query/admin.profile.query.ts | 2 +- graphql/query/admin.statistic.query.ts | 2 +- graphql/query/admin.user.query.ts | 2 +- graphql/query/form.pager.query.ts | 2 +- graphql/query/form.public.query.ts | 2 +- graphql/query/submission.pager.query.ts | 2 +- graphql/query/user.pager.query.ts | 2 +- next-env.d.ts | 5 +- next.config.js | 11 +- next.config.type.ts | 1 + package.json | 86 +- pages/_app.tsx | 25 +- pages/admin/forms/[id]/index.tsx | 29 +- pages/index.tsx | 20 +- pages/login/index.tsx | 17 +- pages/register.tsx | 15 +- schema.graphql | 425 --- store/index.ts | 8 +- tsconfig.json | 3 +- yarn.lock | 3272 +++++++++-------- 70 files changed, 2361 insertions(+), 2366 deletions(-) delete mode 100644 components/styled/color.change.ts delete mode 100644 schema.graphql diff --git a/.eslintrc.js b/.eslintrc.js index 9eaccae..ea72d4e 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -6,22 +6,64 @@ module.exports = { tsconfigRootDir: __dirname, project: ['./tsconfig.json'], }, + plugins: [ + '@typescript-eslint/eslint-plugin', + '@typescript-eslint', + 'unused-imports' + ], extends: [ 'eslint:recommended', 'plugin:@typescript-eslint/eslint-recommended', 'plugin:@typescript-eslint/recommended', + 'plugin:@typescript-eslint/recommended-requiring-type-checking', 'plugin:react/recommended', 'plugin:jsx-a11y/recommended', - 'prettier/@typescript-eslint', - 'plugin:prettier/recommended', 'plugin:@typescript-eslint/recommended-requiring-type-checking', + 'prettier', ], rules: { - 'prettier/prettier': ['error', {}, { usePrettierrc: true }], + '@typescript-eslint/no-unsafe-assignment': 'off', + '@typescript-eslint/no-unsafe-argument': 'off', + '@typescript-eslint/no-unsafe-member-access': 'off', 'react/prop-types': 'off', '@typescript-eslint/no-empty-interface': 'off', - '@typescript-eslint/no-var-requires': 'off', - 'jsx-a11y/no-autofocus': 'off' + 'jsx-a11y/no-autofocus': 'off', + 'array-element-newline': ['error', { + 'ArrayExpression': 'consistent', + 'ArrayPattern': { + 'minItems': 3, + 'multiline': true, + } + }], + 'array-bracket-newline': ['error', { + 'minItems': 3, + 'multiline': true, + }], + 'indent': [ + 'error', + 2, + { + 'SwitchCase': 1 + } + ], + 'no-tabs': ['error'], + 'max-len': ['error', { + 'code': 100, + 'ignoreComments': true, + 'ignoreUrls': true, + 'ignoreTemplateLiterals': true, + 'ignoreTrailingComments': true, + 'ignoreStrings': true, + }], + 'quotes': ['error', 'single', { 'avoidEscape': true }], + 'comma-dangle': ['error', 'always-multiline'], + 'linebreak-style': [ + 'error', + 'unix' + ], + 'no-trailing-spaces': 'error', + 'eol-last': 'error', + 'unused-imports/no-unused-imports': 'error', }, settings: { react: { diff --git a/.gitignore b/.gitignore index fd5a4ce..11fc3f0 100644 --- a/.gitignore +++ b/.gitignore @@ -30,3 +30,4 @@ yarn-error.log* # development environments /.idea +schema.graphql diff --git a/CHANGELOG.md b/CHANGELOG.md index 27028e5..c6d0887 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,12 +16,14 @@ and this project adheres to [Semantic Versioning](http://semver.org/). - new slider field type - new card layout for forms - field logic +- add enviroment config ### Changed - combined notificationts to become more versatile - use exported hooks for graphql - disable swipe gesture +- upgrade to nextjs 12 ### Fixed diff --git a/Dockerfile b/Dockerfile index 1113fd7..3308049 100644 --- a/Dockerfile +++ b/Dockerfile @@ -30,7 +30,8 @@ WORKDIR /usr/src/app COPY --from=builder /usr/src/app /usr/src/app -ENV PORT=4000 +ENV PORT=4000 \ + NODE_ENV=production # Change to non-root privilege USER ohmyform diff --git a/components/auth/footer.tsx b/components/auth/footer.tsx index 5e8d624..bb4f76d 100644 --- a/components/auth/footer.tsx +++ b/components/auth/footer.tsx @@ -31,66 +31,66 @@ const AuthFooterInner: React.FC = (props) => {