You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iggy.apache.org by gk...@apache.org on 2026/06/06 06:26:20 UTC

(iggy) branch master updated: fix(ci): ensure dependencies are available when running `lint` in `pre-commit` (#3427)

This is an automated email from the ASF dual-hosted git repository.

numinnex pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/iggy.git


The following commit(s) were added to refs/heads/master by this push:
     new d254604d4 fix(ci): ensure dependencies are available when running `lint` in `pre-commit` (#3427)
d254604d4 is described below

commit d254604d4878a14b8a7d2fdd1e199a8543f5e2e3
Author: Alan Tang <jm...@gmail.com>
AuthorDate: Sat Jun 6 14:26:16 2026 +0800

    fix(ci): ensure dependencies are available when running `lint` in `pre-commit` (#3427)
    
    ## Which issue does this PR address?
    Relates to #3258
    
    ## Rationale
    
    <!--
    Why is this change needed? If the issue explains it well, a one-liner is
    fine.
    -->
    
    The pre-commit workflow was not consistently installing or making the
    required dependencies available before executing the lint command. As a
    result, linting could fail even though the project built successfully in
    other environments.
    
    ## What changed?
    
    <!--
    2-4 sentences. Problem first (before), then solution (after).
    
    GOOD:
    
    "Messages were unavailable when background message_saver committed the
    journal and started async disk I/O before completion. Polling during
    this window found neither journal nor disk data.
    
    The fix freezes journal batches in the in-flight buffer before async
    persist."
    
    GOOD:
    
    "When many small messages accumulate in the journal, the flush passes
    thousands of IO vectors to writev(), exceeding IOV_MAX (1024 on Linux)."
    
    BAD:
    - Walls of text
    - "This PR adds..." (we can see the diff)
    -->
    
    Ensure all required dependencies are installed before running `npm run
    lint`.
    
    ## Local Execution
    
    - Passed / not passed
    Passed
    - Pre-commit hooks ran / not ran
    Ran
    
    <!--
    You must run your code locally before submitting.
    "Relying on CI" is not acceptable - PRs from authors who haven't run the
    code will be closed.
    
    Did you have `prek` installed? It runs automatically on commit and
    covers all project languages. See
    [CONTRIBUTING.md](https://github.com/apache/iggy/blob/master/CONTRIBUTING.md).
    -->
    
    ## AI Usage
    
    <!--
    If AI tools were used, please answer:
    1. Which tools? (e.g., GitHub Copilot, Claude, ChatGPT)
    2. Scope of usage? (e.g., autocomplete, generated functions, entire
    implementation)
    3. How did you verify the generated code works correctly?
    4. Can you explain every line of the code if asked?
    
    If no AI tools were used, write "None" or delete this section.
    -->
    
    Signed-off-by: StandingMan <jm...@gmail.com>
---
 .pre-commit-config.yaml | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
index 31c53465d..b6987bd6f 100644
--- a/.pre-commit-config.yaml
+++ b/.pre-commit-config.yaml
@@ -263,7 +263,7 @@ repos:
     hooks:
       - id: node-eslint
         name: node eslint
-        entry: bash -c 'for dir in foreign/node examples/node; do [ -f "$dir/package.json" ] && (cd "$dir" && npm run lint); done'
+        entry: bash -c 'for dir in foreign/node examples/node; do [ -f "$dir/package.json" ] && (cd "$dir" && { [ -x node_modules/.bin/eslint ] || npm ci --ignore-scripts; } && npm run lint); done'
         language: system
         files: ^(foreign|examples)/node/.*\.ts$
         pass_filenames: false
@@ -273,7 +273,7 @@ repos:
     hooks:
       - id: web-lint
         name: web lint
-        entry: bash -c 'cd web && npm run lint'
+        entry: bash -c 'cd web && { [ -x node_modules/.bin/eslint ] && [ -x node_modules/.bin/prettier ] || npm ci; } && npm run lint'
         language: system
         files: ^web/.*\.(ts|js|svelte)$
         pass_filenames: false