Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revisionLast revisionBoth sides next revision | ||
dev:client_coding:coding_guidelines [2014/04/23 17:03] – [Comments] lowercase @param types dstillman | dev:client_coding:coding_guidelines [2017/11/12 19:53] – external edit 127.0.0.1 | ||
---|---|---|---|
Line 1: | Line 1: | ||
+ | < | ||
+ | in the process of updating the documentation for | ||
+ | <a href=" | ||
+ | may be outdated in the meantime. Thanks for your understanding.</ | ||
+ | |||
+ | |||
JavaScript code in Zotero should conform to the following coding and style guidelines. We encourage Zotero plugin writers to follow these guidelines as well for consistency and possible future integration of code into the Zotero codebase. | JavaScript code in Zotero should conform to the following coding and style guidelines. We encourage Zotero plugin writers to follow these guidelines as well for consistency and possible future integration of code into the Zotero codebase. | ||
Line 38: | Line 44: | ||
</ | </ | ||
- | Braces must **always** be used, even if the enclosed block contains a single line. | + | Braces must **always** be used for multi-line conditionals, even if the enclosed block contains a single line. |
Bad: | Bad: | ||
Line 100: | Line 106: | ||
===== Comments ===== | ===== Comments ===== | ||
- | * Functions should be commented using JSDoc syntax: | + | Functions should be commented using JSDoc syntax: |
<code javascript> | <code javascript> | ||
/** | /** | ||
Line 113: | Line 120: | ||
} | } | ||
</ | </ | ||
- | * For readability and neatness, add a space after the slashes in line comments, and capitalize the first word: | + | |
+ | |||
+ | For readability and neatness, add a space after the slashes in line comments, and capitalize the first word: | ||
Bad: | Bad: | ||
<code javascript> | <code javascript> |