From 044362378a1741d3af168d2174636c1e2ff2ed3c Mon Sep 17 00:00:00 2001 From: matt1432 Date: Fri, 20 Oct 2023 21:06:44 -0400 Subject: [PATCH] feat(nvim): add css linting and language specific tab space --- common/modules/neovim/config/base.vim | 18 ++++++++++++++---- common/modules/neovim/default.nix | 13 +++++++++++++ hosts/wim/config/ags/.stylelintrc.yml | 14 ++++++++++++++ 3 files changed, 41 insertions(+), 4 deletions(-) create mode 100644 hosts/wim/config/ags/.stylelintrc.yml diff --git a/common/modules/neovim/config/base.vim b/common/modules/neovim/config/base.vim index 3915a34e..cb733834 100644 --- a/common/modules/neovim/config/base.vim +++ b/common/modules/neovim/config/base.vim @@ -1,9 +1,19 @@ -" make tabs only 2 spaces -set tabstop=2 -set shiftwidth=2 -set expandtab set smartindent +" by default, the indent is 2 spaces. +set shiftwidth=2 +set softtabstop=2 +set tabstop=2 + +" for html/rb files, 2 spaces +autocmd Filetype html setlocal ts=2 sw=2 expandtab +autocmd Filetype ruby setlocal ts=2 sw=2 expandtab + +" for js/coffee/jade files, 4 spaces +autocmd Filetype javascript setlocal ts=4 sw=4 sts=0 expandtab +autocmd Filetype coffeescript setlocal ts=4 sw=4 sts=0 expandtab +autocmd Filetype jade setlocal ts=4 sw=4 sts=0 expandtab + set number set relativenumber diff --git a/common/modules/neovim/default.nix b/common/modules/neovim/default.nix index 9e21b162..77990493 100644 --- a/common/modules/neovim/default.nix +++ b/common/modules/neovim/default.nix @@ -55,7 +55,15 @@ in settings = { "colors.enable" = true; "coc.preferences.formatOnType" = true; + "eslint.format.enable" = true; + "eslint.autoFixOnSave" = true; + "stylelintplus.autoFixOnFormat" = true; + "css.validate" = false; + "less.validate" = false; + "scss.validate" = false; + "wxss.validate" = false; + "Lua.misc.parameters" = [ "--metapath" "~/.cache/sumneko_lua/meta" @@ -69,6 +77,7 @@ in serverDir = "${pkgs.lua-language-server}/share/lua-language-server"; enableNvimLuaDev = true; }; + "java.jdt.ls.java.home" = "${pkgs.temurin-bin-17}"; "bashIde.shellcheckPath" = "${pkgs.shellcheck}/bin/shellcheck"; languageserver = { @@ -98,6 +107,10 @@ in coc-markdownlint coc-tsserver coc-eslint + (plugin "bmatcuk" + "coc-stylelintplus" + "4854bfdc0cb6f92e39b5afb3b90d60b411ecb9e4" + "sha256-PgcQc3JecfHE4oNcydyOqsKdRbh4yPhXPugVQDGSRuI=") neodev-nvim coc-fzf diff --git a/hosts/wim/config/ags/.stylelintrc.yml b/hosts/wim/config/ags/.stylelintrc.yml new file mode 100644 index 00000000..7b8202e6 --- /dev/null +++ b/hosts/wim/config/ags/.stylelintrc.yml @@ -0,0 +1,14 @@ +extends: stylelint-config-standard-scss +ignoreFiles: "**/*.js" +rules: + selector-type-no-unknown: null + declaration-empty-line-before: null + no-descending-specificity: null + selector-pseudo-class-no-unknown: null + color-function-notation: legacy + alpha-value-notation: number + scss/operator-no-unspaced: null + scss/no-global-function-names: null + scss/dollar-variable-empty-line-before: null + scss/dollar-variable-pattern: ^[a-z]+(_[a-z]+)*$ + scss/at-mixin-pattern: ^[a-z]+(_[a-z]+)*$