Important
This repository is now archived. Users are encouraged to use individual linting instead
These standards have been split out into their own repositories and exist within the LintKit group
Lint your code against Liquid Light conventions (yes, we use tabs and not spaces).
Once installed, run the lint command to see the linters available. Most linters have functionality to fix most of the issues found, this can be run by adding --fix to the command
e.g.
lint php:coding-standards --fix
Out of the box, running a lint run will run
scss:lintjs:lintphp:coding-standardslint composer:normalize
If, however, you want to run different linters (or lints with specific parameters), add a lint array to a scripts block in your composer.json. An example can be seen in this git repository's composer.json.
To update the linter once installed, run self-update
lint self-updateIf you wish to be on the bleeding edge (or a feature branch), you can use the --dev option
The following will put you on the main branch
lint self-update --devOr you can go onto an active feature branch with the following:
lint self-update --dev [branch name]e.g.
lint self-update --dev developThe linker builds and makes available several docker containers. Should you wish to use these instead, you can run something like the following:
export DOCKER_DEFAULT_PLATFORM=linux/amd64; docker run -it --rm -v $(pwd):/app ghcr.io/liquidlight/lint/phpstanThis will use the latest tagged image, you can see all the linters in the Container Registry.
To use the linter in Gitlab CI, you can use the following (where $IMAGE_NAME is the docker image)
lint:
image: $IMAGE_NAME
script:
- /lint/lint runAll the linters can be found at /lint/lint run, it is just the image name which needs updating
To use the Git repo as the source, you will need to download & install dependencies, which requires composer and npm running.
git clone git@github.com:liquidlight/lint.git
cd lint
composer install --no-dev && npm iYou can then move to the directory you wish to lint and run
/path/to/lint/cloned/directory/lint.php
If you wish for this to be globally runnable, you can symlink the lint.php file
cd /usr/local/bin
ln -s /path/to/lint/directory/lint.php lint
Then it can be used as above.
When adding a new linter please:
- Name the linter the name of the tool it is using, rather than a generic "lint" name (e.g.
php:coding-standardsinstead ofphp:lint) - If it is the only, or most common linter for that language, feel free to alias
lint - The linter should report by default and fix if
--fixis added (sometimes is involves adding--dry-runby default and removing if fixing is required)
Before the release run the following:
composer update- commitncuand thennpm update- commit- Then prepare the release:
- Move
UPCOMINGtoCHANGELOG, set version & add date - Update the version in
composer.json - Update the version
package.json - Run a
composer update - Run a
npm update - Commit the result as
release(major|minor|patch): X.X.X - Git tag
- Run the pipelines
- Move
Once you have released, set the version in composer.json back to dev-main and commit