NvChad / NvChad

Blazing fast Neovim config providing solid defaults and a beautiful UI, enhancing your neovim experience.

Home Page:https://nvchad.com/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Setup prettier/eslint installed inside every node project

caneta opened this issue · comments

I'm used to work with prettier/eslint installed per project instead the ones installed in the editor itself, because:

  1. every project could have a different prettier/eslint version
  2. every project could have a different prettier/eslint configuration
  3. the configuration is shared into the project repo to assure that every dev uses the same version/conf

Now, how to tell NVChad to do that?

I'm not sure on what to configure to achieve this: Mason? Conform? I need to install something else?

Is there any config snippet suggested?

Thanks

mason shouldnt be used here, because it downloads stuff globally for neovim and puts in a folder

i think you will achieve it by npm and for eslint, use lspconfig and for prettier, use conform. And make sure prettier/eslint isnt installed globally

No way to make project prettier work: I've got some hint here, but cannot find the executable:
image

My current config inside lua/configs/conform.lua is the following:

local options = {
  formatters = {
    prettier = {
      command = "./node_modules/.bin/prettier",
    },
  },

  formatters_by_ft = {
    lua = { "stylua" },
    css = { "prettier" },
    scss = { "prettier" },
    html = { "prettier" },
    javascript = { "prettier" },
    javascriptreact = { "prettier" },
    typescript = { "prettier" },
    typescriptreact = { "prettier" },
  },

  format_on_save = {
    -- These options will be passed to conform.format()
    timeout_ms = 500,
    lsp_fallback = true,
  },
}

require("conform").setup(options)

Any suggestion?

@caneta i dont use prettier so cant help sorry! you could ask in conform repo

or r/neovim