refactor: make ESLint path detection cross-platform compatible

This commit is contained in:
Paul Gauthier (aider) 2024-09-04 13:52:41 -07:00
parent 376e8617f3
commit e98645698b

View file

@ -30,13 +30,13 @@ class Linter:
def _check_eslint(self): def _check_eslint(self):
eslint_paths = [ eslint_paths = [
"./node_modules/.bin/eslint", Path("node_modules") / ".bin" / "eslint",
f"{self.root}/node_modules/.bin/eslint" if self.root else None, Path(self.root) / "node_modules" / ".bin" / "eslint" if self.root else None,
] ]
for path in eslint_paths: for path in eslint_paths:
if path and os.path.isfile(path): if path and path.is_file():
self.languages["typescript"] = f"{path} --format unix" self.languages["typescript"] = f'"{path}" --format unix'
break break
def set_linter(self, lang, cmd): def set_linter(self, lang, cmd):