Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add pre-commit hooks for eslint and prettier #48

Merged
merged 4 commits into from
Mar 5, 2025
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,14 @@ jobs:
working-directory: ./backend/
run: uvx ruff format --check

- name: Javascript eslint check
working-directory: ./ui/
run: npm run lint

- name: Prettier format check
working-directory: ./ui/
run: npm run format

- run: pip install pre-commit

- run: pre-commit run --all-files
16 changes: 16 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,19 @@ repos:
types_or:
- terraform
pass_filenames: false

- repo: local
hooks:
- id: eslint
name: eslint
entry: bash -c 'cd ui && npm run lint'
language: system
pass_filenames: false

- repo: local
hooks:
- id: prettier
name: prettier
entry: bash -c 'cd ui && npm run format'
language: system
pass_filenames: false
3 changes: 3 additions & 0 deletions ui/eslint.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ import pluginReact from 'eslint-plugin-react';

/** @type {import('eslint').Linter.Config[]} */
export default [
{
ignores: ['dist/'],
},
{ files: ['**/*.{js,mjs,cjs,jsx}'] },
{ languageOptions: { globals: globals.browser } },
pluginJs.configs.recommended,
Expand Down
Loading