SublimeLinter / SublimeLinter-eslint

This linter plugin for SublimeLinter provides an interface to ESLint
MIT License
866 stars 88 forks source link

Incompatible with NVM #330

Open zzph opened 1 year ago

zzph commented 1 year ago

Hi,

Just writing this as a service for others who get in this headache.

nvm does not play nicely with eslint/sublime. I spent weeks on/off trying to configure paths etc to get this working. It just doesn't.

My solution?

Remove nvm, instead use volta (seems better anyway). Then npm install -g eslint and voilia!

My config looks like this

{
    "linters": {
        "eslint": {
            "disable": false,
            "args": ["--env=es6"],
            "env": {
               "PATH": "/Users/[USER_NAME]/.volta/tools/image/node/18.16.0/bin"
            }
        }
    }
}

Maybe it's worth updating the README.MD to reflect this

kaste commented 1 year ago

Well that still needs manual config as it seems. What we would like to see is completely automatic discovery/zero config. (What if you use various node versions?)

jgburet commented 4 months ago

Hey, I have the same issue when using https://asdf-vm.com/ I tried with

    "linters": {
        "eslint": {
            "env": {
                "PATH": "~/.asdf/shims/node:$PATH"
            },
            "executable": "${folder}/node_modules/eslint/bin/eslint.js",
            "selector": "source.ts, source.js - meta.attribute-with-value",
            "working_dir": "${project_route:${folder:${file_path}}}"
        }
    }

without success.

I'm expecting the package to resolve the node version that is used within the project (hence why I tried setting working_dir with ${folder} thinking it would behave just like when calling node from my Terminal), or to the system's node (also manager by asdf (asdf global nodejs 21))

Solved: "PATH": "~/.asdf/shims/node:$PATH" -> "PATH": "~/.asdf/shims/:$PATH"