Giter VIP home page Giter VIP logo

Comments (5)

JohnAlbin avatar JohnAlbin commented on June 10, 2024

FYI, I prefer line and inline #-prefixed comment syntax because:

  • it matches most of the other dot file comment syntaxes
  • it should be simple to add parsing for it
  • it doesn't appear to conflict with Node.js versions and alias syntax. Although, we would need to explicitly state that # is not allowed in custom Node.js aliases.

If it turns out that # conflicts with the syntax of planned features (of which I am not aware of), then I'd favor only allowing line comments where the first character in the line is a #. In other words, a line MUST start with a # to be a comment and the entire line is ignored when determining the syntax of the rest of the file.

from nvm.

JohnAlbin avatar JohnAlbin commented on June 10, 2024

As a work-around, devs can add comments anywhere after the first line of .nvmrc. It's possible those comments will break NVM in future versions and you'll have to remove them. Fortunately, my .nvmrc comments explain why the comment may break NVM. 😁

This is what one of my projects' .nvmrc file looks like:

v18.19

# Node.js v18.20 and v20.10 (and later) have a bug that causes Jest code
# coverage to randomly fail.
# TODO: Switch to "v18" or "v20" when this bug is fixed.
# https://github.com/nodejs/node/issues/51251

# Note: This is a non-standard .nvmrc comment. If these comments cause an error,
# see https://github.com/nvm-sh/nvm/issues/3336

from nvm.

ljharb avatar ljharb commented on June 10, 2024

Additional lines will be used in the future for additional configuration, so if you put comments there things will break for you - don’t do that.

from nvm.

JohnAlbin avatar JohnAlbin commented on June 10, 2024

Additional lines will be used in the future for additional configuration, so if you put comments there things will break for you - don’t do that.

That's why I called it a work-around while comments are still not officially supported.

from nvm.

ljharb avatar ljharb commented on June 10, 2024

Regarding the OP, it's an rc file, so the only two options that would make sense are ; or # - ie, ini or shell.

I think "shell" makes the most sense for nvm, so i'd say that "lines starting with #", at a minimum, would be skipped, and thus would support comments. Whether it's necessary to add in "inline" comments is worth discussing, but I'm not sure it's particularly useful, and it adds extra complexity in case that character is ever actually needed.

from nvm.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.