File tree Expand file tree Collapse file tree 3 files changed +45
-4
lines changed Expand file tree Collapse file tree 3 files changed +45
-4
lines changed Original file line number Diff line number Diff line change @@ -65,9 +65,10 @@ to have more information about the integration.
6565⚠️ Configurations set to warn in.\
6666✅ Set in the ` recommended ` configuration.
6767
68- | Name | Description | ⚠️ |
69- | :----------------------------------------------------------------------------- | :-------------------------------------------- | :- |
70- | [ no-multiple-access-dom-element] ( docs/rules/no-multiple-access-dom-element.md ) | Disallow multiple access of same DOM element. | ✅ |
68+ | Name | Description | ⚠️ |
69+ | :------------------------------------------------------------------------------------- | :-------------------------------------------- | :- |
70+ | [ no-multiple-access-dom-element] ( docs/rules/no-multiple-access-dom-element.md ) | Disallow multiple access of same DOM element. | ✅ |
71+ | [ prefer-collections-with-pagination] ( docs/rules/prefer-collections-with-pagination.md ) | Prefer API collections with pagination | ✅ |
7172
7273<!-- end auto-generated rules list -->
7374
Original file line number Diff line number Diff line change 1+ # Prefer API collections with pagination (` @ecocode/prefer-collections-with-pagination ` )
2+
3+ ⚠️ This rule _ warns_ in the ✅ ` recommended ` config.
4+
5+ <!-- end auto-generated rule header -->
6+
7+ ## Rule details
8+
9+ This rule aims to reduce the size and thus the network weight of API returns that may contain many elements. This rule
10+ is built for the NestJS framework but can work with a controller @Controller () and a decorated method @Get ().
11+
12+ ## Examples
13+
14+ Examples of ** incorrect** code for this rule:
15+
16+ ``` ts
17+ @Controller ()
18+ class Test {
19+ @Get ()
20+ public find(): Promise <string []> {
21+ }
22+ }
23+ ```
24+
25+ Examples of ** correct** code for this rule:
26+
27+ ``` ts
28+ interface Pagination {
29+ items: string [];
30+ currentPage: number ;
31+ totalPages: number ;
32+ }
33+
34+ @Controller ()
35+ class Test {
36+ @Get ()
37+ public find(): Promise <Pagination > {
38+ }
39+ }
40+ ```
Original file line number Diff line number Diff line change @@ -63,7 +63,7 @@ const rule = createRule({
6363 name : "prefer-collections-with-pagination" ,
6464 meta : {
6565 docs : {
66- description : "TODO " ,
66+ description : "Prefer API collections with pagination " ,
6767 category : "eco-design" ,
6868 recommended : "warn" ,
6969 } ,
You can’t perform that action at this time.
0 commit comments