Update hooks and pin stylua and luacheck to match pre-commit

This commit is contained in:
ViViDboarder 2023-06-09 13:20:28 -07:00
parent 8404ef0005
commit e36656e67d
2 changed files with 17 additions and 13 deletions

View File

@ -1,7 +1,7 @@
--- ---
repos: repos:
- repo: https://github.com/pre-commit/pre-commit-hooks - repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.1.0 rev: v4.4.0
hooks: hooks:
- id: trailing-whitespace - id: trailing-whitespace
- id: end-of-file-fixer - id: end-of-file-fixer
@ -14,9 +14,17 @@ repos:
vim/colors/.*\.vim vim/colors/.*\.vim
)$ )$
- repo: https://github.com/johnnymorganz/stylua - repo: https://github.com/johnnymorganz/stylua
rev: v0.15.2 rev: v0.17.1
hooks: hooks:
- id: stylua-github - id: stylua-github
- repo: https://github.com/lunarmodules/luacheck
rev: v1.1.0
hooks:
- id: luacheck
args:
- --globals
- vim
- --
- repo: local - repo: local
hooks: hooks:
- id: sort-json - id: sort-json
@ -25,12 +33,3 @@ repos:
entry: ./scripts/sort-json.sh entry: ./scripts/sort-json.sh
files: "(\\.json$|^neovim/packer_snapshots/)" files: "(\\.json$|^neovim/packer_snapshots/)"
types: [text] types: [text]
- id: luacheck
name: Luacheck
entry: luacheck
args:
- --globals
- vim
- --
language: system
types: [lua]

View File

@ -139,7 +139,9 @@ function install_linters() {
# Lua # Lua
if want_lang lua || want_lang neovim ;then if want_lang lua || want_lang neovim ;then
maybe_run luarocks --local install luacheck luafilesystem maybe_run luarocks --local install luafilesystem
# Version pinned to version in pre-commit
maybe_run luarocks --local install luacheck 1.1.0
fi fi
# Docker # Docker
@ -197,12 +199,15 @@ function install_fixers() {
# Lua # Lua
if want_lang lua || want_lang neovim ;then if want_lang lua || want_lang neovim ;then
# Version pinned to version in pre-commit
local stylua_version=0.17.1
if ! release-gitter --git-url "https://github.com/JohnnyMorganz/StyLua" \ if ! release-gitter --git-url "https://github.com/JohnnyMorganz/StyLua" \
--version "v$stylua_version" \
--map-arch arm64=aarch64 \ --map-arch arm64=aarch64 \
--map-system Windows=windows --map-system Linux=linux --map-system Darwin=macos \ --map-system Windows=windows --map-system Linux=linux --map-system Darwin=macos \
--extract-all --exec "chmod +x ~/bin/stylua" \ --extract-all --exec "chmod +x ~/bin/stylua" \
"stylua-{system}-{arch}.zip" ~/bin ; then "stylua-{system}-{arch}.zip" ~/bin ; then
maybe_run cargo install stylua maybe_run cargo install --version "$stylua_version" stylua
fi fi
fi fi