From 03c8969b0b607cb3abf75253cfd255942ecf7953 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sergio=20La=C3=ADn?= Date: Sun, 7 Jan 2024 15:39:23 +0100 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20feat(nvim):=20create=20global=20rul?= =?UTF-8?q?es=20for=20formatters=20and=20linters?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .config/nvim/.gitignore | 7 ------- .config/nvim/lua/util/cspell.lua | 2 +- .config/nvim/rules/.eslintrc.json | 16 ++++++++++++++++ .config/nvim/rules/.prettierrc.json | 8 ++++++++ .config/nvim/rules/.pylintrc | 8 ++++++++ .config/nvim/rules/.stylelintrc.json | 10 ++++++++++ .config/nvim/rules/cspell.json | 15 +++++++++++++++ .config/nvim/rules/rustfmt.toml | 8 ++++++++ .config/nvim/rules/stylua.toml | 6 ++++++ 9 files changed, 72 insertions(+), 8 deletions(-) delete mode 100644 .config/nvim/.gitignore create mode 100644 .config/nvim/rules/.eslintrc.json create mode 100644 .config/nvim/rules/.prettierrc.json create mode 100644 .config/nvim/rules/.pylintrc create mode 100644 .config/nvim/rules/.stylelintrc.json create mode 100644 .config/nvim/rules/cspell.json create mode 100644 .config/nvim/rules/rustfmt.toml create mode 100644 .config/nvim/rules/stylua.toml diff --git a/.config/nvim/.gitignore b/.config/nvim/.gitignore deleted file mode 100644 index 0b68b6f4..00000000 --- a/.config/nvim/.gitignore +++ /dev/null @@ -1,7 +0,0 @@ -tt.* -.tests -doc/tags -.repro -foo.* -*.log -data diff --git a/.config/nvim/lua/util/cspell.lua b/.config/nvim/lua/util/cspell.lua index 2f02635e..e5ea121e 100644 --- a/.config/nvim/lua/util/cspell.lua +++ b/.config/nvim/lua/util/cspell.lua @@ -2,7 +2,7 @@ local M = {} function M.addWordToDictionary() local word = vim.fn.expand("") - local dictionary_path = require("lazyvim.util.root").get() .. "/cspell-tool.txt" + local dictionary_path = require("lazyvim.util.root").get() .. "/cspell-dictionary.txt" -- Append the word to the dictionary file local file = io.open(dictionary_path, "a") diff --git a/.config/nvim/rules/.eslintrc.json b/.config/nvim/rules/.eslintrc.json new file mode 100644 index 00000000..e5ee6c0d --- /dev/null +++ b/.config/nvim/rules/.eslintrc.json @@ -0,0 +1,16 @@ +{ + "env": { + "es2021": true, + "node": true, + "browser": false + }, + "extends": ["eslint:recommended", "plugin:prettier/recommended"], + "parserOptions": { + "ecmaVersion": "latest", + "sourceType": "module" + }, + "ignorePatterns": ["test/", "dist/"], + "rules": { + "prettier/prettier": "error" + } +} diff --git a/.config/nvim/rules/.prettierrc.json b/.config/nvim/rules/.prettierrc.json new file mode 100644 index 00000000..ae1478cc --- /dev/null +++ b/.config/nvim/rules/.prettierrc.json @@ -0,0 +1,8 @@ +{ + "trailingComma": "es5", + "tabWidth": 2, + "useTabs": false, + "printWidth": 120, + "semi": false, + "singleQuote": false +} diff --git a/.config/nvim/rules/.pylintrc b/.config/nvim/rules/.pylintrc new file mode 100644 index 00000000..14e4a97d --- /dev/null +++ b/.config/nvim/rules/.pylintrc @@ -0,0 +1,8 @@ +[FORMAT] +max-line-length = 120 + +[BASIC] +indent-string = " " + +[REPORTS] +output-format=colorized diff --git a/.config/nvim/rules/.stylelintrc.json b/.config/nvim/rules/.stylelintrc.json new file mode 100644 index 00000000..c735b45a --- /dev/null +++ b/.config/nvim/rules/.stylelintrc.json @@ -0,0 +1,10 @@ +{ + "extends": "stylelint-config-standard", + "rules": { + "indentation": 2, + "selector-pseudo-element-colon-notation": "double", + "declaration-block-trailing-semicolon": "always", + "no-empty-source": null, + "color-hex-case": "lower" + } +} diff --git a/.config/nvim/rules/cspell.json b/.config/nvim/rules/cspell.json new file mode 100644 index 00000000..44e31446 --- /dev/null +++ b/.config/nvim/rules/cspell.json @@ -0,0 +1,15 @@ +{ + "$schema": "https://raw.githubusercontent.com/streetsidesoftware/cspell/main/cspell.schema.json", + "version": "0.2", + "language": "en", + "globRoot": ".", + "dictionaryDefinitions": [ + { + "name": "cspell-dictionary", + "path": "./cspell-dictionary.txt", + "addWords": true + } + ], + "dictionaries": ["cspell-dictionary"], + "ignorePaths": ["node_modules", "dist", "build", "/cspell-dictionary.txt"] +} diff --git a/.config/nvim/rules/rustfmt.toml b/.config/nvim/rules/rustfmt.toml new file mode 100644 index 00000000..ce8a7a23 --- /dev/null +++ b/.config/nvim/rules/rustfmt.toml @@ -0,0 +1,8 @@ +imports_granularity = "Crate" +group_imports = "One" +imports_layout = "Horizontal" + +max_width = 120 + +struct_lit_style = "Block" +enum_style = "Block" diff --git a/.config/nvim/rules/stylua.toml b/.config/nvim/rules/stylua.toml new file mode 100644 index 00000000..91e0fef1 --- /dev/null +++ b/.config/nvim/rules/stylua.toml @@ -0,0 +1,6 @@ +indent_type = "Spaces" +indent_width = 2 +column_width = 120 + +[sort_requires] +enabled = true