admin管理员组文章数量:1315779
I am having a problem with eslint_d
in Neovim, where it only seems to work with json, whenever I open a Javascript or Typescript file, I get an error in the very first line even if the file is empty:
failed to decode json: Expected value but found invalid token at character 1
The linter doesn't seem to work as well, for example code like this won't generate an error or a warning:
"use strict";
a = 10; // should trigger an error: 'x' is not defined
Here's my current none-ls configuration:
return {
"nvimtools/none-ls.nvim",
dependencies = {
"nvimtools/none-ls-extras.nvim",
},
config = function()
local null_ls = require("null-ls")
null_ls.setup({
sources = {
require("none-ls.diagnostics.eslint_d"),
null_ls.builtins.formatting.stylua,
null_ls.builtins.formatting.prettier,
null_ls.builtins.formatting.black,
null_ls.builtins.formatting.isort,
null_ls.builtins.formatting.clang_format,
null_ls.builtins.formatting.google_java_format,
null_ls.builtins.diagnostics.checkstyle,
null_ls.builtins.diagnostics.cppcheck,
null_ls.builtins.diagnostics.stylelint,
},
})
vim.keymap.set("n", "<leader>gf", vim.lsp.buf.format, {})
end,
}
I have looked everywhere for a solution but couldn't find anything, i also tried switching to oxlint and biome by installing them through Mason and modifying the configuration like this:
return {
"nvimtools/none-ls.nvim",
dependencies = {
"nvimtools/none-ls-extras.nvim",
},
config = function()
local null_ls = require("null-ls")
null_ls.setup({
sources = {
null_ls.builtins.diagnostics.oxlint,
-- or
null_ls.builtins.diagnostics.biome
null_ls.builtins.formatting.stylua,
null_ls.builtins.formatting.prettier,
null_ls.builtins.formatting.black,
null_ls.builtins.formatting.isort,
null_ls.builtins.formatting.clang_format,
null_ls.builtins.formatting.google_java_format,
null_ls.builtins.diagnostics.checkstyle,
null_ls.builtins.diagnostics.cppcheck,
null_ls.builtins.diagnostics.stylelint,
},
})
vim.keymap.set("n", "<leader>gf", vim.lsp.buf.format, {})
end,
}
but both didn't work for some reason, and i kept getting an error:
[null-ls] failed to load builtin oxlint for method diagnostics; please check your config
Does anyone know what the problem with eslint_d is? or how can i switch to oxlint or biome instead? Thanks a lot!
I am having a problem with eslint_d
in Neovim, where it only seems to work with json, whenever I open a Javascript or Typescript file, I get an error in the very first line even if the file is empty:
failed to decode json: Expected value but found invalid token at character 1
The linter doesn't seem to work as well, for example code like this won't generate an error or a warning:
"use strict";
a = 10; // should trigger an error: 'x' is not defined
Here's my current none-ls configuration:
return {
"nvimtools/none-ls.nvim",
dependencies = {
"nvimtools/none-ls-extras.nvim",
},
config = function()
local null_ls = require("null-ls")
null_ls.setup({
sources = {
require("none-ls.diagnostics.eslint_d"),
null_ls.builtins.formatting.stylua,
null_ls.builtins.formatting.prettier,
null_ls.builtins.formatting.black,
null_ls.builtins.formatting.isort,
null_ls.builtins.formatting.clang_format,
null_ls.builtins.formatting.google_java_format,
null_ls.builtins.diagnostics.checkstyle,
null_ls.builtins.diagnostics.cppcheck,
null_ls.builtins.diagnostics.stylelint,
},
})
vim.keymap.set("n", "<leader>gf", vim.lsp.buf.format, {})
end,
}
I have looked everywhere for a solution but couldn't find anything, i also tried switching to oxlint and biome by installing them through Mason and modifying the configuration like this:
return {
"nvimtools/none-ls.nvim",
dependencies = {
"nvimtools/none-ls-extras.nvim",
},
config = function()
local null_ls = require("null-ls")
null_ls.setup({
sources = {
null_ls.builtins.diagnostics.oxlint,
-- or
null_ls.builtins.diagnostics.biome
null_ls.builtins.formatting.stylua,
null_ls.builtins.formatting.prettier,
null_ls.builtins.formatting.black,
null_ls.builtins.formatting.isort,
null_ls.builtins.formatting.clang_format,
null_ls.builtins.formatting.google_java_format,
null_ls.builtins.diagnostics.checkstyle,
null_ls.builtins.diagnostics.cppcheck,
null_ls.builtins.diagnostics.stylelint,
},
})
vim.keymap.set("n", "<leader>gf", vim.lsp.buf.format, {})
end,
}
but both didn't work for some reason, and i kept getting an error:
[null-ls] failed to load builtin oxlint for method diagnostics; please check your config
Does anyone know what the problem with eslint_d is? or how can i switch to oxlint or biome instead? Thanks a lot!
Share Improve this question edited Jan 30 at 9:48 lcheylus 2,4531 gold badge19 silver badges34 bronze badges asked Jan 29 at 23:43 Death ScytheDeath Scythe 131 silver badge4 bronze badges1 Answer
Reset to default 2I know nothing about none-ls
, but since you asked about how to setup biome
or oxlint
:
Both biome
and oxlint
can be use as language servers, so you can set them with lspconfig, check kickstart.nvim as an example. They will also work as formatters without needing an additional formatting plugin.
Basically you install lspconfig
, and mason
; and set the servers like this and pass the capabilities
, on_attach
, settings
, etc. to the setup table:
require("lspconfig").biome.setup({
on_attach = ...,
capabilities = ...,
settings = ...,
})
I really recommend you to check kickstart.nvim
for a better example.
Funnily enough, you can do the same with eslint
by installing eslint_lsp
provided you want to stick with eslint
, so in the end none-ls becomes irrelevant.
本文标签: eslintproblem with eslintd in neovim (nonels)Stack Overflow
版权声明:本文标题:eslint - problem with eslint_d in neovim (none-ls) - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741992120a2409316.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论