|
| 1 | +repos: |
| 2 | + # Pre-commit hooks for general files |
| 3 | + - repo: https://github.com/pre-commit/pre-commit-hooks |
| 4 | + rev: v4.6.0 |
| 5 | + hooks: |
| 6 | + - id: trailing-whitespace |
| 7 | + exclude: '^(website/|node_modules/|\.venv/|\.git/|\.vscode/|\.ruff_cache/|build/|dist/|\.nyc_output/|coverage/|\.final_nyc_output/)' |
| 8 | + - id: end-of-file-fixer |
| 9 | + exclude: '^(website/|node_modules/|\.venv/|\.git/|\.vscode/|\.ruff_cache/|build/|dist/|\.nyc_output/|coverage/|\.final_nyc_output/)' |
| 10 | + - id: check-yaml |
| 11 | + exclude: '^(website/|node_modules/|\.venv/|\.git/|\.vscode/|\.ruff_cache/|build/|dist/|\.nyc_output/|coverage/|\.final_nyc_output/|.*-cf\.ya?ml$)' |
| 12 | + - id: check-json |
| 13 | + exclude: '^(website/|node_modules/|\.venv/|\.git/|\.vscode/|\.ruff_cache/|build/|dist/|\.nyc_output/|coverage/|\.final_nyc_output/|\.vscode\.example/)' |
| 14 | + - id: check-toml |
| 15 | + exclude: '^(website/|node_modules/|\.venv/|\.git/|\.vscode/|\.ruff_cache/|build/|dist/|\.nyc_output/|coverage/|\.final_nyc_output/)' |
| 16 | + - id: check-merge-conflict |
| 17 | + - id: check-added-large-files |
| 18 | + args: ['--maxkb=1000'] |
| 19 | + - id: mixed-line-ending |
| 20 | + args: ['--fix=lf'] |
| 21 | + exclude: '^(website/|node_modules/|\.venv/|\.git/|\.vscode/|\.ruff_cache/|build/|dist/|\.nyc_output/|coverage/|\.final_nyc_output/)' |
| 22 | + |
| 23 | + - repo: https://github.com/aws-cloudformation/cfn-lint |
| 24 | + rev: v1.43.2 # Check for latest version |
| 25 | + hooks: |
| 26 | + - id: cfn-lint |
| 27 | + files: '.*-cf\.ya?ml$' |
| 28 | + |
| 29 | + # Use your existing npm scripts to leverage your .eslintrc.js configuration |
| 30 | + - repo: local |
| 31 | + hooks: |
| 32 | + - id: eslint |
| 33 | + name: ESLint (uses your .eslintrc.js) |
| 34 | + entry: npm run eslint |
| 35 | + language: system |
| 36 | + files: \.(js|ts)$ |
| 37 | + pass_filenames: false |
| 38 | + # Add --fix to automatically fix issues where possible |
| 39 | + args: [] |
| 40 | + |
| 41 | + - repo: https://github.com/astral-sh/ruff-pre-commit |
| 42 | + rev: v0.14.10 |
| 43 | + hooks: |
| 44 | + - id: ruff |
| 45 | + name: Ruff linting |
| 46 | + args: [] |
| 47 | + - id: ruff-format |
| 48 | + name: Ruff formatting |
| 49 | + args: [--diff] |
| 50 | + |
| 51 | + # Markdown linting using the same library as package.json |
| 52 | + - repo: https://github.com/igorshubovych/markdownlint-cli |
| 53 | + rev: v0.31.1 # Using same version as in package.json |
| 54 | + hooks: |
| 55 | + - id: markdownlint |
| 56 | + files: '^(docs|tf-modules)/.*\.md$' |
| 57 | + |
| 58 | + # Package.json linting using our existing npm script |
| 59 | + - repo: local |
| 60 | + hooks: |
| 61 | + - id: npm-package-json-lint |
| 62 | + name: Package.json linting |
| 63 | + entry: npm run lint-package-json |
| 64 | + language: system |
| 65 | + files: package\.json$ |
| 66 | + pass_filenames: false |
| 67 | + |
| 68 | + # TypeScript compilation check using our existing npm script |
| 69 | + - repo: local |
| 70 | + hooks: |
| 71 | + - id: typescript-compile |
| 72 | + name: TypeScript compilation check |
| 73 | + entry: npm run tsc |
| 74 | + language: system |
| 75 | + files: \.(ts|tsx)$ |
| 76 | + pass_filenames: false |
| 77 | + |
| 78 | + # Optional: Full lint check (includes all your linting) |
| 79 | + # Uncomment this if you want to run your complete lint suite |
| 80 | + # - repo: local |
| 81 | + # hooks: |
| 82 | + # - id: full-lint |
| 83 | + # name: Full lint suite (all your npm lint scripts) |
| 84 | + # entry: npm run lint |
| 85 | + # language: system |
| 86 | + # pass_filenames: false |
| 87 | + # stages: [manual] |
| 88 | + |
| 89 | +# Configuration for pre-commit |
| 90 | +default_language_version: |
| 91 | + python: python3.12 |
| 92 | + node: 20.12.2 |
| 93 | + |
| 94 | +# Global exclude pattern (some hooks may need individual excludes too) |
| 95 | +exclude: | |
| 96 | + (?x)^( |
| 97 | + website/| |
| 98 | + node_modules/| |
| 99 | + \.venv/| |
| 100 | + \.git/| |
| 101 | + \.vscode/| |
| 102 | + \.ruff_cache/| |
| 103 | + build/| |
| 104 | + dist/| |
| 105 | + \.nyc_output/| |
| 106 | + coverage/| |
| 107 | + \.final_nyc_output/ |
| 108 | + ) |
| 109 | +
|
| 110 | +# Configuration pre-commit.ci |
| 111 | +ci: |
| 112 | + # Skip local hooks that depend on npm or uv since they're not supported by |
| 113 | + skip: [eslint, npm-package-json-lint, typescript-compile] |
0 commit comments