Skip to content

Commit 45446ea

Browse files
authored
Merge pull request #87 from clivewong/main
W-17274151 Add rule no-more-than-100-fields.md file to eslint-plugin-lwc-mobile Repo
2 parents 32dac44 + 918b694 commit 45446ea

File tree

2 files changed

+355
-4
lines changed

2 files changed

+355
-4
lines changed

Diff for: src/docs/apex-import.md

+5-4
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
# apex-import
22

3-
Using Apex in LWC Offline-enabled mobile apps requires additional considerations to ensure proper functioning in offline scenarios.
3+
Using Apex in LWC Offline-enabled mobile apps requires additional considerations to ensure proper functioning in offline scenarios. Consider using GraphQL for mobile offline use cases.
44

5-
When a client device is offline, Apex-based features can read data that was cached while online, but changes (writing data) can’t be saved back to the server. Nor can a change via Apex methods be enqueued as a draft into the Offline Queue. A Lightning web component that uses Apex must be prepared to handle a network connection error as a normal response, for both reading and writing operations.
6-
7-
See [Use Apex While Mobile and Offline](https://developer.salesforce.com/docs/atlas.en-us.mobile_offline.meta/mobile_offline/apex.htm) for more details.
5+
GraphQL is a flexible, powerful query language for accessing record and other data. You can think of GraphQL as SQL for your API, the query language for relational databases.
86

7+
Developers like GraphQL for modern web applications because, in contrast to many REST and CRUD-oriented APIs, GraphQL allows for expressive queries, with features like filtering and scopes, ordering and aggregation, pagination, and relationship traversal to related records. A single query can retrieve many records, and even records of multiple types. Using fewer queries reduces the number of server requests required to load data, which can improve performance. A GraphQL query can specify precisely and only the fields required for a given component, reducing the amount of data that needs to be transmitted before a page can render.
98

9+
For mobile developers building apps that work while offline, however, there is only one implementation that matters: Offline GraphQL.
1010

11+
See [Use GraphQL While Mobile and Offline](https://developer.salesforce.com/docs/atlas.en-us.mobile_offline.meta/mobile_offline/apex.htm) and [GraphQL Wire Adapter for LWC](https://developer.salesforce.com/docs/platform/graphql/guide/graphql-wire-lwc.html) for more details.

Diff for: src/docs/no-more-than-100-fields.md

+350
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,350 @@
1+
# no-more-than-100-fields
2+
3+
This rule flags entities with more than 100 fields. If a root entity query has more than 100 fields and requests over 200 records, the query is capped to 200 records.
4+
5+
## ❌ Incorrect
6+
7+
```GraphQL
8+
{
9+
query OpportunityExample {
10+
uiapi {
11+
query {
12+
Opportunity {
13+
edges {
14+
node {
15+
Id
16+
Name {
17+
value
18+
}
19+
Field1 {
20+
value
21+
}
22+
Field2 {
23+
value
24+
}
25+
Field3 {
26+
value
27+
}
28+
Field4 {
29+
value
30+
}
31+
Field5 {
32+
value
33+
}
34+
Field6 {
35+
value
36+
}
37+
Field7 {
38+
value
39+
}
40+
Field8 {
41+
value
42+
}
43+
Field9 {
44+
value
45+
}
46+
Field10 {
47+
value
48+
}
49+
Field11 {
50+
value
51+
}
52+
Field12 {
53+
value
54+
}
55+
Field13 {
56+
value
57+
}
58+
Field14 {
59+
value
60+
}
61+
Field15 {
62+
value
63+
}
64+
Field16 {
65+
value
66+
}
67+
Field17 {
68+
value
69+
}
70+
Field18 {
71+
value
72+
}
73+
Field19 {
74+
value
75+
}
76+
Field20 {
77+
value
78+
}
79+
Field21 {
80+
value
81+
}
82+
Field22 {
83+
value
84+
}
85+
Field23 {
86+
value
87+
}
88+
Field24 {
89+
value
90+
}
91+
Field25 {
92+
value
93+
}
94+
Field26 {
95+
value
96+
}
97+
Field27 {
98+
value
99+
}
100+
Field28 {
101+
value
102+
}
103+
Field29 {
104+
value
105+
}
106+
Field30 {
107+
value
108+
}
109+
Field31 {
110+
value
111+
}
112+
Field32 {
113+
value
114+
}
115+
Field33 {
116+
value
117+
}
118+
Field34 {
119+
value
120+
}
121+
Field35 {
122+
value
123+
}
124+
Field36 {
125+
value
126+
}
127+
Field37 {
128+
value
129+
}
130+
Field38 {
131+
value
132+
}
133+
Field39 {
134+
value
135+
}
136+
Field40 {
137+
value
138+
}
139+
Field41 {
140+
value
141+
}
142+
Field42 {
143+
value
144+
}
145+
Field43 {
146+
value
147+
}
148+
Field44 {
149+
value
150+
}
151+
Field45 {
152+
value
153+
}
154+
Field46 {
155+
value
156+
}
157+
Field47 {
158+
value
159+
}
160+
Field48 {
161+
value
162+
}
163+
Field49 {
164+
value
165+
}
166+
Field50 {
167+
value
168+
}
169+
Field51 {
170+
value
171+
}
172+
Field52 {
173+
value
174+
}
175+
Field53 {
176+
value
177+
}
178+
Field54 {
179+
value
180+
}
181+
Field55 {
182+
value
183+
}
184+
Field56 {
185+
value
186+
}
187+
Field57 {
188+
value
189+
}
190+
Field58 {
191+
value
192+
}
193+
Field59 {
194+
value
195+
}
196+
Field60 {
197+
value
198+
}
199+
Field61 {
200+
value
201+
}
202+
Field62 {
203+
value
204+
}
205+
Field63 {
206+
value
207+
}
208+
Field64 {
209+
value
210+
}
211+
Field65 {
212+
value
213+
}
214+
Field66 {
215+
value
216+
}
217+
Field67 {
218+
value
219+
}
220+
Field68 {
221+
value
222+
}
223+
Field69 {
224+
value
225+
}
226+
Field70 {
227+
value
228+
}
229+
Field71 {
230+
value
231+
}
232+
Field72 {
233+
value
234+
}
235+
Field73 {
236+
value
237+
}
238+
Field74 {
239+
value
240+
}
241+
Field75 {
242+
value
243+
}
244+
Field76 {
245+
value
246+
}
247+
Field77 {
248+
value
249+
}
250+
Field78 {
251+
value
252+
}
253+
Field79 {
254+
value
255+
}
256+
Field80 {
257+
value
258+
}
259+
Field81 {
260+
value
261+
}
262+
Field82 {
263+
value
264+
}
265+
Field83 {
266+
value
267+
}
268+
Field84 {
269+
value
270+
}
271+
Field85 {
272+
value
273+
}
274+
Field86 {
275+
value
276+
}
277+
Field87 {
278+
value
279+
}
280+
Field88 {
281+
value
282+
}
283+
Field89 {
284+
value
285+
}
286+
Field90 {
287+
value
288+
}
289+
Field91 {
290+
value
291+
}
292+
Field92 {
293+
value
294+
}
295+
Field93 {
296+
value
297+
}
298+
Field94 {
299+
value
300+
}
301+
Field95 {
302+
value
303+
}
304+
Field96 {
305+
value
306+
}
307+
Field97 {
308+
value
309+
}
310+
Field98 {
311+
value
312+
}
313+
Field99 {
314+
value
315+
}
316+
Field100 {
317+
value
318+
}
319+
}
320+
}
321+
}
322+
}
323+
}
324+
}
325+
}
326+
```
327+
328+
## ✅ Correct
329+
330+
```GraphQL
331+
{
332+
query accountQuery {
333+
uiapi {
334+
query {
335+
Account {
336+
edges {
337+
node {
338+
Id
339+
Name {
340+
value
341+
}
342+
}
343+
}
344+
}
345+
}
346+
}
347+
}
348+
}
349+
350+
```

0 commit comments

Comments
 (0)