-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1486 from maxmind/kevin/precious
Replace husky with precious
- Loading branch information
Showing
15 changed files
with
130 additions
and
684 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -62,3 +62,6 @@ typings/ | |
|
||
# next.js build output | ||
.next | ||
|
||
# Precious install | ||
local |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
[commands.prettier-scripts] | ||
type = "both" | ||
cmd = [ | ||
"npx", | ||
"prettier", | ||
"--parser", | ||
"typescript" | ||
] | ||
lint-flags = ["--check"] | ||
tidy-flags = ["--write"] | ||
path-args = "absolute-file" | ||
include = ["src/**/*.ts"] | ||
ok-exit-codes = 0 | ||
|
||
[commands.prettier-json] | ||
type = "both" | ||
cmd = [ | ||
"npx", | ||
"prettier", | ||
"--parser", | ||
"json" | ||
] | ||
lint-flags = ["--check"] | ||
tidy-flags = ["--write"] | ||
path-args = "absolute-file" | ||
include = ["**/*.json"] | ||
ok-exit-codes = 0 | ||
|
||
[commands.eslint-scripts] | ||
type = "both" | ||
cmd = [ | ||
"npx", | ||
"eslint", | ||
"--config", | ||
"eslint.config.mjs", | ||
] | ||
lint-flags = [] | ||
tidy-flags = ["--fix"] | ||
path-args = "absolute-file" | ||
include = ["src/**/*.ts", "src/**/*.js", "e2e/**/*.ts", "e2e/**/*.js"] | ||
ok-exit-codes = 0 | ||
|
||
[commands.tsc-scripts] | ||
type = "lint" | ||
cmd = [ | ||
"npx", | ||
"tsc", | ||
"--noEmit" | ||
] | ||
include = ["src/**/*.ts"] | ||
invoke = "once" | ||
path-args = "none" | ||
ok-exit-codes = 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
**/package.json | ||
**/package-lock.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
#!/usr/bin/env bash | ||
|
||
# This is for installing precious and other 3rd party libs needed for linting | ||
# in CI | ||
|
||
set -euo pipefail | ||
set -x | ||
|
||
if [ -z "${1:-}" ]; then | ||
echo "💥 You need to specify where to install precious. usage: ./bin/install-precious /path/to/bin/dir" | ||
exit 1 | ||
fi | ||
|
||
TARGET=$1 | ||
export TARGET | ||
|
||
curl --silent --location \ | ||
https://raw.githubusercontent.com/houseabsolute/ubi/master/bootstrap/bootstrap-ubi.sh | | ||
sh | ||
|
||
./"$TARGET"/ubi --project houseabsolute/omegasort --in "$TARGET" | ||
./"$TARGET"/ubi --project houseabsolute/precious --in "$TARGET" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
#!/bin/bash | ||
|
||
set -eu | ||
|
||
function timed_run() { | ||
description=$1 | ||
command=$2 | ||
timer=$(date +%s) | ||
|
||
$command | ||
exit_code=$? | ||
timer=$(($(date +%s) - timer)) | ||
|
||
verbose=${MM_VERBOSE_HOOKS:-0} | ||
|
||
if [ "$verbose" == "1" ]; then | ||
echo "ℹ️ $description - $timer seconds" | ||
echo "exit code: $exit_code" | ||
fi | ||
|
||
if [ $exit_code -ne 0 ]; then | ||
echo "ℹ️ $description - failed" | ||
exit $exit_code | ||
fi | ||
} | ||
|
||
timed_run "local/precious lint" "local/precious lint --staged" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
#!/bin/bash | ||
|
||
chmod +x git/hooks/* | ||
cd .git/hooks || exit | ||
rm -f pre-commit.sample | ||
ln -s ../../git/hooks/pre-commit . | ||
git config --local core.hooksPath .git/hooks |
Oops, something went wrong.