Skip to content

Style Guide

NeZanyat edited this page Nov 12, 2018 · 4 revisions

Important note: everything which is not covered here should be covered with rules from this page - https://github.com/MetaCell/lunapark-dev/wiki/Linting

JS

Components

View name - PascalCase (ExampleForAViewName).

Container name - Same as for the view, but with Container at the end of the name.

Files for classes - Name should be the same as for class.

Files for small components which are outside of redux infrastructure - partials.js

Actions

Creators and actions - filename: small letters and - as separator

Services

Class name - should represent what service do

Shared

Class name - should represent what class do

Reducers

Reducers - filename: small letters and - as separator, and scidash- as a prefix

CSS

ID - small letters and - as a separator

Class - small letters and - as a separator

It's preferred to use classes instead of ID in case you do some styling, if you need to get DOM element from JS, you may mark it with ID.


Important - Don't write any logic in views, don't write any views in containers, if you need a small view for exclude it from the main view, use partials.js

If you need some custom logic - you may use\create service or shared class. In container only logic which can be used - it's just providing data for view, and methods (not necessary method should use redux dispatch, it can be just a method for view)

Clone this wiki locally