BotBuilder-Samples icon indicating copy to clipboard operation
BotBuilder-Samples copied to clipboard

Minor indentation issue - javascript_nodejs/03.welcome-users/bots/welcomeBot.js

Open zxyanliu opened this issue 7 years ago • 2 comments

Sample information

  1. Sample type: [Incorrect indentation]
  2. Sample language: [nodejs]
  3. Sample name: <03.welcome-users>

Describe the bug

We are citing from this sample in this article.

The code snippet (javascript_nodejs/03.welcome-users/bots/welcomebot.js?range=65-88) seems not indent correctly.

Expected behavior

Format the indentation.

Screenshots

image

Additional context

If the lines of this snippet will be changed, please let us know.

[bug]

zxyanliu avatar Aug 20 '19 18:08 zxyanliu

Hmm, took a look at the .onMembersAdded() method that you have in question, and its indentation looks fine to me.


Perhaps you're referencing the indentation going on in LN 76 - 79, the 2nd message sent?

  • It's sending a longer block of text in its message, hence the string concatenation :heavy_check_mark:
    • Best done this way, instead of 1 long string, to not have 1 line that's excessively long with extreme horizontal scrolling w/o wrap
    • For example, to compare, in our Python SDK's linting rules, it specifies that 1 line can have a max of 120 characters (max-line-length=120)
    • LNs 77 - 79 are also properly indented in this string concatenation, to show that it's a continuation of LN 76
  • As for the indentation sizes themselves, if you compare the eslint rules set in the botbuilder-js repo, it specifies that indentation should be 4 spaces :heavy_check_mark:
    • .onMembersAdded()'s indentation all follow 4-space indentation rule

Resolving issue as indentation looks good in sample

Zerryth avatar Aug 21 '19 06:08 Zerryth

Thank you! @Zerryth

zxyanliu avatar Aug 21 '19 06:08 zxyanliu