You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: general/development/policies/codingstyle-moodleapp.md
+8-69Lines changed: 8 additions & 69 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -601,37 +601,9 @@ There is a maximum line length of 140 characters for templates. Whenever that le
601
601
If you are using VSCode, this should be done automatically on every save with the [configuration that ships with the app](https://github.com/moodlehq/moodleapp/blob/latest/.vscode/settings.json#L8).
602
602
:::
603
603
604
-
### Avoid default exports
605
-
606
-
Using default exports should be avoided for Angular applications because they [cause issues with AOT compiler](https://stackoverflow.com/questions/45962317/why-isnt-export-default-recommended-in-angular). Technically only components have this problem, but in order to avoid the mental load of thinking about this every time, we disallow it altogether.
607
-
608
-
<ValidExampletitle="Good">
609
-
610
-
```ts
611
-
@Component({
612
-
selector: 'my-component',
613
-
templateUrl: 'my-component.html',
614
-
})
615
-
exportclassMyComponent {}
616
-
```
617
-
618
-
</ValidExample>
619
-
620
-
<InvalidExampletitle="Bad">
621
-
622
-
```ts
623
-
@Component({
624
-
selector: 'my-component',
625
-
templateUrl: 'my-component.html',
626
-
})
627
-
exportdefaultclassMyComponent {}
628
-
```
629
-
630
-
</InvalidExample>
631
-
632
604
### Declaring page modules
633
605
634
-
When creating a page component, it should be declared in the feature's [lazy modules](../../../general/app/development/development-guide.md#routing). Exceptionally, pages that are used by more than one module can create a page module; but this module should only declare components, it shouldn't include any routing functionality.
606
+
When creating a page component, it should be declared as a standalone component and exported as default class so it can be easily [lazy loaded](../../../general/app/development/development-guide.md#routing).
635
607
636
608
<ValidExampletitle="Good">
637
609
@@ -640,66 +612,33 @@ When creating a page component, it should be declared in the feature's [lazy mod
0 commit comments