Style Guide
We are following the Airbnb JavaScript Style Guide for the FOSSology UI project.
ESlint (a pluggable and configurable linter tool) and Prettier (an opinionated code formatter) are used to enforce the style guide.
Coding Conventions
-
All files using JSX syntax should have
.jsx
extension. -
Use Pascal case for naming React components.
-
Use Camel case for the function name and variable name.
-
Prefer using default export.
-
Prefer using arrow functions.
-
Prefer using functional components.
-
Avoid using
PropTypes.array
orPropTypes.object
. Instead usePropTypes.arrayOf(PropTypes.string)
orPropTypes.shape({id: PropTypes.number})
respectively.
General Naming Convention
In the code and documentation prefer using non-offensive terminology, for example:
allowlist
/denylist
(instead ofwhitelist
/blacklist
).primary
/replica
(instead ofmaster
/slave
).openbox
/closedbox
(instead ofwhitebox
/blackbox
).
Before making any pull request one should:
-
Run
yarn fix:all
to fix all auto fixable errors and warnings. -
Run
yarn test
to run all react tests. -
Ensure that your commit contains a Signed-off-by line, also known as the Developer Certificate of Origin (DCO).
-
Ensure that you have added your name and email in the license headers of all the files that you have modified.