eslint-plugin-use-agnostic 1.6.10 → 1.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/comments.config.json +46 -2
- package/comments.config.mjs +47 -3
- package/jscomments/jsdoc/comments.js +14 -2
- package/jscomments/jsdoc/composed-variables.js +2 -0
- package/library/_commons/utilities/helpers.js +21 -21
- package/library/_commons/utilities/walk-ast.js +6 -6
- package/library/agnostic20/_commons/constants/bases.js +57 -57
- package/library/agnostic20/_commons/utilities/flows.js +17 -17
- package/library/agnostic20/_commons/utilities/helpers.js +43 -43
- package/library/agnostic20/config.js +3 -3
- package/library/directive21/_commons/constants/bases.js +85 -85
- package/library/directive21/_commons/utilities/analyze-exports-re.js +3 -7
- package/library/directive21/_commons/utilities/flows.js +22 -52
- package/library/directive21/_commons/utilities/helpers.js +85 -85
- package/library/directive21/config.js +3 -3
- package/package.json +1 -1
- package/types/index.d.ts +100 -100
|
@@ -164,12 +164,12 @@ export const commentedDirectives_verificationReports = Object.freeze({
|
|
|
164
164
|
/* commentedDirectives_blockedImports */
|
|
165
165
|
|
|
166
166
|
/**
|
|
167
|
-
*
|
|
167
|
+
* Makes a blockedImport object for the identified blocked import at hand.
|
|
168
168
|
* @template {CommentedDirectiveWithoutUseAgnosticStrategies} T
|
|
169
169
|
* @template {CommentedDirectiveWithoutUseAgnosticStrategies} U
|
|
170
|
-
* @param {T} currentFileCommentedDirective
|
|
171
|
-
* @param {U} importedFileCommentedDirective
|
|
172
|
-
* @returns
|
|
170
|
+
* @param {T} currentFileCommentedDirective The current file's commented directive.
|
|
171
|
+
* @param {U} importedFileCommentedDirective The imported file's commented directive.
|
|
172
|
+
* @returns The blockedImport object for the identified blocked import at hand.
|
|
173
173
|
*/
|
|
174
174
|
export const makeBlockedImport = (
|
|
175
175
|
currentFileCommentedDirective,
|
|
@@ -190,190 +190,190 @@ export const makeBlockedImport = (
|
|
|
190
190
|
|
|
191
191
|
export const commentedDirectives_blockedImports = Object.freeze({
|
|
192
192
|
[USE_SERVER_LOGICS]: Object.freeze([
|
|
193
|
-
// USE_SERVER_LOGICS
|
|
193
|
+
// USE_SERVER_LOGICS allowed, because Prime Server Logics can compose with one another.
|
|
194
194
|
makeBlockedImport(
|
|
195
195
|
USE_SERVER_LOGICS,
|
|
196
196
|
USE_CLIENT_LOGICS
|
|
197
|
-
) /*
|
|
198
|
-
// USE_AGNOSTIC_LOGICS
|
|
199
|
-
// USE_SERVER_COMPONENTS
|
|
197
|
+
) /* Prime Client Logics should never leak to the server. */,
|
|
198
|
+
// USE_AGNOSTIC_LOGICS allowed, because Prime Agnostic Logics can run safely on the server just like they can on the client.
|
|
199
|
+
// USE_SERVER_COMPONENTS allowed, because Lineal Server Components are OK to be composed with Prime Server Logics as long as the Prime Server Logics Module, by convention, does not export React components.
|
|
200
200
|
makeBlockedImport(
|
|
201
201
|
USE_SERVER_LOGICS,
|
|
202
202
|
USE_CLIENT_COMPONENTS
|
|
203
|
-
) /*
|
|
204
|
-
// USE_AGNOSTIC_COMPONENTS
|
|
205
|
-
// USE_SERVER_FUNCTIONS
|
|
203
|
+
) /* Lineal Client Components, like any Client Components, cannot be tinkered with on the server. */,
|
|
204
|
+
// USE_AGNOSTIC_COMPONENTS allowed, because Lineal Agnostic Components can be composed with any Prime Environment Logics agnostically, as long as the Prime Environment Logics Module, by convention, does not export React components.
|
|
205
|
+
// USE_SERVER_FUNCTIONS allowed, because (Special) Server Functions, being able to import one another, can compose and do so via Prime Server Logics, despite this method seeming superfluous at first glance. (Perhaps a preferrable use case for this has been found or could be found either today or in the future.)
|
|
206
206
|
makeBlockedImport(
|
|
207
207
|
USE_SERVER_LOGICS,
|
|
208
208
|
USE_CLIENT_CONTEXTS
|
|
209
|
-
) /*
|
|
210
|
-
// USE_AGNOSTIC_CONDITIONS
|
|
209
|
+
) /* (Special) Client Contexts Components, like any Client Components, cannot be tinkered with on the server. */,
|
|
210
|
+
// USE_AGNOSTIC_CONDITIONS allowed, because (Special) Agnostic Conditions Components are able to safely render on the server, guaranteeing that only their `ComponentForServer` will be effectively involved in Prime Server Logics Modules.
|
|
211
211
|
]),
|
|
212
212
|
[USE_CLIENT_LOGICS]: Object.freeze([
|
|
213
213
|
makeBlockedImport(
|
|
214
214
|
USE_CLIENT_LOGICS,
|
|
215
215
|
USE_SERVER_LOGICS
|
|
216
|
-
) /*
|
|
217
|
-
// USE_CLIENT_LOGICS
|
|
218
|
-
// USE_AGNOSTIC_LOGICS
|
|
216
|
+
) /* Prime Server Logics should never leak to the client. */,
|
|
217
|
+
// USE_CLIENT_LOGICS allowed, because Prime Client Logics can compose with one another.
|
|
218
|
+
// USE_AGNOSTIC_LOGICS allowed, because Prime Agnostic Logics can run safely on the client just like they can on the server.
|
|
219
219
|
makeBlockedImport(
|
|
220
220
|
USE_CLIENT_LOGICS,
|
|
221
221
|
USE_SERVER_COMPONENTS
|
|
222
|
-
) /*
|
|
223
|
-
// USE_CLIENT_COMPONENTS
|
|
224
|
-
// USE_AGNOSTIC_COMPONENTS
|
|
225
|
-
// USE_SERVER_FUNCTIONS
|
|
226
|
-
// USE_CLIENT_CONTEXTS
|
|
227
|
-
// USE_AGNOSTIC_CONDITIONS
|
|
222
|
+
) /* Lineal Server Components cannot be tinkered with on the client. */,
|
|
223
|
+
// USE_CLIENT_COMPONENTS allowed, because Prime Client Logics, like any Client Components, are OK to be composed with Prime Client Logics as long as the Prime Client Logics Module, by convention, does not export React components.
|
|
224
|
+
// USE_AGNOSTIC_COMPONENTS allowed, because Lineal Agnostic Components can be composed with any Prime Environment Logics agnostically, as long as the Prime Environment Logics Module, by convention, does not export React components.
|
|
225
|
+
// USE_SERVER_FUNCTIONS allowed, because (Special) Server Functions can technically be attached to any Client Components that are being tinkered with within Client Logics Modules.
|
|
226
|
+
// USE_CLIENT_CONTEXTS allowed, because (Special) Client Contexts Components, like any Client Components, are OK to be composed with Prime Client Logics as long as the Prime Client Logics Module, by convention, does not export React components.
|
|
227
|
+
// USE_AGNOSTIC_CONDITIONS allowed, because (Special) Agnostic Conditions Components are able to safely render on the client, guaranteeing that only their `ComponentForClient` will be effectively involved in Prime Client Logics Modules.
|
|
228
228
|
]),
|
|
229
229
|
[USE_AGNOSTIC_LOGICS]: Object.freeze([
|
|
230
230
|
makeBlockedImport(
|
|
231
231
|
USE_AGNOSTIC_LOGICS,
|
|
232
232
|
USE_SERVER_LOGICS
|
|
233
|
-
) /*
|
|
233
|
+
) /* Prime Server Logics cannot run on both the server and the client. */,
|
|
234
234
|
makeBlockedImport(
|
|
235
235
|
USE_AGNOSTIC_LOGICS,
|
|
236
236
|
USE_CLIENT_LOGICS
|
|
237
|
-
) /*
|
|
238
|
-
// USE_AGNOSTIC_LOGICS
|
|
237
|
+
) /* Prime Client Logics cannot run on both the server and the client. */,
|
|
238
|
+
// USE_AGNOSTIC_LOGICS allowed, because Prime Agnostic Logics can compose with one another.
|
|
239
239
|
makeBlockedImport(
|
|
240
240
|
USE_AGNOSTIC_LOGICS,
|
|
241
241
|
USE_SERVER_COMPONENTS
|
|
242
|
-
) /*
|
|
242
|
+
) /* Lineal Server Components cannot be tinkered with on both the server and the client. */,
|
|
243
243
|
makeBlockedImport(
|
|
244
244
|
USE_AGNOSTIC_LOGICS,
|
|
245
245
|
USE_CLIENT_COMPONENTS
|
|
246
|
-
) /*
|
|
247
|
-
// USE_AGNOSTIC_COMPONENTS
|
|
246
|
+
) /* Lineal Client Components, like any Client Components, cannot be tinkered with on both the server and the client. */,
|
|
247
|
+
// USE_AGNOSTIC_COMPONENTS allowed, because Lineal Agnostic Components can be composed with any Prime Environment Logics agnostically, as long as the Prime Environment Logics Module, by convention, does not export React components.
|
|
248
248
|
makeBlockedImport(
|
|
249
249
|
USE_AGNOSTIC_LOGICS,
|
|
250
250
|
USE_SERVER_FUNCTIONS
|
|
251
|
-
) /*
|
|
251
|
+
) /* (Special) Server Functions can be modified on the server and on the client, but their use cases on both environments are not one-to-one compatible, since they're being addressed as they are on the server and addressed as references on the client. */,
|
|
252
252
|
makeBlockedImport(
|
|
253
253
|
USE_AGNOSTIC_LOGICS,
|
|
254
254
|
USE_CLIENT_CONTEXTS
|
|
255
|
-
) /*
|
|
256
|
-
// USE_AGNOSTIC_CONDITIONS
|
|
255
|
+
) /* (Special) Client Contexts Components, like any Client Components, cannot be tinkered with on both the server and the client. */,
|
|
256
|
+
// USE_AGNOSTIC_CONDITIONS allowed, because (Special) Agnostic Conditions Components, as if they were Lineal Agnostic Components themselves, can be composed with any Prime Environment Logics agnostically, as long as the Prime Environment Logics Module, by convention, does not export React components.
|
|
257
257
|
]),
|
|
258
258
|
[USE_SERVER_COMPONENTS]: Object.freeze([
|
|
259
|
-
// USE_SERVER_LOGICS
|
|
259
|
+
// USE_SERVER_LOGICS allowed, because Prime Server Logics, being logic from the server, can safely support Lineal Server Components.
|
|
260
260
|
makeBlockedImport(
|
|
261
261
|
USE_SERVER_COMPONENTS,
|
|
262
262
|
USE_CLIENT_LOGICS
|
|
263
|
-
) /*
|
|
264
|
-
// USE_AGNOSTIC_LOGICS
|
|
265
|
-
// USE_SERVER_COMPONENTS
|
|
266
|
-
// USE_CLIENT_COMPONENTS
|
|
267
|
-
// USE_AGNOSTIC_COMPONENTS
|
|
268
|
-
// USE_SERVER_FUNCTIONS
|
|
269
|
-
// USE_CLIENT_CONTEXTS
|
|
270
|
-
// USE_AGNOSTIC_CONDITIONS
|
|
263
|
+
) /* Prime Client Logics should never leak to the server. */,
|
|
264
|
+
// USE_AGNOSTIC_LOGICS allowed, because Prime Agnostic Logics can run safely on the server just like they can on the client.
|
|
265
|
+
// USE_SERVER_COMPONENTS allowed, because Lineal Server Components can compose with one another, now that thanks to the inclusion of Agnostic Components they are actual Server Components.
|
|
266
|
+
// USE_CLIENT_COMPONENTS allowed, because Lineal Client Components can be nested inside Lineal Server Components to create client boundaries when the root of the application is planted on the server.
|
|
267
|
+
// USE_AGNOSTIC_COMPONENTS allowed, because Lineal Agnostic Components can render safely on the server just like they can on the client.
|
|
268
|
+
// USE_SERVER_FUNCTIONS allowed, because (Special) Server Functions can be passed to imported Client Components within Lineal Server Components Modules, even though indeed Lineal Server Components Modules and Lineal Server Components can make their own Server Functions through inline `'use server'` directives.
|
|
269
|
+
// USE_CLIENT_CONTEXTS allowed, because (Special) Client Contexts Components can be nested inside Lineal Server Components to wrap some of the tree with client state accessible through child Client Components, and to pass through Server Components when the root of the application is planted on the server.
|
|
270
|
+
// USE_AGNOSTIC_CONDITIONS allowed, because (Special) Agnostic Conditions Components, as if they were Lineal Agnostic Components themselves, can render safely on the server just like they can on the client.
|
|
271
271
|
]),
|
|
272
272
|
[USE_CLIENT_COMPONENTS]: Object.freeze([
|
|
273
273
|
makeBlockedImport(
|
|
274
274
|
USE_CLIENT_COMPONENTS,
|
|
275
275
|
USE_SERVER_LOGICS
|
|
276
|
-
) /*
|
|
277
|
-
// USE_CLIENT_LOGICS
|
|
278
|
-
// USE_AGNOSTIC_LOGICS
|
|
276
|
+
) /* Prime Server Logics should never leak to the client. */,
|
|
277
|
+
// USE_CLIENT_LOGICS allowed, because Prime Client Logics, being logic from the client, can safely support Lineal Client Components, like any Client Components.
|
|
278
|
+
// USE_AGNOSTIC_LOGICS allowed, because Prime Agnostic Logics can run safely on the client just like they can on the server.
|
|
279
279
|
makeBlockedImport(
|
|
280
280
|
USE_CLIENT_COMPONENTS,
|
|
281
281
|
USE_SERVER_COMPONENTS
|
|
282
|
-
) /*
|
|
283
|
-
// USE_CLIENT_COMPONENTS
|
|
284
|
-
// USE_AGNOSTIC_COMPONENTS
|
|
285
|
-
// USE_SERVER_FUNCTIONS
|
|
286
|
-
// USE_CLIENT_CONTEXTS
|
|
287
|
-
// USE_AGNOSTIC_CONDITIONS
|
|
282
|
+
) /* Lineal Server Components cannot be the children of Lineal Client Components. */,
|
|
283
|
+
// USE_CLIENT_COMPONENTS allowed, because Lineal Client Components can compose with one another.
|
|
284
|
+
// USE_AGNOSTIC_COMPONENTS allowed, because Lineal Agnostic Components can render safely on the client just like they can on the server.
|
|
285
|
+
// USE_SERVER_FUNCTIONS allowed, because (Special) Server Functions can be specifically triggered by Client Components.
|
|
286
|
+
// USE_CLIENT_CONTEXTS allowed, because (Special) Client Contexts Components can effectively become Lineal and only render their children on the client via this mechanism since, by a Client Contexts Component being the child of a Lineal Client Component, the Client Contexts Component's children become the grandchildren of an ancestor Lineal Client Component, enforcing them to render exclusively on the client.
|
|
287
|
+
// USE_AGNOSTIC_CONDITIONS allowed, because (Special) Agnostic Conditions Components, as if they were Lineal Agnostic Components themselves, can render safely on the client just like they can on the server.
|
|
288
288
|
]),
|
|
289
289
|
[USE_AGNOSTIC_COMPONENTS]: Object.freeze([
|
|
290
290
|
makeBlockedImport(
|
|
291
291
|
USE_AGNOSTIC_COMPONENTS,
|
|
292
292
|
USE_SERVER_LOGICS
|
|
293
|
-
) /*
|
|
293
|
+
) /* Prime Server Logics cannot run on both the server and the client. */,
|
|
294
294
|
makeBlockedImport(
|
|
295
295
|
USE_AGNOSTIC_COMPONENTS,
|
|
296
296
|
USE_CLIENT_LOGICS
|
|
297
|
-
) /*
|
|
298
|
-
// USE_AGNOSTIC_LOGICS
|
|
297
|
+
) /* Prime Client Logics cannot run on both the server and the client. */,
|
|
298
|
+
// USE_AGNOSTIC_LOGICS allowed, because Prime Agnostic Logics, being environment-agnostic logic, can safely support any Agnostic Components.
|
|
299
299
|
makeBlockedImport(
|
|
300
300
|
USE_AGNOSTIC_COMPONENTS,
|
|
301
301
|
USE_SERVER_COMPONENTS
|
|
302
|
-
) /*
|
|
303
|
-
// USE_CLIENT_COMPONENTS
|
|
304
|
-
// USE_AGNOSTIC_COMPONENTS
|
|
305
|
-
// USE_SERVER_FUNCTIONS
|
|
306
|
-
// USE_CLIENT_CONTEXTS
|
|
307
|
-
// USE_AGNOSTIC_CONDITIONS
|
|
302
|
+
) /* Lineal Server Components, unlike Lineal Client Components, cannot make silos of their own once on the opposing environment (the client in this case), and therefore cannot be executed from the client, making them unable to execute agnostically from both the server and the client. */,
|
|
303
|
+
// USE_CLIENT_COMPONENTS allowed, because Lineal Client Components can be nested inside Lineal Agnostic Components to create client boundaries when the root of the application is planted on the server.
|
|
304
|
+
// USE_AGNOSTIC_COMPONENTS allowed, because Lineal Agnostic Components can compose with one another.
|
|
305
|
+
// USE_SERVER_FUNCTIONS allowed, because (Special) Server Functions can be passed to Client Components as props when Client Components are also legally imported into Agnostic Components Modules.
|
|
306
|
+
// USE_CLIENT_CONTEXTS allowed, because (Special) Client Contexts Components can be nested inside Lineal Agnostic Components to wrap some of the tree with client state accessible through child Client Components, and to pass through Server Components — if still on the Server Tree — when the root of the application is planted on the server.
|
|
307
|
+
// USE_AGNOSTIC_CONDITIONS allowed, because (Special) Agnostic Conditions Components can compose with Lineal Agnostic Components as if they were Lineal Agnostic Components themselves, making them a necessary mechanism for Lineal Server Components to be nested in any Agnostic Components.
|
|
308
308
|
]),
|
|
309
309
|
[USE_SERVER_FUNCTIONS]: Object.freeze([
|
|
310
|
-
// USE_SERVER_LOGICS
|
|
310
|
+
// USE_SERVER_LOGICS allowed, because Prime Server Logics, being logic from the server, can safely support (Special) Server Functions.
|
|
311
311
|
makeBlockedImport(
|
|
312
312
|
USE_SERVER_FUNCTIONS,
|
|
313
313
|
USE_CLIENT_LOGICS
|
|
314
|
-
) /*
|
|
315
|
-
// USE_AGNOSTIC_LOGICS
|
|
314
|
+
) /* Prime Client Logics should never leak to the server. */,
|
|
315
|
+
// USE_AGNOSTIC_LOGICS allowed, because Prime Agnostic Logics can run safely on the server just like they can on the client.
|
|
316
316
|
makeBlockedImport(
|
|
317
317
|
USE_SERVER_FUNCTIONS,
|
|
318
318
|
USE_SERVER_COMPONENTS
|
|
319
|
-
) /*
|
|
319
|
+
) /* Lineal Server Components aren't allowed because (Special) Server Functions have no business working with React Components. */,
|
|
320
320
|
makeBlockedImport(
|
|
321
321
|
USE_SERVER_FUNCTIONS,
|
|
322
322
|
USE_CLIENT_COMPONENTS
|
|
323
|
-
) /*
|
|
323
|
+
) /* Lineal Client Components aren't allowed because (Special) Server Functions have no business working with React Components. */,
|
|
324
324
|
makeBlockedImport(
|
|
325
325
|
USE_SERVER_FUNCTIONS,
|
|
326
326
|
USE_AGNOSTIC_COMPONENTS
|
|
327
|
-
) /*
|
|
328
|
-
// USE_SERVER_FUNCTIONS
|
|
327
|
+
) /* Lineal Agnostic Components aren't allowed because (Special) Server Functions have no business working with React Components. */,
|
|
328
|
+
// USE_SERVER_FUNCTIONS allowed, because (Special) Server Functions, even though they don't need to import one another and the same results can be generated via Prime Server Logics for the outcome of a single Server Function, can still compose with one another. (Perhaps a preferrable use case for this has been found or could be found either today or in the future.)
|
|
329
329
|
makeBlockedImport(
|
|
330
330
|
USE_SERVER_FUNCTIONS,
|
|
331
331
|
USE_CLIENT_CONTEXTS
|
|
332
|
-
) /*
|
|
332
|
+
) /* (Special) Client Contexts Components aren't allowed because (Special) Server Functions have no business working with React Components. */,
|
|
333
333
|
makeBlockedImport(
|
|
334
334
|
USE_SERVER_FUNCTIONS,
|
|
335
335
|
USE_AGNOSTIC_CONDITIONS
|
|
336
|
-
) /*
|
|
336
|
+
) /* (Special) Agnostic Conditions Components aren't allowed because (Special) Server Functions have no business working with React Components. */,
|
|
337
337
|
]),
|
|
338
338
|
[USE_CLIENT_CONTEXTS]: Object.freeze([
|
|
339
339
|
makeBlockedImport(
|
|
340
340
|
USE_CLIENT_CONTEXTS,
|
|
341
341
|
USE_SERVER_LOGICS
|
|
342
|
-
) /*
|
|
343
|
-
// USE_CLIENT_LOGICS
|
|
344
|
-
// USE_AGNOSTIC_LOGICS
|
|
342
|
+
) /* Prime Server Logics should never leak to the client. */,
|
|
343
|
+
// USE_CLIENT_LOGICS allowed, because Prime Client Logics, being logic from the client, can safely support (Special) Client Contexts Components, like any Client Components.
|
|
344
|
+
// USE_AGNOSTIC_LOGICS allowed, because Prime Agnostic Logics can run safely on the client just like they can on the server.
|
|
345
345
|
makeBlockedImport(
|
|
346
346
|
USE_CLIENT_CONTEXTS,
|
|
347
347
|
USE_SERVER_COMPONENTS
|
|
348
|
-
) /*
|
|
349
|
-
// USE_CLIENT_COMPONENTS
|
|
350
|
-
// USE_AGNOSTIC_COMPONENTS
|
|
351
|
-
// USE_SERVER_FUNCTIONS
|
|
352
|
-
// USE_CLIENT_CONTEXTS
|
|
353
|
-
// USE_AGNOSTIC_CONDITIONS
|
|
348
|
+
) /* Lineal Server Components may only pass through (Special) Client Contexts Components via the children prop within Server Components Modules. */,
|
|
349
|
+
// USE_CLIENT_COMPONENTS allowed, because Lineal Client Components can create client boundaries within (Special) Client Contexts Components.
|
|
350
|
+
// USE_AGNOSTIC_COMPONENTS allowed, because Lineal Agnostic Components can render safely on the client just like they can on the server.
|
|
351
|
+
// USE_SERVER_FUNCTIONS allowed, because (Special) Server Functions can be specifically triggered by Client Components.
|
|
352
|
+
// USE_CLIENT_CONTEXTS allowed, because (Special) Client Contexts Components can compose with one another.
|
|
353
|
+
// USE_AGNOSTIC_CONDITIONS allowed, because (Special) Agnostic Conditions Components, as if they were Lineal Agnostic Components themselves, can render safely on the client just like they can on the server, in a mechanism that allows Client Contexts Components to safely and indirectly compose with child Server Components within Client Contexts Modules.
|
|
354
354
|
]),
|
|
355
355
|
[USE_AGNOSTIC_CONDITIONS]: Object.freeze([
|
|
356
356
|
makeBlockedImport(
|
|
357
357
|
USE_AGNOSTIC_CONDITIONS,
|
|
358
358
|
USE_SERVER_LOGICS
|
|
359
|
-
) /*
|
|
359
|
+
) /* Prime Server Logics cannot run on both the server and the client. */,
|
|
360
360
|
makeBlockedImport(
|
|
361
361
|
USE_AGNOSTIC_CONDITIONS,
|
|
362
362
|
USE_CLIENT_LOGICS
|
|
363
|
-
) /*
|
|
364
|
-
// USE_AGNOSTIC_LOGICS
|
|
365
|
-
// USE_SERVER_COMPONENTS
|
|
366
|
-
// USE_CLIENT_COMPONENTS
|
|
367
|
-
// USE_AGNOSTIC_COMPONENTS
|
|
363
|
+
) /* Prime Client Logics cannot run on both the server and the client. */,
|
|
364
|
+
// USE_AGNOSTIC_LOGICS allowed, because Prime Agnostic Logics, being environment-agnostic logic, can safely support any Agnostic Components, including (Special) Agnostic Conditions Components. (In this case this is necessary for the import of the `conditionAgnosticComponent` function needed to make Agnostic Conditions Components.)
|
|
365
|
+
// USE_SERVER_COMPONENTS allowed, because Lineal Server Components are to be paired as `ComponentForServer` components with `ComponentForClient` components to form (Special) Agnostic Conditions Components.
|
|
366
|
+
// USE_CLIENT_COMPONENTS allowed, because Lineal Client Components are to be paired as `ComponentForClient` components with `ComponentForServer` components to form (Special) Agnostic Conditions Components.
|
|
367
|
+
// USE_AGNOSTIC_COMPONENTS allowed, because Lineal Agnostic Components can take the place of `ComponentForServer` and/or `ComponentForClient` components to form (Special) Agnostic Conditions Components.
|
|
368
368
|
makeBlockedImport(
|
|
369
369
|
USE_AGNOSTIC_CONDITIONS,
|
|
370
370
|
USE_SERVER_FUNCTIONS
|
|
371
|
-
) /*
|
|
371
|
+
) /* (Special) Server Functions are not accepted because (Special) Agnostic Conditions Components only take finite, imported components as arguments in their making. As such, assigning props to these components, including Server Functions, is not made within Agnostic Conditions Modules. */,
|
|
372
372
|
makeBlockedImport(
|
|
373
373
|
USE_AGNOSTIC_CONDITIONS,
|
|
374
374
|
USE_CLIENT_CONTEXTS
|
|
375
|
-
) /*
|
|
376
|
-
// USE_AGNOSTIC_CONDITIONS
|
|
375
|
+
) /* (Special) Client Contexts Components cannot be used as component arguments for (Special) Agnostic Conditions Components since they only take Lineal Components as arguments in their making. */,
|
|
376
|
+
// USE_AGNOSTIC_CONDITIONS allowed, because (Special) Agnostic Conditions Components, despite not being Lineal Components themselves, output components that can only be Lineal and compatible with their attributed rendering environments, making them acceptable arguments in the making of Agnostic Conditions Components.
|
|
377
377
|
]),
|
|
378
378
|
});
|
|
379
379
|
|
|
@@ -11,9 +11,9 @@
|
|
|
11
11
|
import { walkAST } from "../../../_commons/utilities/walk-ast.js";
|
|
12
12
|
|
|
13
13
|
/**
|
|
14
|
-
* Analyzes a source code exports to detect re-exports.
|
|
15
|
-
* @param {SourceCode} sourceCode
|
|
16
|
-
* @returns
|
|
14
|
+
* Analyzes a source code's exports to detect re-exports.
|
|
15
|
+
* @param {SourceCode} sourceCode The `SourceCode` to analyze.
|
|
16
|
+
* @returns An object with the `reExportsWithSource` key tracking the direct re-exports from an imported source in an array and the `reExportsViaLocal` key tracking the indirect re-exports from an imported source in an array.
|
|
17
17
|
*/
|
|
18
18
|
export const analyzeExportsForReExports = (sourceCode) => {
|
|
19
19
|
/** @type {Map<string, {source: string, importNode: ImportDeclaration}>} */
|
|
@@ -38,7 +38,6 @@ export const analyzeExportsForReExports = (sourceCode) => {
|
|
|
38
38
|
}
|
|
39
39
|
}
|
|
40
40
|
|
|
41
|
-
// works
|
|
42
41
|
if (
|
|
43
42
|
node.type === "ExportAllDeclaration" &&
|
|
44
43
|
node.exportKind === "value" &&
|
|
@@ -47,7 +46,6 @@ export const analyzeExportsForReExports = (sourceCode) => {
|
|
|
47
46
|
reExportsWithSource.push({ node, source: node.source.value });
|
|
48
47
|
}
|
|
49
48
|
|
|
50
|
-
// works
|
|
51
49
|
if (
|
|
52
50
|
node.type === "ExportNamedDeclaration" &&
|
|
53
51
|
node.exportKind === "value" &&
|
|
@@ -56,7 +54,6 @@ export const analyzeExportsForReExports = (sourceCode) => {
|
|
|
56
54
|
reExportsWithSource.push({ node, source: node.source.value });
|
|
57
55
|
}
|
|
58
56
|
|
|
59
|
-
// works
|
|
60
57
|
if (
|
|
61
58
|
node.type === "ExportNamedDeclaration" &&
|
|
62
59
|
node.exportKind === "value" &&
|
|
@@ -77,7 +74,6 @@ export const analyzeExportsForReExports = (sourceCode) => {
|
|
|
77
74
|
}
|
|
78
75
|
}
|
|
79
76
|
|
|
80
|
-
// works
|
|
81
77
|
if (
|
|
82
78
|
node.type === "ExportDefaultDeclaration" &&
|
|
83
79
|
node.exportKind === "value" &&
|
|
@@ -58,9 +58,9 @@ import { analyzeExportsForReExports } from "./analyze-exports-re.js";
|
|
|
58
58
|
/* currentFileFlow */
|
|
59
59
|
|
|
60
60
|
/**
|
|
61
|
-
*
|
|
62
|
-
* @param {Context} context
|
|
63
|
-
* @returns
|
|
61
|
+
* The flow that begins the import rules enforcement rule, retrieving the verified commented directive of the current file before comparing it to upcoming verified commented directives of the files it imports.
|
|
62
|
+
* @param {Context} context The ESLint rule's `context` object.
|
|
63
|
+
* @returns Either an object with `skip: true` to disregard or one with the non-null `verifiedCommentedDirective`.
|
|
64
64
|
*/
|
|
65
65
|
export const currentFileFlow = (context) => {
|
|
66
66
|
const skipTrue = { ...skip, verifiedCommentedDirective: undefined };
|
|
@@ -127,12 +127,12 @@ export const currentFileFlow = (context) => {
|
|
|
127
127
|
console.warn(
|
|
128
128
|
`Somehow, expectedReactDirectiveAsText for ${expectedReactDirective} is undefined.`
|
|
129
129
|
);
|
|
130
|
-
return { skip: undefined, verifiedCommentedDirective }; // at this time,
|
|
130
|
+
return { skip: undefined, verifiedCommentedDirective }; // at this time, behaves as if the new implementation didn't exist yet
|
|
131
131
|
}
|
|
132
132
|
|
|
133
133
|
context.report({
|
|
134
134
|
loc: highlightFirstLineOfCode(context),
|
|
135
|
-
messageId: commentedDirectiveReactDirectiveFailedMessageId,
|
|
135
|
+
messageId: commentedDirectiveReactDirectiveFailedMessageId,
|
|
136
136
|
data: {
|
|
137
137
|
// verifiedCommentedDirective
|
|
138
138
|
verifiedCommentedDirective,
|
|
@@ -149,10 +149,10 @@ export const currentFileFlow = (context) => {
|
|
|
149
149
|
/* importedFileFlow */
|
|
150
150
|
|
|
151
151
|
/**
|
|
152
|
-
*
|
|
153
|
-
* @param {Context} context
|
|
154
|
-
* @param {ImportDeclaration} node
|
|
155
|
-
* @returns
|
|
152
|
+
* The flow that is shared between import and re-export traversals to obtain the import file's commented directive.
|
|
153
|
+
* @param {Context} context The ESLint rule's `context` object.
|
|
154
|
+
* @param {ImportDeclaration} node The ESLint `node` of the rule's current traversal.
|
|
155
|
+
* @returns Either an object with `skip: true` to disregard or one with the non-null `importedFileCommentedDirective`. And now with the added results of `analyzeExportsForReExports`.
|
|
156
156
|
*/
|
|
157
157
|
const importedFileFlow = (context, node) => {
|
|
158
158
|
const skipTrue = {
|
|
@@ -189,7 +189,7 @@ const importedFileFlow = (context, node) => {
|
|
|
189
189
|
// Now silencing the warning as superfluous, in order to not warn on imports of files without a commented directive that are outside of linting range.
|
|
190
190
|
|
|
191
191
|
// console.warn(
|
|
192
|
-
// `WARNING. The imported file ${resolvedImportPath}, whose path has been resolved from ${context.filename}, has no commented
|
|
192
|
+
// `WARNING. The imported file ${resolvedImportPath}, whose path has been resolved from ${context.filename}, has no commented directive. It is thus ignored since the report on that circumstance would be available on the imported file itself.`
|
|
193
193
|
// ); // The decision not to report has been taken to not inflate the number of warnings.
|
|
194
194
|
return skipTrue;
|
|
195
195
|
}
|
|
@@ -246,11 +246,11 @@ const importedFileFlow = (context, node) => {
|
|
|
246
246
|
/* importsFlow */
|
|
247
247
|
|
|
248
248
|
/**
|
|
249
|
-
*
|
|
250
|
-
* @param {Context} context
|
|
251
|
-
* @param {ImportDeclaration} node
|
|
252
|
-
* @param {CommentedDirective} currentFileCommentedDirective
|
|
253
|
-
* @returns
|
|
249
|
+
* The full flow for import traversals to enforce effective directives import rules.
|
|
250
|
+
* @param {Context} context The ESLint rule's `context` object.
|
|
251
|
+
* @param {ImportDeclaration} node The ESLint `node` of the rule's current traversal.
|
|
252
|
+
* @param {CommentedDirective} currentFileCommentedDirective The current file's commented directive.
|
|
253
|
+
* @returns Early if the flow needs to be interrupted.
|
|
254
254
|
*/
|
|
255
255
|
export const importsFlow = (context, node, currentFileCommentedDirective) => {
|
|
256
256
|
// does not operate on `import type`
|
|
@@ -286,21 +286,10 @@ export const importsFlow = (context, node, currentFileCommentedDirective) => {
|
|
|
286
286
|
});
|
|
287
287
|
}
|
|
288
288
|
|
|
289
|
-
//
|
|
289
|
+
// NEW
|
|
290
290
|
if (result.analyzeExportsForReExportsResults) {
|
|
291
291
|
const { reExportsWithSource, reExportsViaLocal } =
|
|
292
292
|
result.analyzeExportsForReExportsResults;
|
|
293
|
-
// console.debug("reExportsWithSource are:", reExportsWithSource);
|
|
294
|
-
// console.debug("reExportsViaLocal are:", reExportsViaLocal);
|
|
295
|
-
// console.debug(
|
|
296
|
-
// "currentFileCommentedDirective is:",
|
|
297
|
-
// currentFileCommentedDirective
|
|
298
|
-
// );
|
|
299
|
-
// console.debug(
|
|
300
|
-
// "importedFileCommentedDirective is:",
|
|
301
|
-
// importedFileCommentedDirective
|
|
302
|
-
// );
|
|
303
|
-
// console.debug(context.sourceCode.getText(node));
|
|
304
293
|
|
|
305
294
|
// immediately returns if no re-exports are found
|
|
306
295
|
if (reExportsWithSource.length === 0 && reExportsViaLocal.length === 0)
|
|
@@ -311,16 +300,12 @@ export const importsFlow = (context, node, currentFileCommentedDirective) => {
|
|
|
311
300
|
/** @type {Environment} */
|
|
312
301
|
const importedFileEnvironment =
|
|
313
302
|
importedFileCommentedDirective.split(" ")[1];
|
|
314
|
-
// console.debug("currentFileEnvironment is:", currentFileEnvironment);
|
|
315
|
-
// console.debug("importedFileEnvironment is:", importedFileEnvironment);
|
|
316
303
|
|
|
317
304
|
if (
|
|
318
305
|
!environments_allowedChainImportEnvironments[
|
|
319
306
|
currentFileEnvironment
|
|
320
307
|
].includes(importedFileEnvironment)
|
|
321
308
|
) {
|
|
322
|
-
// console.debug(cantChainImportAcrossEnvironmentsMessageId);
|
|
323
|
-
|
|
324
309
|
context.report({
|
|
325
310
|
node,
|
|
326
311
|
messageId: cantChainImportAcrossEnvironmentsMessageId,
|
|
@@ -338,11 +323,11 @@ export const importsFlow = (context, node, currentFileCommentedDirective) => {
|
|
|
338
323
|
/* allExportsFlow */
|
|
339
324
|
|
|
340
325
|
/**
|
|
341
|
-
*
|
|
342
|
-
* @param {Context} context
|
|
343
|
-
* @param {ExportNamedDeclaration | ExportAllDeclaration | ExportDefaultDeclaration} node
|
|
344
|
-
* @param {CommentedDirective} currentFileCommentedDirective
|
|
345
|
-
* @returns
|
|
326
|
+
* The full flow for export traversals, shared between `ExportNamedDeclaration`, `ExportAllDeclaration`, and `ExportDefaultDeclaration`, to ensure same commented directive re-exports in modules that aren't Agnostic Strategies Modules, and enforce strategized exports specifically in Agnostic Strategies modules.
|
|
327
|
+
* @param {Context} context The ESLint rule's `context` object.
|
|
328
|
+
* @param {ExportNamedDeclaration | ExportAllDeclaration | ExportDefaultDeclaration} node The ESLint `node` of the rule's current traversal.
|
|
329
|
+
* @param {CommentedDirective} currentFileCommentedDirective The current file's commented directive.
|
|
330
|
+
* @returns Early if the flow needs to be interrupted.
|
|
346
331
|
*/
|
|
347
332
|
export const allExportsFlow = (
|
|
348
333
|
context,
|
|
@@ -394,21 +379,10 @@ export const allExportsFlow = (
|
|
|
394
379
|
});
|
|
395
380
|
}
|
|
396
381
|
|
|
397
|
-
//
|
|
382
|
+
// NEW
|
|
398
383
|
if (result.analyzeExportsForReExportsResults) {
|
|
399
384
|
const { reExportsWithSource, reExportsViaLocal } =
|
|
400
385
|
result.analyzeExportsForReExportsResults;
|
|
401
|
-
// console.debug("reExportsWithSource are:", reExportsWithSource);
|
|
402
|
-
// console.debug("reExportsViaLocal are:", reExportsViaLocal);
|
|
403
|
-
// console.debug(
|
|
404
|
-
// "currentFileCommentedDirective is:",
|
|
405
|
-
// currentFileCommentedDirective
|
|
406
|
-
// );
|
|
407
|
-
// console.debug(
|
|
408
|
-
// "importedFileCommentedDirective is:",
|
|
409
|
-
// importedFileCommentedDirective
|
|
410
|
-
// );
|
|
411
|
-
// console.debug(context.sourceCode.getText(node));
|
|
412
386
|
|
|
413
387
|
// immediately returns if no re-exports are found
|
|
414
388
|
if (reExportsWithSource.length === 0 && reExportsViaLocal.length === 0)
|
|
@@ -421,16 +395,12 @@ export const allExportsFlow = (
|
|
|
421
395
|
/** @type {Environment} */
|
|
422
396
|
const importedFileEnvironment =
|
|
423
397
|
importedFileCommentedDirective.split(" ")[1];
|
|
424
|
-
// console.debug("currentFileEnvironment is:", currentFileEnvironment);
|
|
425
|
-
// console.debug("importedFileEnvironment is:", importedFileEnvironment);
|
|
426
398
|
|
|
427
399
|
if (
|
|
428
400
|
!environments_allowedChainImportEnvironments[
|
|
429
401
|
currentFileEnvironment
|
|
430
402
|
].includes(importedFileEnvironment)
|
|
431
403
|
) {
|
|
432
|
-
// console.debug(cantChainImportAcrossEnvironmentsMessageId);
|
|
433
|
-
|
|
434
404
|
context.report({
|
|
435
405
|
node,
|
|
436
406
|
messageId: cantChainImportAcrossEnvironmentsMessageId,
|