0

How do I tell eslint in my neovim config to limit line lengths? I think this is the max-len parameter, but where do I put it in the config? Here's my eslint config:

  eslint = {
    on_attach = function(client, bufnr)
      vim.api.nvim_create_autocmd("BufWritePre", {
        buffer = bufnr,
        command = "EslintFixAll",
      })
    end
  }
  require('lspconfig')['eslint'].setup(eslint)

The eslint section of the lsp-config documentation provides an example "settings" config key but I don't see any options there that look like the options in the link above.

1
  • I don't know very much eslint but I believe you need to add a eslint.config.js with the configuration about the rules you want in the root of your project. Commented May 14 at 6:21

1 Answer 1

0

I would add in the root of your project a eslint.config.js file with the following content:

export default [
  {
    rules: {
      'max-len': ["error", { "code": 120 }]
    }
  }
]
0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.