google / google/gts

Adding right parenthesis when not needed

Open
#701 8 comments 0 reactions 0 assignees View on GitHub
priority: p2 type: bug
Dominant language
TypeScript
Stars
5.3k
Forks
212
PR merge metrics
No merged PRs in 30d

Description

### Summary
When running `gts fix` on this code, it adds extra `)` and breaks the code.

### Before `gts fix`
```ts
const signingKey = new RsKmsSigningKey("entitlement-signing-key", RsKmsKeyType.Rsa2048)
.WithDescription("The key used by the Entitlements service to sign entitlement tokens.");

const domainsTable = new RsDynamoDbTable("entmnt-domains", "id")
.WithProvisionedBilling(2, 1);
```

### After `gts fix`
```ts
const signingKey = new RsKmsSigningKey('entitlement-signing-key', RsKmsKeyType.Rsa2048)
).WithDescription(
'The key used by the Entitlements service to sign entitlement tokens.'
);

const domainsTable = new RsDynamoDbTable('entmnt-domains', 'id')
).WithProvisionedBilling(2, 1);
```

### output
```bash
$ yarn fix

yarn run v1.22.19
$ gts fix
version: 16

~/index.ts
44:2 error Parsing error: Declaration or statement expected

✖ 1 problems (1 error)

Error: Command failed with exit code 1: node ./node_modules/eslint/bin/eslint --fix **/*.ts **/*.js **/*.tsx **/*.jsx --no-error-on-unmatched-pattern
at makeError (/~/node_modules/execa/lib/error.js:60:11)
at handlePromise (/~/node_modules/execa/index.js:118:26)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async run (/~/node_modules/gts/build/src/cli.js:123:17) {
shortMessage: 'Command failed with exit code 1: node ./node_modules/eslint/bin/eslint --fix **/*.ts **/*.js **/*.tsx **/*.jsx --no-error-on-unmatched-pattern',
command: 'node ./node_modules/eslint/bin/eslint --fix **/*.ts **/*.js **/*.tsx **/*.jsx --no-error-on-unmatched-pattern',
escapedCommand: 'node "./node_modules/eslint/bin/eslint" --fix "**/*.ts" "**/*.js" "**/*.tsx" "**/*.jsx" --no-error-on-unmatched-pattern',
exitCode: 1,
signal: undefined,
signalDescription: undefined,
stdout: undefined,
stderr: undefined,
failed: true,
timedOut: false,
isCanceled: false,
killed: false
}
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

$
```

### package.json
```json
{
"name": "entitlements-service",
"devDependencies": {
"@types/jest": "^27.4.1",
"@types/node": "^17.0.23",
"gts": "^3.1.0",
"jest": "^27.5.1",
"ts-jest": "^27.1.4",
"typescript": "4.4.4"
},
"scripts": {
"lint": "gts lint",
"clean": "gts clean",
"compile": "tsc",
"fix": "gts fix",
"test": "jest"
}
}
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.