Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
23 changes: 18 additions & 5 deletions .github/workflows/pre-commit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ on:
jobs:
pre-commit:
runs-on: ubuntu-latest
name: Run pre-commit hooks on Go, Rust, and Python files
name: Run pre-commit hooks on Go, Rust, JavaScripts and Python files

steps:
- name: Check out the repo
Expand All @@ -28,6 +28,11 @@ jobs:
with:
go-version: '1.24'

- name: Set up Node
uses: actions/setup-node@v5
with:
node-version: 23

- name: Set up Rust
uses: dtolnay/rust-toolchain@stable
with:
Expand Down Expand Up @@ -60,6 +65,13 @@ jobs:
~/go/pkg/mod
key: ${{ runner.os }}-go-precommit-${{ hashFiles('**/go.sum') }}

- name: Cache Node dependencies
uses: actions/cache@v4
with:
path: |
~/.npm
key: ${{ runner.os }}-node-precommit-${{ hashFiles('website/package-lock.json') }}

- name: Cache pre-commit environments
uses: actions/cache@v4
with:
Expand All @@ -69,13 +81,14 @@ jobs:
- name: Install pre-commit
run: pip install pre-commit

- name: Run pre-commit on Go, Rust, and Python files
- name: Run pre-commit on Go, Rust, JavaScript and Python files
run: |
# Find all Go, Rust, and Python files (excluding vendored/generated code)
FILES=$(find . -type f \( -name "*.go" -o -name "*.rs" -o -name "*.py" \) \
# Find all Go, Rust, JavaScripts and Python files (excluding vendored/generated code)
FILES=$(find . -type f \( -name "*.go" -o -name "*.rs" -o -name "*.py" -o -name "*.js" \) \
! -path "./target/*" \
! -path "./candle-binding/target/*" \
! -path "./.git/*" \
! -path "./node_modules/*" \
! -path "./vendor/*" \
! -path "./__pycache__/*" \
! -path "./site/*" \
Expand All @@ -86,7 +99,7 @@ jobs:
echo "Running pre-commit on files: $FILES"
pre-commit run --files $FILES
else
echo "No Go, Rust, or Python files found to check"
echo "No Go, Rust, JavaScript or Python files found to check"
fi

- name: Show pre-commit results
Expand Down
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,6 @@ example_prd.txt
.windsurfrules
scripts/prd.txt
.env.taskmaster
package-lock.json

website/build
.docusaurus
Expand Down
17 changes: 14 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ repos:
rev: v6.0.0
hooks:
- id: trailing-whitespace
files: \.(go|rs|py)$
files: \.(go|rs|py|js)$
- id: end-of-file-fixer
files: \.(go|rs|py)$
files: \.(go|rs|py|js)$
- id: check-added-large-files
args: ['--maxkb=500']
files: \.(go|rs|py)$
files: \.(go|rs|py|js)$

# Go specific hooks
- repo: local
Expand All @@ -22,6 +22,17 @@ repos:
language: system
files: \.go$

# JavaScript specific hooks
- repo: local
hooks:
- id: js-lint
name: js lint
entry: bash -c 'cd website && npm install 2>/dev/null || true && npm run lint'
language: system
files: \.js$
exclude: ^(\node_modules/)
pass_filenames: false

# Rust specific hooks
- repo: local
hooks:
Expand Down
8 changes: 8 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -335,3 +335,11 @@ docs-serve: docs-build
docs-clean:
@echo "Cleaning documentation build artifacts..."
cd website && npm run clear

docs-lint:
@echo "Linting documentation..."
cd website && npm run lint

docs-lint-fix:
@echo "Fixing documentation lint issues..."
cd website && npm run lint:fix
10 changes: 5 additions & 5 deletions website/docusaurus.config.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
// @ts-check
// Note: type annotations allow type checking and IDEs autocompletion

const {themes} = require('prism-react-renderer');
const lightCodeTheme = themes.github;
const darkCodeTheme = themes.vsDark;
const { themes } = require('prism-react-renderer')
const lightCodeTheme = themes.github
const darkCodeTheme = themes.vsDark

/** @type {import('@docusaurus/types').Config} */
const config = {
Expand Down Expand Up @@ -211,6 +211,6 @@ const config = {
respectPrefersColorScheme: false,
},
}),
};
}

module.exports = config;
module.exports = config
23 changes: 23 additions & 0 deletions website/eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import stylistic from '@stylistic/eslint-plugin'
import react from 'eslint-plugin-react'

export default [
{
ignores: ['.docusaurus', 'build'],
},
stylistic.configs['recommended-flat'],
{
files: ['**/*.js', '**/*.jsx'],
plugins: {
react: react,
},
rules: {
...react.configs['jsx-runtime'].rules,
},
languageOptions: {
parserOptions: {
ecmaFeatures: { jsx: true },
},
},
},
]
Loading
Loading