Improve javascript coding style

Registered by Maxime Vidori on 2013-12-31

This blueprint is about Javascript coding style improvement, like python has pep8, it could be interesting to have some rules for javascript too. JSHint provides some rules to perform this and I think it could be a great idea to discuss about which rules could be integrated into Horizon.

According to http://www.jshint.com/docs/options/ here is a list of the rules which seems interesting:
 - bitwise
 - curly
 - eqeqeq
 - forin
 - latedef
 - noempty
 - undef
 - unused with vars
 - trailing

Here is a second list of options which can be integrated but need some discussion before:
 - camelcase
 - quotmark

Blueprint information

Status:
Complete
Approver:
David Lyle
Priority:
Medium
Drafter:
Maxime Vidori
Direction:
Approved
Assignee:
Maxime Vidori
Definition:
Approved
Series goal:
Accepted for juno
Implementation:
Implemented
Milestone target:
milestone icon 2014.2
Started by
David Lyle on 2014-01-15
Completed by
David Lyle on 2014-07-22

Related branches

Sprints

Whiteboard

Gerrit topic: https://review.openstack.org/#q,topic:bp/jshint-codestyle,n,z

Addressed by: https://review.openstack.org/64272
    Javascript coding style indent 2

For the first patch I have chosen to fix indentation at 2 spaces, due to the particularity of javascript to have a bunch of nested functions.

This is a personal choice, it can be changed, let me know your opinion on this.

Addressed by: https://review.openstack.org/64687
    Javascript force use of the identity operator

Addressed by: https://review.openstack.org/64693
    Javascript force use of the curly braces.

Addressed by: https://review.openstack.org/65254
    Javascript force filtering object items

Addressed by: https://review.openstack.org/65255
    Javascript prohibits the use of bitwise operators

Addressed by: https://review.openstack.org/65256
    Javascript detection of unused variables

Addressed by: https://review.openstack.org/65102
    Fix charts display in Resource Usage

Gerrit topic: https://review.openstack.org/#q,topic:bp/node-toolchain,n,z

Addressed by: https://review.openstack.org/97237
    Add jshint for javascript linting

(?)

Work Items

This blueprint contains Public information 
Everyone can see this information.

Subscribers

No subscribers.