Converge to OpenStack Javascript Coding Standart

Registered by Vitaly Kramskikh on 2016-01-15

Fuel UI used to use independent eslint config to lint JavaScript code. Since Fuel in a part of OpenStack, we must use OpenStack coding style. As file http://git.openstack.org/cgit/openstack/eslint-config-openstack/tree/README.md says, "Even though eslint permits overriding rules on a per-project basis, it should be the goal of every project to stay as close to the common guidelines as possible."

Here is a current list of disabled checks which needs to be enabled:

    complexity: 0
    eqeqeq: 0
    no-script-url: 0
    indent: [0, 2, {SwitchCase: 1}]
    one-var: [0, {uninitialized: always, initialized: never}]
    max-len: [0, 120]

Here is the list of disabled checks which are preferred to be kept disabled, but that can be discussed:

    no-empty: 0 # we use empty blocks with try-catch
    no-extra-parens: 0 # extra parens are preferred with JSX
    consistent-return: 0 # we have lots of code where consistent return isn't needed
    curly: 0 # we're ok with one-line if
    operator-linebreak: 0 # disabled due to heavy use of ternary operator in JSX
    no-warning-comments: 0 # we're ok with FIXMEs
    no-undefined: 0 # we're ok with using undefined
    no-process-env: 0 # we use it in a few places and are ok with it
    no-sync: 0 # it affects our browser code with Sync in function names, like "onModelSync"

Blueprint information

Status:
Complete
Approver:
Vitaly Kramskikh
Priority:
High
Drafter:
Vitaly Kramskikh
Direction:
Approved
Assignee:
Vitaly Kramskikh
Definition:
Approved
Series goal:
Accepted for mitaka
Implementation:
Implemented
Milestone target:
milestone icon 9.0
Started by
Vitaly Kramskikh on 2016-01-15
Completed by
Vitaly Kramskikh on 2016-02-02

Related branches

Sprints

Whiteboard

Gerrit topic: https://review.openstack.org/#q,topic:bp/converge-to-eslint-config-openstack,n,z

Addressed by: https://review.openstack.org/268117
    Force eqeqeq eslint rule

Addressed by: https://review.openstack.org/268248
    Use 2 spaces instead of 4 for indentation of JS code

Addressed by: https://review.openstack.org/268779
    Enable linting for node.js files and split .eslintrc

Addressed by: https://review.openstack.org/268123
    Force no-script-url eslint rule

Addressed by: https://review.openstack.org/269687
    Eslint complexity rule

Gerrit topic: https://review.openstack.org/#q,topic:one_var,n,z

Addressed by: https://review.openstack.org/269861
    Force eslint one-var rule

Addressed by: https://review.openstack.org/270172
    Forcing eslint max-len rule

Addressed by: https://review.openstack.org/270996
    Enable 'consistent-return' eslint rule

Addressed by: https://review.openstack.org/271010
    Enable 'no-sync' eslint rule

Addressed by: https://review.openstack.org/271216
    Fix complexity warning for network validation code

Addressed by: https://review.openstack.org/271439
    Spec for converge-to-eslint-config-openstack blueprint

Addressed by: https://review.openstack.org/272453
    Fix complexity warning for node pop-up

Addressed by: https://review.openstack.org/272502
    Force eqeqeq rule for test files

Addressed by: https://review.openstack.org/272504
    Force eqeqeq rule for plugin files

Addressed by: https://review.openstack.org/272519
    Force eqeqeq rule for cluster tab views

Addressed by: https://review.openstack.org/272927
    Force eqeqeq eslint rule for views

Addressed by: https://review.openstack.org/272936
    Fix complexity warning for node pop-up render

Addressed by: https://review.openstack.org/273020
    Force eqeqeq eslint rule for Fuel UI code

Addressed by: https://review.openstack.org/273211
    Fix missing eqeqeq in wizard code

Addressed by: https://review.openstack.org/273212
    Set ESLint 'curly' rule in 'multi-line' mode

Addressed by: https://review.openstack.org/273420
    Fix complexity warning for network validation

Addressed by: https://review.openstack.org/281355
    Restore missing quote-props ESLint rule

(?)

Work Items

This blueprint contains Public information 
Everyone can see this information.

Subscribers

No subscribers.