Milo is a linter tool that will check for both syntax correctness and style recommendations in HTML files. The end goal is to have a single binary that could be used in the context of a CI server which could check the codebase HTML before PR's get merged.
You can download the precompiled Milo binary from the releases page.
If you have Go installed in your system you can build from source:
go install github.com/wawandco/milo/cmd/milo@latest
On github you can use Milo action to run in your workflows. For example:
name: Main Workflow
on: [push]
jobs:
lint:
name: HTML Linting (Milo)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
# Run the milo
- uses: wawandco/milo-action@v0.2.0
with:
folder: "templates"
version: "v0.6.0"
lint-go:
...
See more instructions on the milo-action repo.
milo review folder_to_analize
Example:
milo review templates
milo review templates/file.html
# It also supports multiple folders or files
milo review templates/file.html templates/another.html other_folder
By default Milo will run all the linters it has. However, some teams will want to disable some of the linters in the list, if this is your case you can add a .milo.yml
file in the root of your codebase.
Once you have installed Milo it can generate that file by running:
milo init
That .milo.yml
will look like the following example:
output: text # could be `text`, `github` or `silent`
reviewers:
- doctype/present
- ...
This file will be used by the Milo binary to determine which reviewers to run our files against.
Milo uses the following reviewers:
<title>
must be present inside <head>
tag.<style>
must not be used.src
, href
and data
attributes of must have a value.ol
and ul
must only have li
direct child tags.This repo depends heavily in the following libraries that deserve all the credit for making Milo possible:
We copied this in our source because we needed to make some modifications to it. Our goal long term goal is to contribute back as much as possible.
Milo is Copyright © 2020 Wawandco SAS. It is free software, and may be redistributed under the terms specified in the LICENSE file.