Aider-AI / aider

aider is AI pair programming in your terminal
https://aider.chat/
Apache License 2.0
22.53k stars 2.09k forks source link

/lint and auto-lint are not working #2270

Open it-sha opened 2 weeks ago

it-sha commented 2 weeks ago

Issue

If I try /lint I get an error Unable to execute lint command: [WinError 2] The system cannot find the file specified Auto lint is not working as well

// .aider.conf.yml
lint-cmd: npm run lint

// package.json
  "scripts": {
      ...
    "lint": "eslint . --fix",
  },

npm run lint runned manually in shell works fine lint-cmd: npm run test with .aider.conf.yml works fine too

Version and model info

Aider v0.62.0 Main model: claude-3-5-sonnet-20241022 with diff edit format, prompt cache, infinite output Weak model: claude-3-haiku-20240307 Git repo: .git with 32 files Repo-map: using 1024 tokens, files refresh Added src\types\types.ts to the chat. VSCode terminal detected, pretty output has been disabled.

Windows 11 Used git bash shell to run aider

it-sha commented 2 weeks ago

@paul-gauthier Could you take a look when you have time?

paul-gauthier commented 2 weeks ago

Thanks for trying aider and filing this issue.

Does /run npm work from inside aider?

it-sha commented 2 weeks ago

yes /run npm run lint works

image

paul-gauthier commented 2 weeks ago

Sorry, not sure. This seems like a problem with your local environment somehow?

it-sha commented 2 weeks ago

Hm. I am no sure as well npm run lint works fine ouside of aider in shell but it's not working in case of lint-cmd: npm run lint inside config for aider that was started in same shell

paul-gauthier commented 2 weeks ago

What happens if you type

/run npm run lint D: projects|_Learning\vue3-playground-2024-11\src\views\HomeView.vue

Aider launches the lint command with the names of files that need to be listed. Does npm run lint accept filenames on the cmd line?

paul-gauthier commented 2 weeks ago

You might want to try:

lint-cmd: eslint --fix

And skip the npm.

it-sha commented 2 weeks ago

Thank you for suggestions. I will try and describe here result

it-sha commented 2 weeks ago

Results: lint-cmd: eslint --fix image

/run npm run lint D: projects|_Learning\vue3-playground-2024-11\src\views\HomeView.vue image

/run npm run lint /d/projects/_Learning/vue3-playground-2024-11/src/views/HomeView.vue image

With updated npm run lint command:

// package.json
  "scripts": {
    "lint:test": "eslint --fix"
  },

/run npm run lint:test -- /d/projects/_Learning/vue3-playground-2024-11/src/views/HomeView.vue image

/run npm run lint:test -- src/views/HomeView.vue image

Only last command works for single file linting