NodeJS Category Submission Requirements

Refer to the following guidelines before submitting items to the Node.js category.

Requirements

  • Use Error objects (or subclasses) for all errors, and implement the Error contract. 
  • A function may deliver operational errors synchronously (e.g., by throwing) or asynchronously (by passing them to a callback or emitting error on an EventEmitter), but it should not do both. 
  • Augment the Error object with properties that explain details 
  • If you pass a lower-level error to your caller, consider wrapping it instead. 
  • If you need to do a series of asynchronous operations on a set of input, it's good to find a control flow library that simplifies the process for you as long as it's documented in the item description. 
  • Consider moving function definitions outside of other functions. 
  • Consider keeping your functions less than 100 lines each so the JIT will likely be able to inline those functions 
  • Variables aren't allowed in the global scope unless absolutely necessary -- reviewer discretion. 
  • Natives objects shouldn't be extended or modified in any way. 
  • Follow JavaScript identifier naming guidelines, such as camelCase for most identifiers (no underscore_naming) and PascalCase for constructor functions.
  • A minified copy can be included but a non-minified copy needs to be included as well. 
  • All variable declarations need not be present at the top. If a global is absolutely needed and created within a function, it should be explicitly created by prepending `window` (as opposed to omitting the `var` keyword). 
  • All variables need to be declared and initialized before being used. 
  • There are some good reasons to nest a function in another function, but nested functions are more often used incorrectly and incur a performance hit. 
  • The 'parseInt()' function can return undesired and/or unexpected results if the radix is not supplied. 
  • It is not an error (yet), but redeclaring local variables is considered bad practice. 
  • A named function needs to be used when binding the same function to more than three elements instead of an anonymous function. 
  • Use of eval isn't allowed. 
  • Semi-colons for line termination is mandatory. 
  • The code shouldn't generate any errors or notices in the development console. 
  • Objects that are created as a result of a function call should be stored in a variable if said object is used more than once in the same level of scope. 
  • Use of cutting edge JavaScript APIs is allowed as long as it's clearly mentioned in the description. 
  • Provided code needs to pass JSLint. 
  • Do not rely on semicolon insertion. Always end a statement with a semicolon. 
  • All JavaScript needs to be written with strict mode on. 

Workflow

  • Every item should have documentation explaining the installation process as well as a clear cut description detailing specific dependencies/modules/server settings for the item. 
  • Double check any specific file/directory permissions as well as version numbers. 
  • Use Litmus or a related service to make sure the item’s stated cross browser functionality is intact. 
  • Run the code through the following [part of requirements above]:
    http://www.jshint.com/
    http://sucuri.net/ [If live preview is present]
1 votes
This article was helpful
This article was not helpful
Help Desk Software by Kayako Resolve