Skip to main content

Code Compliance Implemented In Angular

· 2 min read

Since we're always working on improving our generated SDK's, today we're announcing some major work done on the Angular.js SDK.

  • Angular.js generated code is now standard compliant.
  • The standard we're using is John Papa's Angular1 Style Guide.
  • The linter can be run from the command-line by using the command jshint <folder-name-to-lint>.
  • The configuration file for the linter will be included with the SDK from now.

Please generated your SDK again to get the standard compliant code.

Details Of Changes Made

Here's a summary of all the changes we've made to the code-base:

  • Double quotes have been replaced by single quotes in the SDK.
  • Some missing semi-colons have been added at places.
  • All code and comments now follow a max line length of 120 characters.
  • Unnecessary imports in files have been removed (from controllers and model files).
  • Moment import has been improved (in files where Date/Datetime is being used).
  • Object properties are strictly being accessed using dot notation whenever possible.
  • Ensured === is used instead of == for equality checks.
  • API Helper code has been refactored.
  • All for-in loops are now safe to use since they are wrapped in if statements.
  • Strings exceeding line length allowed will be created into multi-line strings.
  • Anonymous functions have been replaced by named functions.

Running Linter Tests

To check for Style Guide compliance, you can run the JSHint tool.

To run the linter, you can use a command line version of JSHint or use a plugin for the IDE you're using (if available)

Running JSHint CLI

Use this command to run the linter:

jshint <folder-name-to-lint>

Running JSHint Plugin

Follow the instructions here.

The JSHint configuration file that we're using will be generated with the SDK.