Course
Free Trial: 4 lessons remaining
Unlock Full Access
Lesson
Beginner
5 min
Tools for JS and Python
Linting & Formatting Tools
Once again, extending the capabilities of none-ls is really easy now that we have our basic configuration done. In order to extend these capabilities to Javascript, or Python projects.
We simply need to get the right tool, for JS its eslint or prettier. and for Python, there are a tons of tools for linting/formatting, black is one example. Then you install these tools with Mason, and add them to our configuration. So now our configuration could look like this:
return {
"nvimtools/none-ls.nvim",
config = function()
local null_ls = require("null-ls")
null_ls.setup({
sources = {
null_ls.builtins.formatting.stylua,
null_ls.builtins.formatting.prettier,
null_ls.builtins.formatting.black,
null_ls.builtins.diagnostics.erb_lint,
null_ls.builtins.diagnostics.rubocop,
null_ls.builtins.formatting.rubocop,
},
})
vim.keymap.set("n", "<leader>gf", vim.lsp.buf.format, {})
end,
}
Lesson complete
Finished less than a minute ago