![]() ![]() String ConcatenationĮxpressions SHOULD be separated with one space before and after the + operator to improve readability. If each line of a list needs a separate comment, comments MAY be placed on the same line and MAY be formatted to a uniform indent for readability.Ĭ style comments ( /* */) and standard C++ comments ( //) are both allowed. Comments SHOULD be on a separate line, immediately before the code line or block they reference. Non-JSDoc comments SHOULD use capitalized sentences with punctuation. Comments MAY be removed by JS compression utilities later, so they don't negatively impact the file download size. Non-JSDoc comments are strongly RECOMMENDED.Ī general rule of thumb is that if you look at a section of code and think "Wow, I don't want to try and describe that", you SHOULD comment it before you forget how it works. Inline documentation for source files MUST follow the JavaScript API documentation and comment standards (based on JSDoc). Var collapsibleDetail = new CollapsibleDetails(element) Anonymous functions assigned to a variable MUST be followed by a semi-colon.ĭ = function (context). ![]() Return values MUST start on the same line as the return keyword.All statements (except for, function, if, switch, try, while) MUST be followed by a semi-colon ( ),.JavaScript allows optional "semi-colon insertion". All code MUST NOT end with trailing whitespace.All code MUST NOT indent using tab characters,.All code MUST indent using two (2) space characters,.See the eslint settings information. Drupal uses 'eslint-config-airbnb' as ESLint shareable config. Therefore it's reasonable to use 'Airbnb JavaScript Style Guide' as Drupal JS coding standard. Use eslint for Drupal JS coding standards. ![]() Note: Changes to Drupal coding standards are proposed and discussed in issues in the Coding Standards project. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |