aboutsummaryrefslogtreecommitdiff
path: root/nvim/custom/configs/conform.lua
diff options
context:
space:
mode:
authorBlaster4385 <TheTablaster@aospa.co>2024-02-15 00:37:46 +0530
committerBlaster4385 <blaster4385@tablaster.dev>2024-02-26 00:30:39 +0530
commitcead788a4a8e67f776d82c4ad50f6d065609c1cf (patch)
tree35fe47589914bdf04f3ecd86c86800ced4068703 /nvim/custom/configs/conform.lua
Initial dotfiles
Diffstat (limited to 'nvim/custom/configs/conform.lua')
-rw-r--r--nvim/custom/configs/conform.lua36
1 files changed, 36 insertions, 0 deletions
diff --git a/nvim/custom/configs/conform.lua b/nvim/custom/configs/conform.lua
new file mode 100644
index 0000000..550b659
--- /dev/null
+++ b/nvim/custom/configs/conform.lua
@@ -0,0 +1,36 @@
+--type conform.options
+local util = require("conform.util")
+
+local options = {
+ lsp_fallback = true,
+
+ formatters_by_ft = {
+ lua = { "stylua" },
+
+ javascript = { "prettier", "eslint" },
+ javascriptreact = { "prettier", "eslint" },
+ css = { "prettier" },
+ html = { "prettier" },
+
+ sh = { "shfmt" },
+ },
+
+ format_on_save = {
+ -- These options will be passed to conform.format()
+ timeout_ms = 1000,
+ lsp_fallback = true,
+ },
+
+ formatters = {
+ eslint = {
+ command = util.from_node_modules("eslint"),
+ args = { "$FILENAME", "--fix" },
+ cwd = util.root_file({
+ "package.json",
+ ".eslintrc.cjs"
+ }),
+ }
+ }
+}
+
+require("conform").setup(options)