AstroNvim / astrocommunity

A community repository of common plugin specifications
GNU General Public License v3.0
1.21k stars 240 forks source link

eslint-lsp over eslint_d in the typescript pack #593

Closed willparsons closed 1 year ago

willparsons commented 1 year ago

Is your feature related to a problem?

When using eslint_d via null-ls it means you cannot configure eslint like the lsp so you are limited on how you use it.

Describe the new feature

Additional context

No response

Uzaaft commented 1 year ago

I don't think the reason you're stating here is a valid reason to go over to eslint-lsp. eslint_d can be configured just the same way eslint is, which many of the typescript pack users is used to and know about. Another layer of configuration in and of itself isn't an improvement.

We're(meaning mostly I) am exploring if estlint-lsp has any advantage(performance, fewer bugs, etc), so we'll have to see what fruits that exploration give and if we'll include it as the default method of using eslint in the pack in the future.

willparsons commented 1 year ago

eslint_d can be configured just the same way eslint is

For me, I find lsp configuration simpler than null-ls, to be fair its mainly because I just don't really use null-ls. With that being said, here is the config for the eslint-lsp, how would you change these settings via null-ls? Aren't they just fundamentally different?

Another layer of configuration in and of itself isn't an improvement.

Is it another layer? Isn't it just moving the config from null-ls to lsp?

We're(meaning mostly I) am exploring if estlint-lsp has any advantage(performance, fewer bugs, etc), so we'll have to see what fruits that exploration give and if we'll include it as the default method of using eslint in the pack in the future.

Sounds good. I mainly made this issue to find out what tool is 'better' since it's not obvious at first glance.

Uzaaft commented 1 year ago

The eslint-lsp branch has this if you want to test it out. We're testing it internally as well. :)

lougreenwood commented 11 months ago

Dropping this question here to avoid spamming with a new issue (i'll create one as a followup if necessary), but does eslint-lsp support auto-fix on save?

I recently made my eslint & eslint-typescript configs more strict and I'm now seeing rules which are fixable not being fixed on save.

Is this expected using master and the latest version of the typescript pack?

Uzaaft commented 11 months ago

Dropping this question here to avoid spamming with a new issue (i'll create one as a followup if necessary), but does eslint-lsp support auto-fix on save?

I recently made my eslint & eslint-typescript configs more strict and I'm now seeing rules which are fixable not being fixed on save.

Is this expected using master and the latest version of the typescript pack?

Fix on save was never added back in when we migrated eslint-lsp. See https://github.com/AstroNvim/astrocommunity/issues/608 for the currect tracking issue. This will most likely be resolved in v4.

willparsons commented 11 months ago

You can setup an autocommand to run :EslintFixAll

vim.api.nvim_create_autocmd("BufWritePost", {
    desc = "Fix all eslint errors",
    pattern = { "*.tsx", "*.ts", "*.jsx", "*.js" },
    group = "...",
    callback = function()
      if vim.fn.exists ":EslintFixAll" > 0 then vim.cmd "EslintFixAll" end
    end,
  })