dstack icon indicating copy to clipboard operation
dstack copied to clipboard

Frontend linter errors slip through CI

Open jvstme opened this issue 4 weeks ago • 0 comments

Problem

If pre-commit is not installed on the developer's system, code changes with linter errors can end up being committed to git. The CI workflow should detect such errors, but it doesn't, because it also uses pre-commit, which only checks staged files.

As a result, these errors are currently (a49d34c) commited to master:

> npx eslint --max-warnings=0 --no-warn-ignored

/home/jvstme/git/dstack/dstack/frontend/eslint.config.cjs
   1:41  error  A `require()` style import is forbidden  @typescript-eslint/no-require-imports
   1:41  error  'require' is not defined                 no-undef
   2:14  error  A `require()` style import is forbidden  @typescript-eslint/no-require-imports
   2:14  error  'require' is not defined                 no-undef
   3:26  error  A `require()` style import is forbidden  @typescript-eslint/no-require-imports
   3:26  error  'require' is not defined                 no-undef
   4:24  error  A `require()` style import is forbidden  @typescript-eslint/no-require-imports
   4:24  error  'require' is not defined                 no-undef
   5:12  error  A `require()` style import is forbidden  @typescript-eslint/no-require-imports
   5:12  error  'require' is not defined                 no-undef
   6:26  error  A `require()` style import is forbidden  @typescript-eslint/no-require-imports
   6:26  error  'require' is not defined                 no-undef
   7:18  error  A `require()` style import is forbidden  @typescript-eslint/no-require-imports
   7:18  error  'require' is not defined                 no-undef
  10:20  error  '__dirname' is not defined               no-undef
  21:38  error  Insert `,`                               prettier/prettier
  55:1   error  'module' is not defined                  no-undef

/home/jvstme/git/dstack/dstack/frontend/src/pages/Runs/CreateDevEnvironment/hooks/useGetRunSpecFromYaml.ts
  59:22  error  '_' is defined but never used  @typescript-eslint/no-unused-vars

/home/jvstme/git/dstack/dstack/frontend/src/pages/Runs/CreateDevEnvironment/index.tsx
  65:42  error  Unnecessary escape character: \/  no-useless-escape

✖ 19 problems (19 errors, 0 warnings)
  1 error and 0 warnings potentially fixable with the `--fix` option

This leads to unexpected inconveniences for developers that do have pre-commit installed. For example, I stumbled across broken pre-commit when merging master into an older feature branch and trying to commit the resolved merge conflicts.

Solution

  1. Fix the linter errors currently present in master.
  2. Prevent such errors from being merged. For example, run the linter on all files (not just staged) in CI.

Workaround

No response

Would you like to help us implement this feature by sending a PR?

No

jvstme avatar Dec 04 '25 19:12 jvstme