-
Notifications
You must be signed in to change notification settings - Fork 98
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
Remove trailing commas in CodeGen #73
Comments
prettier throws following error in zsh while doing CodeGen for multiple packages: zsh: argument list too long: prettier I faced this error while generating rest-json clients aws/aws-sdk-js-v3#643, fixed it temporarily by switching to bash |
lint-staged showed the following warning while committing update to aws.json-1.1 clients: ⚠ lint-staged generated an argument string of 237405 characters, and commands might not run correctly on your platform.
It is recommended to use functions as linters and split your command based on the number of staged files. For more info, please visit:
https://github.com/okonet/lint-staged#using-js-functions-to-customize-linter-commands The number of files which need to be prettified at lint-staged can be reduced if trailing comma is removed in codegen |
The fix is not working anymore in bash, and git commit fails with following error spawn E2BIG I faced this issue while updating clients with fix from aws/aws-sdk-js-v3#696 The prettier command also fails in bash:
|
Temporarily fixed the issue by running prettier on each file instead: $ git diff --name-only --cached | xargs -I '{}' prettier --write '{}' |
Running prettier on each staged file takes lot of time A faster fix is running prettier per client instead of per file for f in clients/*
do
./node_modules/.bin/prettier --write $f/**/*.{ts,md,json}
done |
temporary commit which added It has several changes other than trailing commas, as shown in the screenshot below As discussed offline:
Closing this in favor of aws/aws-sdk-js-v3#698 |
* Remove SJCL from browser random source * Use crypto feature detection rather than generic runtime detection * Remove packages vendoring portions of the SJCL * Fix flaky signature tests
* Remove SJCL from browser random source * Use crypto feature detection rather than generic runtime detection * Remove packages vendoring portions of the SJCL * Fix flaky signature tests
The repo aws/aws-sdk-js-v3 uses prettier for formatting which doesn't add trailing commas by default. And we plan to continue using default options of prettier
Docs: https://prettier.io/docs/en/options.html#trailing-commas
We're running prettier on precommit hook to overwrite code generated by CodeGen aws/aws-sdk-js-v3#631
And noticed that trailing commas are added by smithy-typescript-codegen in aws/aws-sdk-js-v3@5f9fbfc
It's optional for smithy-typescript to remove addition of trailing commas.
It won't affect aws/aws-sdk-js-v3 as prettier overwrites the code on precommit hook.
The text was updated successfully, but these errors were encountered: