Skip to content

Add static checks for html files

deck requested to merge deckbsd/polaris:static-checks-html into master

This MR is a proposal to solve issue #80 (closed).

What tool is used ?

It's Prettier. More informations can be found here

What's in there ?

Two more tox commands:

  • one that will check the syntax of html files inside the polaris folder when you will run the tox command like usual or with the tox -e prettier command to run only that check.
  • one that you can apply to format your js,css,html code tox -e prettier-apply

The CI gitlab build have been modified to add a step to verify the format during the build.

prettier1

prettier2

The README also have been updated to explain those changes and to specify that prettier needs to be installed by hands. That's unfortunate, but i didn't found another way (neither another tool that doesn't need nodejs or that is a python module).

Sides

Locally : It's tox that will checks the files (with prettier command). Gitlab build : The check will be performed by a special step dedicated to that called static_js_css defined by:

static_js_css:
  stage: static
  image: ${GITLAB_CI_IMAGE_NODE}
  script:
    - npm install -g prettier
    - prettier --check "./polaris/**/*.html"

prettierbuild

Notes

At this moment, i didn't add any prettier config file, well just because i'm not an web synthax expert ^^, but it's totally doable.

Edited by deck

Merge request reports