Nu-Lint
Linter for the innovative Nu shell.
Learning to use a new shell is a radical change that can use some assistance. This project is aimed at helping new users of the Nu shell. Nu shell has a lot of interesting and useful features and this program will give you hints to use all the features of Nu.
Compatible with:
- The standard parser nu-check.
- The standard formatter topiary-nushell.
Installation
Cross-platform
From crates.io:
Source
Build from source:
Nix
To install in Nix or NixOS, add to configuration.nix:
let
nu-lint = pkgs.callPackage (pkgs.fetchFromGitHub {
owner = "wvhulle";
repo = "nu-lint";
rev = "COMMIT_HASH";
sha256 = ""; # nix will tell you the correct hash
}) {};
in
{
environment.systemPackages = [
nu-lint
];
}
Or in a shell.nix:
{ pkgs ? import <nixpkgs> {} }:
let
nu-lint = pkgs.callPackage (pkgs.fetchFromGitHub {
owner = "wvhulle";
repo = "nu-lint";
rev = "COMMIT_HASH";
sha256 = ""; # nix will tell you the correct hash
}) {};
in
pkgs.mkShell {
buildInputs = [
nu-lint
];
}
Usage
Basic:
Extra:
For editor plugins (for LLMs / creators):
Configuration
Create .nu-lint.toml in your project root (or any parent directory):
[]
= "info"
[]
= "warning"
The linter will automatically find and use this config file when you run it.
Rules
Categories:
- naming
- formatting
- idioms
- error handling
- code quality
- documentation
- type safety
Planned features
Ideas for future improvements:
- Editor plugins such a VS Code extension
- Use external parsers for DSLs such as
jq - A lint plugin for Nu shell command line itself
- Better fix suggestions
Contributing
Contributions are welcome.
Debugging
Show debug output using the instrument function and an environment variable:
RUST_LOG=debug
Please run linter and formatter before submitting PRs. Many optional and restrictive rules of Clippy have been turned on.
This will attempt to auto-fix violations in the Rust code.
Check if everything was fixed:
cargo +nightly fmt
Quick benchmark for performance testing:
License
MIT