nushell / nushell/nushell

official style guide for nushell script files and `nufmt` to auto-format such input

Open
#3,938 4 comments 9 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

category:enhancement delight
Dominant language
Rust
Stars
40.5k
Forks
2.3k
Avg merge
1d 19h
Merged PRs (30d)
85

Description

Related problem

I'd like to write .nu script files and have white-space and other stylistic concerns handled for me in a consistent way

For a start, looking at the contributed scripts here ( https://github.com/nushell/nu_scripts ) I can see they are indented with varying numbers of spaces

Describe the solution you'd like
  • a first-party statement regarding recommended code style for nushell scripts, whether that be one line that says "as much as possible, do whatever upstream Rust does" or something more specific to nushell

  • offer a first-party utility similar to gofumpt, rustfmt, or prettier that handles not just indentation and spaces between tokens, but is also opinionated about line-length and thus also auto-line-breaks (just like these other 3x tools do for their own target formats)

Describe alternatives you've considered

The status quo is honestly not urgent or even an inconvenience, I just like opinionated first-party code style guides :)

For now, I can just do whatever I like in my nushell code style no matter how different it is to other nushell scripts

Additional context and details

Thanks so much for working on nushell and sharing it, it's been exciting and fun to follow along and try it out

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

The issue mentions contributed scripts in the nu_scripts repository but names no nushell source files, tests, or formatter entry point. Start by reviewing those scripts and the existing formatting approaches it references; done would require an agreed Nushell style guide and a first-party formatter covering whitespace, token spacing, line length, and line breaks.

Written by the indexing model from the issue text.

Assessment

Tech stack
shell
Domain
cli, tooling
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.