Skip to content

jordanopensource/pre-commit-hooks

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 

Repository files navigation

JOSA Pre-commit Hooks

This repository contains JOSA's custom pre-commit hooks.

Available Hooks

  • Validate Flux - A script to validate Flux custom resources and Kustomize overlays.

  • Validate Eslint - A script to validate eslint rules on Javascript and Typescript files.

  • Run Samplr - A script to generate sample files.


validate-flux

This script downloads the Flux OpenAPI schemas, then it validates the Flux custom resources and the kustomize overlays using kubeconform. This script is meant to be run locally and in CI before the changes.

Prerequisites

You need the following to be installed on your machine before running this pre-commit script.

Usage

Add this to your .pre-commit-config.yaml:

-   repo: https://github.com/jordanopensource/pre-commit-hooks
    rev: v0.1.0  # Use the ref you want to point at
    hooks:
    -   id: validate-flux
    # -   id: ...

After the configuration is added, you'll need to run

pre-commit install -t pre-push

validate-eslint

This script runs eslint rule checks on staged files that have the following extensions:

  • ts
  • tsx
  • vue
  • js
  • jsx

Prerequisites

You need the following to be installed on your machine before running this pre-commit script.

Usage

Add this to your .pre-commit-config.yaml:

-   repo: https://github.com/jordanopensource/pre-commit-hooks
    rev: v0.2.0  # Use the ref you want to point at
    hooks:
    -   id: validate-eslint
    # -   id: ...

After the configuration is added, you'll need to run

pre-commit install -t pre-commit

run-samplr

This script runs the command samplr to generate .sample files in your repo. Please refer to the config in this repo to understand which files are supported.

Prerequisites

You need the following to be installed on your machine before running this pre-commit script.

Usage

Add this to your .pre-commit-config.yaml:

-   repo: https://github.com/jordanopensource/pre-commit-hooks
    rev: v0.1.0  # Use the ref you want to point at
    hooks:
    -   id: run-samplr
    # -   id: ...

After the configuration is added, you'll need to run

pre-commit install -t pre-commit