Skip to content

Commit

Permalink
fix(cli): update newer flags
Browse files Browse the repository at this point in the history
We had `--use-optional-chaining`, but that was disabled in #1338. This commit makes it an alias for `--optional-chaining`, which was added in #1969. Also adds `--logical-assignment` to the CLI help.
  • Loading branch information
eventualbuddha committed Apr 30, 2022
1 parent 2b0f57d commit 96af3bd
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 12 deletions.
5 changes: 1 addition & 4 deletions README.md
Expand Up @@ -162,9 +162,6 @@ decaffeinate could be improved, feel free to file an issue on the [issues] page.
suggestions at the top of the output file.
- `--no-array-includes`: Do not use `Array.prototype.includes` in generated
code.
- `--use-optional-chaining`: Use the upcoming
[optional chaining](https://github.com/tc39/proposal-optional-chaining) syntax
for operators like `?.` [**NOTE:** this is disabled and has no effect].
- `--safe-import-function-identifiers`: Comma-separated list of function names
that may safely be in the `import`/`require` section of the file. All other
function calls will disqualify later `require`s from being converted to
Expand All @@ -180,7 +177,7 @@ decaffeinate could be improved, feel free to file an issue on the [issues] page.
- `--loose-js-modules`: Allow named exports when converting to JS modules.
- `--disallow-invalid-constructors`: Give an error when constructors use `this`
before `super` or omit the `super` call in a subclass.
- `--optional-chaining`: Do not transpile optional chaining.
- `--optional-chaining`: Target JavaScript optional chaining. Note the semantics may not match exactly.
- `--logical-assignment`: Use the ES2021 [logical
assignment](https://github.com/tc39/proposal-logical-assignment) operators
`&&=`, `||=`, and `??=`.
Expand Down
12 changes: 4 additions & 8 deletions src/cli.ts
Expand Up @@ -66,10 +66,6 @@ function parseArguments(args: Array<string>): CLIOptions {
baseOptions.noArrayIncludes = true;
break;

case '--use-optional-chaining':
console.warn(`NOTE: ${arg} is disabled and has no effect`);
break;

case '--use-js-modules':
baseOptions.useJSModules = true;
break;
Expand Down Expand Up @@ -135,6 +131,7 @@ function parseArguments(args: Array<string>): CLIOptions {
break;

case '--optional-chaining':
case '--use-optional-chaining':
baseOptions.optionalChaining = true;
break;

Expand Down Expand Up @@ -265,8 +262,6 @@ function usage(): void {
console.log(' Do not include a comment with followup suggestions at the');
console.log(' top of the output file.');
console.log(' --no-array-includes Do not use Array.prototype.includes in generated code.');
console.log(' --use-optional-chaining Use the upcoming optional chaining syntax for operators like `?.`.');
console.log(' NOTE: this is disabled and has no effect.');
console.log(' --use-js-modules Convert require and module.exports to import and export.');
console.log(' --loose-js-modules Allow named exports when converting to JS modules.');
console.log(' --safe-import-function-identifiers');
Expand All @@ -284,9 +279,10 @@ function usage(): void {
console.log(' --disallow-invalid-constructors');
console.log(' Give an error when constructors use this before super or');
console.log(' omit the super call in a subclass.');
console.log(' --optional-chaining');
console.log(' Target JavaScript optional chaining. Note the semantics may not');
console.log(' --optional-chaining Target JavaScript optional chaining. Note the semantics may not');
console.log(' match exactly.');
console.log(' --logical-assignment Use the ES2021 logical assignment operators `&&=`, `||=`,');
console.log(' and `??=`.');
console.log();
console.log('EXAMPLES');
console.log();
Expand Down

0 comments on commit 96af3bd

Please sign in to comment.