Skip to content

Conversation

@dgolubevs
Copy link

@dgolubevs dgolubevs commented Nov 2, 2022

JIRA link

https://companieshouse.atlassian.net/browse/BI-9132

Change description

  • add nmprc, nvmrc
  • update package versions
  • make changes in files related to migration to 16 version

Copy link
Contributor

@SteveHicksCH SteveHicksCH left a comment

Choose a reason for hiding this comment

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

A couple of comments which are probably more for my education than anything else

@dgolubevs dgolubevs force-pushed the feature/BI-9132-upgrade-to-node16 branch from 88e8a8a to c4b2aec Compare November 3, 2022 13:29
@dgolubevs dgolubevs force-pushed the feature/BI-9132-upgrade-to-node16 branch from c4b2aec to f00cdff Compare November 3, 2022 13:38
Copy link

@mouhajer-ch mouhajer-ch left a comment

Choose a reason for hiding this comment

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

Could you please make sure that the description and Jira link are set correctly.

.eslintrc Outdated
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/recommended",
"standard"

Choose a reason for hiding this comment

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

Has to be agreed across other services. I use these recommended

        "eslint:recommended",
        "plugin:@typescript-eslint/eslint-recommended",
        "plugin:@typescript-eslint/recommended"

and please we do not need trailing commas (RIP IE8)

Copy link
Author

Choose a reason for hiding this comment

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

],
"object-curly-newline": [
"error"
],
Copy link

@mouhajer-ch mouhajer-ch Nov 11, 2022

Choose a reason for hiding this comment

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

Played a bit with it. This is one possible config

{
    "parserOptions": {
        "ecmaVersion": 8,
        "sourceType": "module",
        "ecmaFeatures": {}
    },
    "extends": [
        "eslint:recommended",
        "plugin:@typescript-eslint/eslint-recommended",
        "plugin:@typescript-eslint/recommended"
    ],
    "parser": "@typescript-eslint/parser",
    "plugins": [
        "@typescript-eslint",
        "chai-friendly"
    ],
    "overrides": [
        {
            "files": ["config.ts"],
            "rules": {
                "no-process-env": "off"
            }
        }, {
            "files": ["*.test.ts", "*.spec.ts"],
            "rules": {
                "no-process-env": "off",
                "no-unused-expressions": "off",
                "chai-friendly/no-unused-expressions": 2,
                "no-magic-numbers": "off"
            }
        }
    ],
    "rules": {
        "no-console": "warn",
        "no-eval": "error",
        "eol-last": ["error", "always"],
        "object-curly-spacing": [
            "error",
            "always"
        ],
        "indent": ["error", 4],
        "padded-blocks": "off",
        "quotes": ["error", "double"],
        "semi": ["error", "always"],
        "space-before-function-paren": ["error", {
            "anonymous": "always",
            "named": "never"
          }
        ],
        "operator-linebreak": ["error", "after"],
        "no-undef": "off",
        "no-extra-semi": 2,
        "no-process-env": 2,
        "no-unused-vars": "off",
        "@typescript-eslint/no-unused-vars": "error",
        "@typescript-eslint/no-explicit-any": "off",
        "@typescript-eslint/camelcase": "off",
        "@typescript-eslint/explicit-function-return-type": "off",
        "@typescript-eslint/no-magic-numbers": "off"
    },
    "env": {
        "node": true,
        "commonjs": true,
        "mocha": true,
        "es6": true
    }
}

@@ -1,10 +1,11 @@
FROM 169942020521.dkr.ecr.eu-west-1.amazonaws.com/base/node:14-alpine-builder
FROM 169942020521.dkr.ecr.eu-west-1.amazonaws.com/base/node:14-alpine-runtime
FROM 169942020521.dkr.ecr.eu-west-1.amazonaws.com/base/node:16-alpine-builder

Choose a reason for hiding this comment

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

Great work, finally we can move to the 16

@@ -1,3 +1,3 @@
$govuk-assets-path: "/restricted-word/public/";
$govuk-assets-path: "/admin/restricted-word/public/";

Choose a reason for hiding this comment

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

We should remove sass files from the service. Compile it once and add it on our CDN. I have done it in other service, will improve maintainability, performance and reduces dependencies issue (gulp, gulp-sass, node-sass ...). Check here

Copy link
Author

Choose a reason for hiding this comment

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

sass files compiled to css
this change required because by this path browser is looking font files

Copy link
Author

Choose a reason for hiding this comment

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

gulp can be completele removed from project.
all what doing gulp can be done in npm commends

    "build:sass": "node-sass --importer node_modules/node-sass-package-importer/dist/cli.js -o dist/stylesheets ./scss/application.scss",
    "build:views": "cp -r views dist/",
    "build:govuk": "cp -v -r node_modules/govuk-frontend/govuk/assets/**/* ./dist",
    "build": "npm run tsc && npm run build:views && npm run build:sass &&  npm run build:govuk",
    "build:prod": "npm run build && webpack --mode production",

Choose a reason for hiding this comment

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

^^^ Good points, but separate PR? Could we debate this outside of this PR, agree, and raise a ticket?

Copy link
Author

Choose a reason for hiding this comment

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

this change required to give ability to browser find font and images

gulp changes should be in other story

src/app.ts Outdated
app.use(sessionMiddleware);
app.use(helmet());
app.use(helmet({
contentSecurityPolicy: false,

Choose a reason for hiding this comment

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

Why you want to disable CSP? Check here and here for help/examples

Copy link
Author

Choose a reason for hiding this comment

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

changed

tsconfig.json Outdated
"experimentalDecorators": true,
"strictNullChecks": true,
"sourceMap": true,
"noImplicitAny": false,
Copy link

@mouhajer-ch mouhajer-ch Nov 11, 2022

Choose a reason for hiding this comment

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

Good one, "noImplicitAny": false should be set in all other project.

Could you please make sure lint is called by our sonar, it does not seem called, don't you think? we have got many config example in other repo

Choose a reason for hiding this comment

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

We will add Sonar in a separate PR

Copy link
Contributor

Choose a reason for hiding this comment

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

Shouldn't noImplicitAny be true instead? Setting it to false turns off the feature and might mask errors in type declarations

const path = require("path");

module.exports = {
mode: "development",
Copy link

@mouhajer-ch mouhajer-ch Nov 11, 2022

Choose a reason for hiding this comment

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

I do not understand what client/fancyFramework.js is used for. Is it for production? can be moved to our CDN and reduce our dependency on web pack?

Copy link
Author

Choose a reason for hiding this comment

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

I don't understand also

@mouhajer-ch
Copy link

Sonar does not seem correctly configured in this service, we need to check the quality of our PRs including this one.

@dgolubevs
Copy link
Author

done changes please review

Copy link
Contributor

@SteveHicksCH SteveHicksCH left a comment

Choose a reason for hiding this comment

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

Looks fine by me

@ch-tstrickland
Copy link

Sonar does not seem correctly configured in this service, we need to check the quality of our PRs including this one.

We will add Sonar in a separate PR

This is needed to specify the version of Node used when run.
npm version 8 is not yet supported in the build system.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants