mirror of
https://github.com/LaCasemate/fab-manager.git
synced 2024-12-13 23:48:55 +01:00
1.5 KiB
1.5 KiB
components
This directory is holding the components built with React.
During the migration phase, these components may be included in the legacy angularJS app using react2angular.
These components must be written using the following conventions:
- The component name must be in CamelCase.
- The component must be exported as a named export (no
export default
). - A component
FooBar
must have aclassName="foo-bar"
attribute on its top-level element. - The stylesheet associated with the component must be located in
app/frontend/src/stylesheets/modules/same-directory-structure/foo-bar.scss
. - All methods in the component must be commented with a comment block.
- Other constants and variables must be commented with an inline block.
- Depending on if we want to use the
<Suspense>
wrapper or not, we can export the component directly or wrap it in a<Loader>
wrapper. - When a component is used in angularJS, the wrapper is required. The component must be named like
const Foo
(no export if not used in React) and must have aconst FooWrapper
at the end of its file, which wraps the component in a<Loader>
. - Translations must be grouped per component. For example, the
FooBar
component must have its translations in theconfig/locales/app.$SCOPE.en.yml
file, under thefoo_bar
key. - Most of these rules are validated by eslint-plugin-fabmanager. Please ensure you write eslint valid code, and think twice you have a very good reason before disabling any rule.