gemini-cli icon indicating copy to clipboard operation
gemini-cli copied to clipboard

`npm run format` fails due to untracked file with invalid characters

Open aka1976mb opened this issue 1 month ago • 0 comments

The npm run format command ( ╭──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │ ✓ WriteTodos Set 1 todo(s) │ │ │ ╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ✦ prettier) fails to execute successfully when an untracked file with invalid characters is present in the workspace. This prevents successful code formatting and adherence to project style guidelines.

Steps to Reproduce:

  1. Ensure an untracked file named incorrect** in contentGenerator.ts (or any file with similar problematic characters in its name) exists in the workspace. This file was not modified or created by recent code changes.
  2. Run the command: npm run format

Expected Behavior:

The npm run format command should successfully format all tracked files in the repository, ignoring untracked files, especially those with problematic names or content. It should not fail due to the presence of irrelevant or malformed untracked files.

Actual Behavior:

The npm run format command fails with a syntax error, referencing the untracked file with invalid characters.

1 [error] incorrect** in contentGenerator.ts: SyntaxError: Invalid character. (2:21) 2 [error] 1 | 3 [error] > 2 | SUMMARY OF LESS COMMANDS 4 [error] | ^ 5 [error] 3 | 6 [error] 4 | Commands marked with * may be preceded by a number, N. 7 [error] 5 | Notes in parentheses indicate the behavior if N is given.

Additional Context:

This issue was encountered during a pre-commit hook, where npm run format is typically executed. The presence of this problematic untracked file prevents successful commits and code quality checks.


aka1976mb avatar Dec 02 '25 04:12 aka1976mb