Commit 61a188e4 authored by Philip Paetz's avatar Philip Paetz Committed by Barath Kumar

chore: add linting tools to avoid yaml syntax errors in the future

parent 4ea3fc8c
Pipeline #13382 passed with stages
in 43 seconds
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
# dependencies
.npmrc
.yarnrc
node_modules
package-lock.json
*-debug.log*
*-error.log*
# testing
/.nyc_output
/coverage
# build output
/build
/dist
/storybook-static
# secrets
*.crt
*.key
*.rsa
.env
.ci-env
# editor files
.editorconfig
.idea
.vscode
# tmp files
/tmp
~*
.#*
.cache*
.gitlab-ci
# misc
.DS_Store
*.log
image: 'node:10.14'
stages:
- setup
- test
include:
- 'https://git.brickblock.sh/devops/ci-templates/raw/master/gitlab-ci/cache.yml'
- 'https://git.brickblock.sh/devops/ci-templates/raw/master/gitlab-ci/setup.yml'
- 'https://git.brickblock.sh/devops/ci-templates/raw/master/gitlab-ci/lint.yml'
\ No newline at end of file
{
"default": true,
"MD013": {
"line_length": 160
},
"no-inline-html": false,
"no-bare-urls": false
}
module.exports = {
extends: ['@commitlint/config-conventional'],
rules: {
'header-max-length': [1, 'always', 120]
}
}
\ No newline at end of file
{
"name": "ci-templates",
"version": "1.0.0",
"description": "Config templates for all our apps, services and libraries",
"repository": "git@ssh.brickblock.sh:devops/ci-templates.git",
"author": "Brickblock Dev Team <dev@brickblock.io>",
"private": true,
"license": "MIT",
"scripts": {
"---SECTION:CODE QUALITY---": "----------- CODE QUALITY ------------",
"lint": "yarn lint:json && yarn lint:yaml && yarn lint:markdown",
"lint:json": "jsonlint-cli package.json src/**/*.json",
"lint:yaml": "yamllint **/*.yaml **/*.yml --ignore=node_modules/**/*.yaml --ignore=node_modules/**/*.yml",
"lint:markdown": "markdownlint **/*.md --ignore node_modules --ignore CHANGELOG.md",
"health:comment": "Runs all checks (linters, flow, tests etc) to gauge the overall code health",
"health": "./scripts/healthcheck.sh"
},
"lint-staged": {
"concurrent": true,
"linters": {
"*.json": [
"jsonlint-cli",
"git add"
],
"*.yaml": [
"yamllint",
"git add"
],
"*.yml": [
"yamllint",
"git add"
],
"*.md": [
"markdownlint --ignore CHANGELOG.md",
"git add"
]
}
},
"husky": {
"hooks": {
"commit-msg:comment": "Ensure that commit messages adhere to the conventionalcommits.org standard",
"commit-msg": "commitlint -E HUSKY_GIT_PARAMS",
"post-merge:comment": "Automatically run 'yarn install' on post-merge if `yarn.lock` changed",
"post-merge": "$(pwd)/scripts/post-merge-or-rebase-githook.sh",
"post-rewrite:comment": "Automatically run 'yarn install' on post-rewrite if `yarn.lock` changed",
"post-rewrite": "$(pwd)/scripts/post-merge-or-rebase-githook.sh",
"pre-commit:comment": "Makes sure we don't commit bad code",
"pre-commit": "lint-staged",
"pre-push:comment": "Run healthcheck on prepush to ensure no bad code makes it to GitLab",
"pre-push": "yarn health"
}
},
"devDependencies": {
"@commitlint/cli": "^7.5.2",
"@commitlint/config-conventional": "^7.5.0",
"husky": "^1.3.1",
"jsonlint-cli": "^1.0.1",
"lint-staged": "^8.1.3",
"markdownlint-cli": "^0.13.0",
"yaml-lint": "^1.2.4"
}
}
#!/bin/bash
#
# RUN ALL CHECKS
#
# https://sipb.mit.edu/doc/safe-shell/
set -euf -o pipefail
# What is chronic?
# Chronic runs a command quietly unless it fails to suppess overly verbose output
# It's part of moreutils (https://joeyh.name/code/moreutils/) and can be installed:
# - macOS: brew install moreutils
# - Debian: https://packages.debian.org/sid/utils/moreutils
# - Ubuntu: https://packages.ubuntu.com/search?keywords=moreutils
# - Alpine: https://pkgs.alpinelinux.org/package/edge/testing/x86/moreutils
required_binaries=(yarn chronic);
for binary in "${required_binaries[@]}"; do
type "$binary" >/dev/null 2>&1 || { echo >&2 "❌ ${binary} binary not found. Please install ${binary} before running this script."; exit 1; }
done
printf "️Running linters…"
chronic yarn lint
printf " ✅\\n"
\ No newline at end of file
This source diff could not be displayed because it is too large. You can view the blob instead.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment