SublimeLinter is an excellent tool for linting new code quickly and efficiently. Version managers like rvm, nvm, and asdf are also great tools for smoothly switching between projects with different version requirements. Getting both SublimeLinter and version manager to play nice can sometimes be challenging. I’m going to quickly talk about the simple steps I took to getting ESLint and asdf to work with SublimeLinter below.
I’m currently using asdf and am digging how simple and modular it is. asdf allows for multiple languages to be managed at once, so instead of having nvm, rvm, etc you just end up configuring a single script. Whatever your version manager is the steps outlined below should work for you.
The first step is to install Sublimelinter-eslint through the Sublime package installation menu. Once done you’ll either need eslint installed as a local package or globally. Read the SublimeLinter-eslint installation section for more details.
Fix node PATH resolution
With the new SublimeLinter 4, ensuring the node is recognized seems to be currently producing issues. The error I was encountering looks like:
SublimeLinter: ERROR: /usr/bin/env: ‘node’: No such file or directory
I first checked
which node in console and it returns
/home/josh/.asdf/shims/node. This seems accurate since asdf adds shims to the language binary files. So seems like my PATH is accurate in console but SublimeLinter doesn’t recognize it.
The current workaround I found online was to explicitly add the
.asdf/shims path to the eslint configuration within your
SublimeLinter.sublime-settings - User file.
Join the conversation