1.9 KiB
1.9 KiB
Code Style
- project uses typescript to statically analyze code
- project uses
eslintto check frontend code. You can manually runnpm run lintfrom./webdirectory to check style. - git hooks (via husky) installed automatically on
npm installand check and try to fix code style if possible, otherwise commit will be rejected - if you want IDE integration, you need
eslintplugin to be installed.
CSS Styles
- although styles have
scssextension, it is actually pack of post-css plugins, so syntax differs, for example incalcfunction. - component styles use BEM notation (at least it should):
block__element_modifier. Also there aremixclasses:block_modifier. - component base style resides in the component's root directory with name of component converted to kebab-case. For example
ListCommentsstyle is located in./web/app/components/list-comments/list-comments/scss - component's element style resides in its own subdirectory, with name consisting of full elements selector, for example
ListCommentsitemelement is placed in__itemdirectory under name./list-comments__item.scss - each style should be
required inindex.tsof component's root directory
Imports
- imports for typescript, javascript files should be without extension:
./index, not./index.ts - if file resides in same directory or in subdirectory import should be relative:
./types/something - otherwise it should start from
@appnamespace:@app/common/storewhich mapped to/web/app/common/store.tsin webpack, tsconfig and jest
Testing
- project uses
jestas test harness. - jest check files that match regex
\.test\.(j|t)s(x?)$, i.ecomment.test.tsx,comment.test.js - you should run tests via
npm run testfrom./webdirectory before pushing to master to avoid failed build - example tests can be found in
./web/app/store/user/reducers.test.ts,./web/app/components/auth-panel/auth-panel.test.tsx