Make sure your npm environment is clean, a.k.a if you tried to do many things before finding this, make sure to remove everything because I can assure you of this: you will have dependency errors. Also, make sure you’re running an updated version of NodeJS.
The thing itself:
eslintas a local dependency.
npm install eslint
This will fetch the latest version of
eslint and add it to your
- Install the sublime extension with npm
npm install stylelint_d
- Within Sublime Text, bring up the Command Palette and type install. Among the commands you should see Package Control: Install Package. If that command is not highlighted, use the keyboard or mouse to select it. There will be a pause of a few seconds while Package Control fetches the list of available plugins.
When the plugin list appears, type stylelint_d. Among the entries you should see SublimeLinter-contrib-stylelint_d. If that entry is not highlighted, use the keyboard or mouse to select it.
and configure it as you like.
You should be able to run this automatically. Personally, I have to bring it up the Sublime-eslint console thing with (ctrl+alt+E) on my linux.
- SublimeLinter will detect some installed local plugins, and thus it should work automatically for e.g. .vue or .ts files. If it works on the command line, there is a chance it works in Sublime without further ado.
Make sure the plugins are installed locally colocated to eslint itself. T.i., technically, both eslint and its plugins are described in the very same package.json.
- Linter configuration:
In order for stylelint_d to be executed by SublimeLinter, you must ensure that its path is available to SublimeLinter. Before going any further, please read and follow the steps in “Finding a linter executable” through “Validating your PATH” in the documentation.
Once you have installed and configured stylelint_d, you can proceed to install the SublimeLinter-contrib-stylelint_d plugin if it is not yet installed.
Part of this text was cced from the following repos:
They might be useful to you if you fell into a non described pitfall.