Skip to content
This repository has been archived by the owner on Aug 12, 2023. It is now read-only.

[eslint] failed to decode json: Expected value but found invalid token at character 2() #1610

Open
3 of 5 tasks
Bear29ers opened this issue Jun 29, 2023 · 3 comments
Open
3 of 5 tasks
Labels
bug Something isn't working

Comments

@Bear29ers
Copy link

Bear29ers commented Jun 29, 2023

FAQ

  • I have checked the FAQ and it didn't resolve my problem.

Issues

  • I have checked existing issues and there are no issues with the same problem.

Neovim Version

v0.8.3

Dev Version?

  • I am using a stable Neovim release version, or if I am using a dev version of Neovim I have confirmed that my issue is reproducible on a stable version.

Operating System

macOS Ventura 13.3.1

Minimal Config

local status, null_ls = pcall(require, "null-ls")
if not status then
  return
end

local augroup = vim.api.nvim_create_augroup("LspFormatting", {})

local lsp_formatting = function(bufnr)
  vim.lsp.buf.format({
    filter = function(client)
      return client.name == "null-ls"
    end,
    bufnr = bufnr,
  })
end

null_ls.setup({
  sources = {
    null_ls.builtins.formatting.prettierd,
    null_ls.builtins.diagnostics.eslint.with({
      diagnostics_format = "[eslint] #{m}\n(#{c})",
    }),
    null_ls.builtins.diagnostics.fish,
    null_ls.builtins.code_actions.eslint,
  },
  on_attach = function(client, bufnr)
    if client.supports_method("textDocument/formatting") then
      vim.api.nvim_clear_autocmds({ group = augroup, buffer = bufnr })
      vim.api.nvim_create_autocmd("BufWritePre", {
        group = augroup,
        buffer = bufnr,
        callback = function()
          vim.lsp.buf.format({ bufnr = bufnr })
          -- lsp_formatting(bufnr)
        end,
      })
    end
  end,
})

vim.api.nvim_create_user_command("DisableLspFormatting", function()
  vim.api.nvim_clear_autocmds({ group = augroup, buffer = 0 })
end, { nargs = 0 })

Steps to Reproduce

I jest create a Next.js project.
When I edit layout.tsx, this error comes out.
If you need my .eslintrc.cjs file or some files, I'll give you those.

Reproducibility Check

  • I confirm that my minimal config is based on the minimal_init.lua template and that my issue is reproducible by running nvim --clean -u minimal_init.lua and following the steps above.

Expected Behavior

This error is not display in the neovim editor.

Actual Behavior

The error always displays at the first of line in my editor.

Debug Log

[WARN⋅⋅Wed⋅Sep⋅14⋅08:41:14⋅2022]⋅...ack/packer/start/null-ls.nvim/lua/null-ls/generators.lua:84:⋅failed⋅to⋅run⋅generator:⋅...site/pack/packer/start/null-ls.nvim/lua/null-ls/loop.lua:157:⋅failed⋅to⋅spawn⋅command⋅eslint_d: EACCES: permission denied

Help

Yes

Implementation Help

No response

Requirements

  • I have read and followed the instructions above and understand that my issue will be closed if I did not provide the required information.
@Bear29ers Bear29ers added the bug Something isn't working label Jun 29, 2023
@jose-elias-alvarez
Copy link
Owner

Can you enable debug logging and post the log from a run? The one entry in your log is pretty old and doesn't seem related.

@Bear29ers
Copy link
Author

Bear29ers commented Jul 1, 2023

Sorry, my mistake.
However, how can I get most recent logs?
I can display the logs, but recent one is in February, 2023...

@jose-elias-alvarez
Copy link
Owner

Please see the instructions in the issue template or in the main README.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants