Eliminating getters from yargs Options
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 35/100
- Issue type
- Refactor
- Clarity
- Mostly clear
- Activity status
- Stale
- Tech stack
- typescript
- Domain
- cli
Research direction
Start with the getters for openReport, dryRun, interactive, verbose, and rcPath, and review the earlier changes in pull request #270. Trace how each option is read and identify the code changes needed to preserve behavior when removing the getters. Done means all five getters are removed without behavior changes; the issue does not name specific tests to run.
Written by the indexing model from the issue text.
Description
TL;DR
Some Parameter have a get function which will cause issues when migrating to ESM and require using incorrect typing.
These need to be removed.
Description
Using the getter for a parameter is requiring use to use Type Assertions.
This is an issue because it will not work property in some cases and typescript will ignore the error.
As an example we can look at the verbose param:
// packages/cli/src/lib/global/options/verbose.ts
import { argv } from 'yargs';
import { Param } from './verbose.model';
import { ArgvOption } from '../../core/yargs/types';
import { GlobalOptionsArgv } from './types';
import { getEnvPreset } from '../../pre-set';
export const param: Param = {
verbose: {
alias: 'v',
type: 'boolean',
description: 'Run with verbose logging',
default: getEnvPreset().verbose
}
};
// We don't rely on yargs option normalization features as this can happen before cli bootstrap
export function get(): boolean {
const {verbose} = argv as unknown as GlobalOptionsArgv;
return verbose;
}
Going around the yargs parser is problematic as it means we cannot simply expect it to work in the same way it yargs is suppose to.
Many of the getters for the options are being removed in this MR: https://github.com/push-based/user-flow/pull/270
However some require making further modifications to the code base to not have any behaviour changes.
In particular I am referring to the the following yargs options:
- openReport
- dryRun
- interactive
- verbose
- rcPath
Issue with getters in ESM
I believe the issue is related to live bindings. Or more broadly the way ES6 Modules export works.
More resources on the topic:
What do ES6 modules export? by Axel Rauschmayer
ES modules: A cartoon deep-dive by Lin Clark
Chapter on Modules in Exploring JS by Axel Rauschmayer
- Dominant language
- HTML
- Stars
- 131
- Forks
- 7
- Avg merge
- 7h 58m
- Merged PRs (30d)
- 42
Getting set up
This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from push-based/user-flow
-
Difficulty 2/5 1-3 hours Newbie friendliness 66/100
push-based/user-flow#356 ·
Maintainers usually reply within 1 day
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
push-based/user-flow#355 ·
Maintainers usually reply within 1 day
-
Difficulty 5/5 Over a week Newbie friendliness 24/100
push-based/user-flow#285 ·
Maintainers usually reply within 1 day
-
nx-plugin - init command adds `"PLUGIN_NAME": "^0.0.0"` to `package.json`May be free again @ChristopherPHolder claimed this 1212 days ago, and no pull request is open. Openbug DX
push-based/user-flow#248 · 1 assignee ·
Maintainers usually reply within 1 day
-
Difficulty 3/5 1-2 days Newbie friendliness 35/100
push-based/user-flow#247 · 1 comment ·
Maintainers usually reply within 1 day
All issues in push-based/user-flow
Similar issues
-
area: ops bug complexity: trivial
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
accensa/x402-facilitator-stellar#773 ·
Maintainers usually reply within 1 day
-
[Bug / Enhancement]: Improve teleop_robot CLI with configurable timeout, robust input validation, and clean ROS shutdownPossibly taken @muskan-creates352 claimed this today. Open
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Maintainers usually reply within 3 days
-
console enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
MFisher14/ctf-flightdeck#39 ·
-
CLI: expose public search language with --languagePossibly taken @semajzandrews claimed this today. Openenhancement good first issue
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
-
evener-transcript-v2-upgrade tool still scans transcript files through bufio's 4 KiB default bufferOpen
Difficulty 1/5 Under an hour Newbie friendliness 78/100
prime-radiant-inc/evener#6370 ·
Maintainers usually reply within 1 day