Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add noderc proposal #225

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open

add noderc proposal #225

wants to merge 4 commits into from

Conversation

joyeecheung
Copy link
Member

@joyeecheung joyeecheung commented Sep 3, 2024

This is consolidating the ideas from nodejs/node#53787 so far.

Refs: nodejs/node#53787

}
```

Open question: how should we handle override v.s. concatenation? Should we invent a special syntax? For example, to concatenate, use `"+import"`, otherwise, use `"import"`? Or is that too cryptic and we should just do "override if it's not an array, concatenate if it's an array?"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If "extend" field is an array, meaning it can extend multiple files, I think its important to allow more granular configuration to chose which extend and which override.
This could be achieved by

{
"extend" : [{
 "alias": "foo",
 "path": "./.noderc.foo.json"
}, "./.noderc.bar.json"],
"import": [{ "alias": "foo" }, "amaro/register"]
}

This could allow to esplicitly estend foo and override others. (Bikeshed on naming etc...)

Copy link
Member Author

@joyeecheung joyeecheung Sep 3, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the alias field specifying here? Is it some kind of variable-like thing?

We could also just provide "override" either as a different array, or do a filtering of configs in extend (or both?).

"extends": [{ "filter": ["import"], "path": "./.noderc.foo.json" }]

}
```

The general naming convention of the configuration keys are snake-cased version of corresponding CLI flags (if any) without the `--` prefix, or lower-cased version of corresponding environment variables (if any). This allows easier conversions. Exceptions include configurations that are grouped by common prefixes, for example:

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm confused. The CLI has a parameter named --watch-path. What is the expected key name for it int he configuration file?

  1. watch-path (kebab case)
  2. watch_path (snake case)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Basically, "snaked-cased version" should be "kebab-cased version".


Open question: when both the escape hatches and the structural representations are specified, which one should take precedence?

### Overriding the noderc file being applied

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we have a simple section that details the precedence of definitions? See https://docs.ansible.com/ansible/latest/reference_appendices/general_precedence.html#precedence-categories for an example.

doc/design/proposal-noderc.md Show resolved Hide resolved
doc/design/proposal-noderc.md Show resolved Hide resolved
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants