fix: correct string handling in ESLint file path check

This commit is contained in:
Paul Gauthier 2024-09-04 14:06:30 -07:00 committed by Paul Gauthier (aider)
parent 867d19952c
commit 937a1cd847
2 changed files with 2 additions and 3 deletions

View file

@ -39,7 +39,7 @@ class Linter:
if path: if path:
for name in eslint_names: for name in eslint_names:
eslint_file = path / name eslint_file = path / name
if eslint_file.is_file() and " " not in eslint_file: if eslint_file.is_file() and " " not in str(eslint_file):
self.languages["typescript"] = f"{eslint_file} --format unix" self.languages["typescript"] = f"{eslint_file} --format unix"
return return

View file

@ -19,8 +19,7 @@ class TestLinter(unittest.TestCase):
mock_is_file.return_value = True mock_is_file.return_value = True
self.linter._check_eslint() self.linter._check_eslint()
self.assertIn("typescript", self.linter.languages) self.assertIn("typescript", self.linter.languages)
self.assertTrue(self.linter.languages["typescript"].startswith('"')) self.assertTrue(self.linter.languages["typescript"].endswith(" --format unix"))
self.assertTrue(self.linter.languages["typescript"].endswith('" --format unix'))
def test_set_linter(self): def test_set_linter(self):
self.linter.set_linter("javascript", "eslint") self.linter.set_linter("javascript", "eslint")