From b617ee284e410bad0b38d79a4cd645a88fdcbce4 Mon Sep 17 00:00:00 2001 From: Barrett Ruth Date: Tue, 24 Feb 2026 15:08:44 -0500 Subject: [PATCH] build: add tooling and dev environment configs Problem: need formatting, linting, testing, and nix dev shell configs. Solution: add stylua, selene, lua-language-server, busted, pre-commit, flake.nix, and luarocks rockspec configuration. --- .busted | 9 +++++++++ .luarc.json | 8 ++++++++ .pre-commit-config.yaml | 17 ++++++++++++++++ flake.lock | 43 +++++++++++++++++++++++++++++++++++++++++ flake.nix | 36 ++++++++++++++++++++++++++++++++++ rockspec | 30 ++++++++++++++++++++++++++++ selene.toml | 4 ++++ stylua.toml | 8 ++++++++ vim.yaml | 26 +++++++++++++++++++++++++ 9 files changed, 181 insertions(+) create mode 100644 .busted create mode 100644 .luarc.json create mode 100644 .pre-commit-config.yaml create mode 100644 flake.lock create mode 100644 flake.nix create mode 100644 rockspec create mode 100644 selene.toml create mode 100644 stylua.toml create mode 100644 vim.yaml diff --git a/.busted b/.busted new file mode 100644 index 0000000..53513b8 --- /dev/null +++ b/.busted @@ -0,0 +1,9 @@ +return { + _all = { + lua = 'nvim -l', + ROOT = { './spec/' }, + }, + default = { + verbose = true, + }, +} diff --git a/.luarc.json b/.luarc.json new file mode 100644 index 0000000..23646d3 --- /dev/null +++ b/.luarc.json @@ -0,0 +1,8 @@ +{ + "runtime.version": "LuaJIT", + "runtime.path": ["lua/?.lua", "lua/?/init.lua"], + "diagnostics.globals": ["vim", "jit"], + "workspace.library": ["$VIMRUNTIME/lua", "${3rd}/luv/library"], + "workspace.checkThirdParty": false, + "completion.callSnippet": "Replace" +} diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 0000000..5d1f13f --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,17 @@ +minimum_pre_commit_version: '3.5.0' + +repos: + - repo: https://github.com/JohnnyMorganz/StyLua + rev: v2.3.1 + hooks: + - id: stylua-github + name: stylua (Lua formatter) + files: \.lua$ + pass_filenames: true + + - repo: https://github.com/pre-commit/mirrors-prettier + rev: v4.0.0-alpha.8 + hooks: + - id: prettier + name: prettier + files: \.(md|toml|yaml|yml|sh)$ diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..9cbffeb --- /dev/null +++ b/flake.lock @@ -0,0 +1,43 @@ +{ + "nodes": { + "nixpkgs": { + "locked": { + "lastModified": 1771892004, + "narHash": "sha256-V96pa9awm6hjnf8yGJeoC4uOirYDEPsaBbuU0stROQI=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "5e4522be6bdf1600682a6f383434b057b2d77a37", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixpkgs-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "nixpkgs": "nixpkgs", + "systems": "systems" + } + }, + "systems": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..da16aea --- /dev/null +++ b/flake.nix @@ -0,0 +1,36 @@ +{ + description = "task.nvim — oil-like task management for Neovim"; + + inputs = { + nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable"; + systems.url = "github:nix-systems/default"; + }; + + outputs = + { + nixpkgs, + systems, + ... + }: + let + forEachSystem = f: nixpkgs.lib.genAttrs (import systems) (system: f nixpkgs.legacyPackages.${system}); + in + { + devShells = forEachSystem (pkgs: { + default = pkgs.mkShell { + packages = [ + (pkgs.luajit.withPackages ( + ps: with ps; [ + busted + nlua + ] + )) + pkgs.prettier + pkgs.stylua + pkgs.selene + pkgs.lua-language-server + ]; + }; + }); + }; +} diff --git a/rockspec b/rockspec new file mode 100644 index 0000000..a1d17bf --- /dev/null +++ b/rockspec @@ -0,0 +1,30 @@ +rockspec_format = '3.0' +package = 'todo.nvim' +version = 'scm-1' + +source = { + url = 'git+https://github.com/barrettruth/todo.nvim.git', +} + +description = { + summary = 'Oil-like task management for Neovim', + homepage = 'https://github.com/barrettruth/todo.nvim', + license = 'MIT', +} + +dependencies = { + 'lua >= 5.1', +} + +test_dependencies = { + 'nlua', + 'busted >= 2.1.1', +} + +test = { + type = 'busted', +} + +build = { + type = 'builtin', +} diff --git a/selene.toml b/selene.toml new file mode 100644 index 0000000..f2ada4b --- /dev/null +++ b/selene.toml @@ -0,0 +1,4 @@ +std = 'vim' + +[lints] +bad_string_escape = 'allow' diff --git a/stylua.toml b/stylua.toml new file mode 100644 index 0000000..01ded03 --- /dev/null +++ b/stylua.toml @@ -0,0 +1,8 @@ +column_width = 100 +line_endings = "Unix" +indent_type = "Spaces" +indent_width = 2 +quote_style = "AutoPreferSingle" +call_parentheses = "Always" +[sort_requires] +enabled = true diff --git a/vim.yaml b/vim.yaml new file mode 100644 index 0000000..3821d25 --- /dev/null +++ b/vim.yaml @@ -0,0 +1,26 @@ +--- +base: lua51 +name: vim +lua_versions: + - luajit +globals: + vim: + any: true + jit: + any: true + assert: + any: true + describe: + any: true + it: + any: true + before_each: + any: true + after_each: + any: true + spy: + any: true + stub: + any: true + bit: + any: true