Sublime Forum

Prettier/ESLint configuraion clarification wanted

#1

Hopfeully this is the right place: I long for clarification of configuration issues.

I usually work with ST3 in checked out git repositories that have their npm modules and config files installed - most commonly eslint and prettier. Now there are eslint- and prettier-plugins for the browser as well - plus I can install the npm modules globally. So I can configure the settings for these tools in each project using the respective config files and additionally I can configure the plugins within ST3.

How dows ST3 now determine which tool and which configuration to use? It would be great if someone could shed me some light on this or else point me to the right forum/place for asking this.

Cheers and stay healthy,
Roman.

0 Likes

#2

Hi,
I may have got your question wrong but, did you have sublimeLinter package installed already?
If so, then you have to install also the single linters’ plugins, like sublimeLinter-eslint (*-stylelint, *-jshint, ecc).
ST linters packages (sublimeLinter-* or single linters like CSSLint/JSLint/ecc) are usually just an interface for the real tools.

Once done, you can enable/disable every linter plugin in the project configuration file adding a “setting” prop to the json, like:

"settings": {
    "SublimeLinter.linters.eslint.disable": false,
    "SublimeLinter.linters.jshint.disable": true,
    "SublimeLinter.linters.stylelint.disable": true
}

In this case I just wanted eslint to be active on the project.

0 Likes

#3

Similarly, the JSPrettier plugin allows you to point the plugin to a particular installation of prettier.

0 Likes

#4

Ah right, thank you for that update, and this just adds to my confusion. There seems to be no SublimeLinter-prettier, but there are ST3-plugins ESlint, LSP-eslint, SublimeLinter-eslint and SublimeLinter-contrib-eslint_d. Do these interfere with each other and which one of these should ideally be installed? I believe so far I always went with SublimeLinter and its SublimeLinter-contrib-*-plugins. But are these related to or completely independent of the installed npm modules for ESlint and prettierJS?`I find this situation absolutely confusing.

0 Likes

#5

Ok, this at least helps me a lot. Thank you!

0 Likes

#6

Well,
for SublimeLinter, *-eslint and *-contrib-eslint_d are interfaces for 2 different linting engines, the first is for the actual ESlint (https://eslint.org/) the latter is for ESLint_d (https://github.com/mantoni/eslint_d.js).
Speaking of “contrib” vs “non contrib” I really suppose is mere labeling of the plugin, I could be wrong but should be new (contrib) vs old (w/o contrib) naming of the plugins.
About the various es linter plugins (eslint, lsp-eslint, sublimelinter-* ecc), again, it depends on your workflow. I mean, if you already use Sublimelinter then you should install one of its plugin, if you have LSP package then use its plugin, and lastly, if you don’t have any of those, you may want to go for the plain ESlint package.
And for prettierJS, that is not a linter but a formatter, as @normally said, you can go for JSPrettier package to connect it to the npm module.
As I wrote in the other answer, Sublime’s packages are just interfaces for the npm modules, the “real work” is done by the modules, the packages just enhance the workflow giving you visual hints and keybindings.

1 Like