Closed mstade closed 2 years ago
Does your project have any eslint-jsx specific configuration? You most likely need that.
If you can't figure it out then please create a small repository that reproduce your problem.
It does, in the sense that I've added the react plugin and enabled the following parser options:
"parserOptions": {
"ecmaFeatures": {
"jsx": true
}
}
I've been spending the morning trying to tweak settings and things to see if it makes any difference, but it seems it doesn't. I also ran the troubleshooting command in Sublime and while it spits out a number of things I think the following was the most interesting:
And like I mentioned before, the status in the bottom left (I've enabled warning/error numbers in the global LSP settings) do change if I introduce errors so it certainly seems that lsp-eslint is indeed active, it just doesn't display any visual indicators of errors and warnings, and it doesn't fix anything on save like it does with regular .js files.
Is there some verbose logging I can turn on somehow, that could potentially help pinpoint the issue? I've also tried disabling other plugins but it doesn't seem to have any effect. I'll see about creating a reproducible case, but I'm really shooting in the dark here.
ST4 ships with JSX syntax so I would probably suggest removing the JSX package. That would potentially also fix your issue since then the scope would be source.jsx
and the eslint server would receive a proper languageId
.
That did the trick – thank you so much for the assist @rchl! Believe it or not, this is one of the first things I tried, but I never restarted Sublime and so I reinstalled the package to get the syntax support back. Removing the package and restarting Sublime solved my problem, and now lsp-eslint works just as beautifully as it does with regular ol' .js files.
I'd be happy to contribute a blurb about this in the readme, if you're accepting PRs?
I've just pushed a change that should hopefully also make it work with the legacy JSX package so we don't need to add any notes then.
That's brilliant @rchl – thank you! I've just tested it and can confirm it seems to work fine with the JSX package. Thank you for your time and effort, you've been very helpful!
Hi – great work on this plugin!
Try as I might I can't seem to get this to work properly with .jsx files though, is this supported out of the box? I do see LSP-eslint mentioned in the status bar when opening a .jsx file, and if I introduce an error it updates the count so it seems it does load properly, but it doesn't show any underlines or gutter dots and auto fixing doesn't work specifically for files saved with the .jsx extension. If I rename the same file to .js it works just fine however.
I've looked through the default configuration to see if there's anything there to help, but I can't figure this out – could you point me in the right direction?