alveifbklsiu259 commented on PR #32333: URL: https://github.com/apache/superset/pull/32333#issuecomment-2675990981
> Do we need the extra script file here, or does simply removing the sed business and letting the pre-commit hook run npm run lint (or even npm run lint-fix) from the pre-commit config do the job? I'm just hoping to reduce complexity/maintenance if it's not needed. I created a separate file because `$@` outputs ~~nothing~~(see below) when used in `pre-commit-config.yaml`, even if there are touched files under `superset-frontend` in the index. However, `$@` correctly outputs touched files when used in a separate script. > Oh weird, I'm pretty sure the $@ trick work on my machine, is this an OS-specific issue (like it doesn't work as expected on Windows/Linux)? I'm not sure if this is a OS-specific issue, I'm running on WSL2 with Ubuntu 22.04.5. After a thorough test, I found that when `$@` is used in `pre-commit-config.yaml`, it does outputs touched files, but **not all of them**. `pre-commit-config.yaml` ```yaml - repo: local hooks: - id: eslint name: eslint entry: bash -c 'echo "$@"; exit 1' language: system pass_filenames: true files: \.(js|jsx|ts|tsx)$ ``` `superset-frontend/src/components/Avatar/index.tsx` is touched, but `$@` outputs nothing. (This is the reason why I initially thought `$@` outputs nothing)  When more files are added to the index, `$@` starts to output touched files, **but some files are missing**. `superset-frontend/src/components/Avatar/index.tsx` is missing from `$@`.  `superset-frontend/src/components/Avatar/index.tsx` and `superset-frontend/src/components/Alert/index.tsx` are missing from `$@`.  But if we use `$@` in a separate files, it seems to solve this issue. `scripts/eslint.sh` ```bash #!/usr/bin/env bash echo "$@"; exit 1 ``` `pre-commit-config.yaml` ```yaml - repo: local hooks: - id: eslint name: eslint entry: ./scripts/eslint.sh language: script pass_filenames: true files: \.(js|jsx|ts|tsx)$ ``` All touched files are included.  -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: notifications-unsubscr...@superset.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: notifications-unsubscr...@superset.apache.org For additional commands, e-mail: notifications-h...@superset.apache.org