help wantedlang:javascript
Repository metrics
- Stars
- (51,868 stars)
- PR merge metrics
- (Avg merge 6d) (186 merged PRs in 30d)
Description
Prettier 1.19.1 Playground link
--parser babel
Input:
#!/bin/sh
":" //; exec /usr/bin/env ts-node --transpile-only "$0" "$@"
const ten = 10;
Output:
#!/bin/sh
":"; //; exec /usr/bin/env ts-node --transpile-only "$0" "$@"
const ten = 10;
Expected behavior:
#!/bin/sh
":" //; exec /usr/bin/env ts-node --transpile-only "$0" "$@"
const ten = 10;
Because env is not portable regarding options, A shebang like above is required. The problem is that when Prettier is configured to insert semicolons, the shell is not always happy.
Some shells will print "./example.ts: 2: ./example.ts: //: Permission denied" before executing the script. There is no good way to add a prettier-ignore there either because not all shells accept "//" comments.
Because of the above reasons, prettier should not insert a semi colon in this case.