Skip to content

Commit

Permalink
pre-commit for frontend (#23)
Browse files Browse the repository at this point in the history
  • Loading branch information
sneridagh authored Jun 7, 2024
1 parent d13a38f commit 6df9ed1
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 3 deletions.
1 change: 1 addition & 0 deletions frontend_addon/cookiecutter.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
"__version_mrs_developer": "^2.2.0",
"__version_pnpm": "9.1.1",
"__version_release_it": "^17.1.1",
"__version_pre_commit": "3.7.1",
"__gha_version_node": "20.x",
"__gha_version_checkout": "v4",
"__gha_version_setup_node": "v4",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,27 @@
repos:
- repo: https://github.com/pre-commit/mirrors-eslint
rev: 'v9.2.0'
- repo: local
hooks:
- id: prettier
name: prettier
entry: pnpm exec prettier --write
language: system
files: '^packages/.*/src/.*/?.*.(js|jsx|ts|tsx)$'
types: [file]
- id: eslint
files: '^packages/.*/src/.*/*.(js,jsx,ts,tsx)$'
name: eslint
entry: pnpm exec eslint --max-warnings=0 --fix
language: system
files: '^packages/.*/src/.*/?.*.(js|jsx|ts|tsx)$'
types: [file]
- id: stylelint
name: stylelint
entry: pnpm exec stylelint --fix
language: system
files: '^packages/.*/src/.*/?.*.(css|scss|less)$'
types: [file]
- id: i18n
name: i18n
entry: make ci-i18n
language: system
files: '^packages/.*/src/.*/?.*.(js|jsx|ts|tsx)$'
types: [file]
5 changes: 5 additions & 0 deletions frontend_addon/{{ cookiecutter.__folder_name }}/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ GREEN=`tput setaf 2`
RESET=`tput sgr0`
YELLOW=`tput setaf 3`

GIT_FOLDER=$(CURRENT_DIR)/.git
PRE_COMMIT=pipx run --spec 'pre-commit=={{cookiecutter.__version_pre_commit}}' pre-commit

PLONE_VERSION=6
DOCKER_IMAGE=plone/server-dev:${PLONE_VERSION}
DOCKER_IMAGE_ACCEPTANCE=plone/server-acceptance:${PLONE_VERSION}
Expand All @@ -33,6 +36,8 @@ help: ## Show this help

.PHONY: install
install: ## Installs the add-on in a development environment
@echo "$(GREEN)Install$(RESET)"
if [ -d $(GIT_FOLDER) ]; then $(PRE_COMMIT) install; else echo "$(RED) Not installing pre-commit$(RESET)";fi
pnpm dlx mrs-developer missdev --no-config --fetch-https
pnpm i
pnpm build:deps
Expand Down

0 comments on commit 6df9ed1

Please sign in to comment.