Put a hardline between "StringLiteral" + "StringLiteral"
See original GitHub issueRight now
console.error(
'In order to use ' + prompt + ', you need to configure a ' +
'few environment variables to be able to commit to the ' +
'repository. Follow those steps to get you setup:\n' +
'\n' +
'Go to https://github.com/settings/tokens/new\n' +
' - Fill "Token description" with "' + prompt + ' for ' +
repoSlug + '"\n' +
' - Check "public_repo"\n' +
' - Press "Generate Token"\n' +
'\n' +
'In a different tab, go to https://travis-ci.org/' +
repoSlug + '/settings\n' +
' - Make sure "Build only if .travis.yml is present" is ON\n' +
' - Fill "Name" with "GITHUB_USER" and "Value" with the name of the ' +
'account you generated the token with. Press "Add"\n' +
'\n' +
'Once this is done, commit anything to the repository to restart ' +
'Travis and it should work :)'
);
gets printed as
console.error(
"In order to use " +
prompt +
", you need to configure a " +
"few environment variables to be able to commit to the " +
"repository. Follow those steps to get you setup:\n" +
"\n" +
"Go to https://github.com/settings/tokens/new\n" +
' - Fill "Token description" with "' +
prompt +
" for " +
repoSlug +
'"\n' +
' - Check "public_repo"\n' +
' - Press "Generate Token"\n' +
"\n" +
"In a different tab, go to https://travis-ci.org/" +
repoSlug +
"/settings\n" +
' - Make sure "Build only if .travis.yml is present" is ON\n' +
' - Fill "Name" with "GITHUB_USER" and "Value" with the name of the ' +
'account you generated the token with. Press "Add"\n' +
"\n" +
"Once this is done, commit anything to the repository to restart " +
"Travis and it should work :)"
);
which breaks on every single + which makes the code harder to read.
One pattern that we can extract is that if you have “string” + “string”, it likely means that there was a \n there originally. So, if we would reformat the code as
group("In order to use " + prompt + ", you need to configure a " +)
group("few environment variables to be able to commit to the " +)
group("repository. Follow those steps to get you setup:\n" +)
group("\n" +)
group("Go to https://github.com/settings/tokens/new\n" +)
group(' - Fill "Token description" with "' + prompt + " for " + repoSlug + '"\n' +)
group(' - Check "public_repo"\n' +)
group(' - Press "Generate Token"\n' +)
group("\n" +)
group("In a different tab, go to https://travis-ci.org/" + repoSlug + "/settings\n" +)
group(' - Make sure "Build only if .travis.yml is present" is ON\n' +)
group(' - Fill "Name" with "GITHUB_USER" and "Value" with the name of the ' +)
group('account you generated the token with. Press "Add"\n' +)
group("\n" +)
group("Once this is done, commit anything to the repository to restart " +)
group("Travis and it should work :)")
that would lead to a better output than breaking on every single +
Issue Analytics
- State:
- Created 7 years ago
- Comments:5 (5 by maintainers)
Top Results From Across the Web
Difference between String literal and New String object in ...
The String class or java.lang.String is a special class in Java API and has so many special behaviors which are not obvious to...
Read more >c# - How to insert newline in string literal?
In .NET I can provide both \r or \n string literals, but there is a way to insert something like "new line" special...
Read more >String literal
Explanation. 1) Ordinary string literal. The type of an unprefixed string literal is const char[N], where N is the size of the string...
Read more >String literals
A string literal contains a sequence of characters or escape sequences enclosed in double quotation mark symbols. A string literal with the prefix...
Read more >Verbatim text - @ in variables, attributes, and string literals
The @ character in this instance defines a verbatim string literal. Simple escape sequences (such as "\\" for a backslash), hexadecimal escape ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
https://www.npmjs.com/package/dedent works really well
Closing this as I don’t think that this is the right fix.