fintraffic-design / fds-coreui-components

Fintraffic Design System's Core UI Components. Work heavily in progress.
European Union Public License 1.2
0 stars 0 forks source link

Improve npm scripts and CI build #60

Open Haprog opened 8 months ago

Haprog commented 8 months ago
  1. CI build (.github/workflows/ci.yml) currently runs:

    npm ci
    npm run stylecheck
    npm run compile
    npm run lint

    This fails the build eagerly if one of the scripts exits with an error so for example prettier error in stylecheck will fail so that you don't even get to see possible errors from compile or lint scripts (there's a possibility that you will just see the error in CI log, fix that and push a fix only to be greeted with other/new errors when the build goes further).

    It would be better to run all code checks (tsc type errors, prettier, eslint, lit-analyzer) and show output from all of them in the build log before failing the build. This can be done for example with npm-run-all like so npm-run-all --continue-on-error stylecheck compile lint.

  2. We have ts-lit-plugin configured in tsconfig.json but warnings/errors from it can now only be seen with IDE plugins like lit-plugin in VS Code. We should include running lit-analyzer as part of CI build to include these warnings/errors also as part of linting step. Though there currently seems to be several unresolved issues reported by this so they need to be resolved (either by fixing or changing config) before enabling lit-analyzer in the CI build. See the output of npx lit-analyzer: "33 problems in 12 files (29 errors, 4 warnings)".

  3. It would also be good to have separate npm scripts for running each code check tool individually (when manually checking specific issues locally) and also another script for running them all in one (via npm-run-all). E.g. lint script could run npm-run-all --continue-on-error lint:* and there could be lint:eslint, lint:tsc (should run tsc --noEmit to only check errors), lint:prettier, lint:lit scripts.

  4. Make sure the script names are logical and remove possible unnecessary scripts. e.g. regarding current "build" vs "compile" I think we only need one of them and it should be enough to only run tsc if we have all code checks on "lint" script.

Haprog commented 8 months ago

Regarding point 2. Running lit-analyzer in feature/fds-navigation-mobile-version branch, the errors we have now are from rules: