eslint-plugin-use-agnostic 1.2.2 → 1.3.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.
@@ -11,7 +11,7 @@ import {
11
11
 
12
12
  import { makeIntroForSpecificViolationMessage } from "../../../_commons/utilities/helpers.js";
13
13
 
14
- import jscommentsConfig from "../../../../comments.config.js";
14
+ import { resolvedConfigData } from "../../../../jscomments/_commons/constants/bases.js";
15
15
 
16
16
  /**
17
17
  * @typedef {import('../../../../types/agnostic20/_commons/typedefs.js').Directive} Directive
@@ -89,12 +89,12 @@ const SUGGEST_USE_AGNOSTIC =
89
89
  "If the module you're trying to import does not possess any server-side code however, please mark it with this plugin's own and eponymous 'use agnostic' directive to signal its compatibility across all environments.";
90
90
 
91
91
  /**
92
- * Makes a blockedImport object for the identified blocked import at hand.
92
+ * $COMMENT#JSDOC#DEFINITIONS#AGNOSTIC20#MAKEBLOCKEDIMPORT
93
93
  * @template {EffectiveDirective} T
94
94
  * @template {EffectiveDirective} U
95
- * @param {T} currentFileEffectiveDirective The current file's effective directive.
96
- * @param {U} importedFileEffectiveDirective The imported file's effective directive.
97
- * @returns The blockedImport object for the identified blocked import at hand.
95
+ * @param {T} currentFileEffectiveDirective $COMMENT#JSDOC#PARAMS#AGNOSTIC20#CURRENTFILEEFFECTIVEDIRECTIVE
96
+ * @param {U} importedFileEffectiveDirective $COMMENT#JSDOC#PARAMS#AGNOSTIC20#IMPORTEDFILEEFFECTIVEDIRECTIVE
97
+ * @returns $COMMENT#JSDOC#RETURNS#AGNOSTIC20#MAKEBLOCKEDIMPORT
98
98
  */
99
99
  export const makeBlockedImport = (
100
100
  currentFileEffectiveDirective,
@@ -106,7 +106,7 @@ export const makeBlockedImport = (
106
106
  currentFileEffectiveDirective,
107
107
  importedFileEffectiveDirective
108
108
  )} ${
109
- jscommentsConfig[agnostic20ConfigName][currentFileEffectiveDirective][
109
+ resolvedConfigData[agnostic20ConfigName][currentFileEffectiveDirective][
110
110
  importedFileEffectiveDirective
111
111
  ]
112
112
  }`,
@@ -114,12 +114,12 @@ export const makeBlockedImport = (
114
114
  };
115
115
 
116
116
  /**
117
- * Makes a blockedImport object for the identified blocked import at hand enhanced with the suggestion to use the `'use agnostic'` directive.
117
+ * $COMMENT#JSDOC#DEFINITIONS#AGNOSTIC20#MAKEBLOCKEDIMPORTSUGGESTINGUSEAGNOSTIC
118
118
  * @template {EffectiveDirective} T
119
119
  * @template {EffectiveDirective} U
120
- * @param {T} currentFileEffectiveDirective The current file's effective directive.
121
- * @param {U} importedFileEffectiveDirective The imported file's effective directive.
122
- * @returns The enhanced blockedImport object with the suggestion to use the `'use agnostic'` directive.
120
+ * @param {T} currentFileEffectiveDirective $COMMENT#JSDOC#PARAMS#AGNOSTIC20#CURRENTFILEEFFECTIVEDIRECTIVE
121
+ * @param {U} importedFileEffectiveDirective $COMMENT#JSDOC#PARAMS#AGNOSTIC20#IMPORTEDFILEEFFECTIVEDIRECTIVE
122
+ * @returns $COMMENT#JSDOC#RETURNS#AGNOSTIC20#MAKEBLOCKEDIMPORTSUGGESTINGUSEAGNOSTIC
123
123
  */
124
124
  const makeBlockedImportSuggestingUseAgnostic = (
125
125
  currentFileEffectiveDirective,
@@ -138,125 +138,130 @@ const makeBlockedImportSuggestingUseAgnostic = (
138
138
  });
139
139
  };
140
140
 
141
+ // The final boss is going to be to building this from the config.
142
+ // Probably in the blocked import thing.
143
+ // But so that means I'm going to need using resolveConfig, or maybe I could give resolveConfig an option that allows it to return the actual config data with all values recursively resolved.
144
+ // That's what I would do, then I would just need to use the object of the config data instead of `jscommentsConfig[agnostic20ConfigName]` for makeBlockedImport.
145
+ // const jscommentsConfigData = makeResolvedConfig(configPath)
141
146
  export const effectiveDirectives_blockedImports = Object.freeze({
142
147
  [USE_SERVER_LOGICS]: Object.freeze([
143
- // USE_SERVER_LOGICS allowed, because Server Logics can compose with one another.
144
- // USE_SERVER_COMPONENTS allowed, because Server Components are OK to be composed with Server Logics as long as the Server Logics Module, by convention, does not export React components.
145
- // USE_SERVER_FUNCTIONS allowed, because Server Functions, being able to import one another, can compose and do so via 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.)
148
+ // USE_SERVER_LOGICS $COMMENT#AGNOSTIC20#FORCOMPOSEDVARIABLES#ALLOWEDBECAUSE $COMMENT#AGNOSTIC20#USE_SERVER_LOGICS#USE_SERVER_LOGICS
149
+ // USE_SERVER_COMPONENTS $COMMENT#AGNOSTIC20#FORCOMPOSEDVARIABLES#ALLOWEDBECAUSE $COMMENT#AGNOSTIC20#USE_SERVER_LOGICS#USE_SERVER_COMPONENTS
150
+ // USE_SERVER_FUNCTIONS $COMMENT#AGNOSTIC20#FORCOMPOSEDVARIABLES#ALLOWEDBECAUSE $COMMENT#AGNOSTIC20#USE_SERVER_LOGICS#USE_SERVER_FUNCTIONS
146
151
  makeBlockedImport(
147
152
  USE_SERVER_LOGICS,
148
153
  USE_CLIENT_LOGICS
149
- ) /* Client Logics should never leak to the server, such as would be the case here in a Server Logics Module. */,
154
+ ) /* $COMMENT#AGNOSTIC20#FORALIASVARIABLES#CLIENTNEVERSERVER */,
150
155
  makeBlockedImport(
151
156
  USE_SERVER_LOGICS,
152
157
  USE_CLIENT_COMPONENTS
153
- ) /* Client Components cannot be tinkered with on the server. */,
154
- // USE_AGNOSTIC_LOGICS allowed, because Agnostic Logics can run safely on the server just like they can on the client, such as is the case here in a Server Logics Module.
155
- // USE_AGNOSTIC_COMPONENTS allowed, because Agnostic Components can be composed with Logics on the server just like they can on the client, as long at the Server Logics Module, by convention, does not export React components.
158
+ ) /* $COMMENT#AGNOSTIC20#USE_SERVER_LOGICS#USE_CLIENT_COMPONENTS */,
159
+ // USE_AGNOSTIC_LOGICS $COMMENT#AGNOSTIC20#FORCOMPOSEDVARIABLES#ALLOWEDBECAUSE $COMMENT#AGNOSTIC20#FORALIASVARIABLES#AGNOSTICCANSERVERCLIENT
160
+ // USE_AGNOSTIC_COMPONENTS $COMMENT#AGNOSTIC20#FORCOMPOSEDVARIABLES#ALLOWEDBECAUSE $COMMENT#AGNOSTIC20#USE_SERVER_LOGICS#USE_AGNOSTIC_COMPONENTS
156
161
  ]),
157
162
  [USE_SERVER_COMPONENTS]: Object.freeze([
158
- // USE_SERVER_LOGICS allowed, because Server Logics, being logic from the server, can safely support Server Components.
159
- // USE_SERVER_COMPONENTS allowed, because Server Components can compose with one another, assuming thanks to the inclusion of the 'use agnostic' directive that they are actual Server Components.
160
- // USE_SERVER_FUNCTIONS allowed, because Server Functions can be passed to imported Client Components within Server Components Modules, even though indeed Server Components Modules and Server Components can make their own Server Functions through inline 'use server' directives.
163
+ // USE_SERVER_LOGICS $COMMENT#AGNOSTIC20#FORCOMPOSEDVARIABLES#ALLOWEDBECAUSE $COMMENT#AGNOSTIC20#USE_SERVER_COMPONENTS#USE_SERVER_LOGICS
164
+ // USE_SERVER_COMPONENTS $COMMENT#AGNOSTIC20#FORCOMPOSEDVARIABLES#ALLOWEDBECAUSE $COMMENT#AGNOSTIC20#USE_SERVER_COMPONENTS#USE_SERVER_COMPONENTS
165
+ // USE_SERVER_FUNCTIONS $COMMENT#AGNOSTIC20#FORCOMPOSEDVARIABLES#ALLOWEDBECAUSE $COMMENT#AGNOSTIC20#USE_SERVER_COMPONENTS#USE_SERVER_FUNCTIONS
161
166
  makeBlockedImport(
162
167
  USE_SERVER_COMPONENTS,
163
168
  USE_CLIENT_LOGICS
164
- ) /* Client Logics should never leak to the server, such as would be the case here in a Server Components Module. */,
165
- // USE_CLIENT_COMPONENTS allowed, because Client Components can be nested inside Server Components either to wrap some of the tree with client state accessible through child Client Components and pass through Server Components, or to create client boundaries when the root of the application is planted on the server.
166
- // USE_AGNOSTIC_LOGICS allowed, because Agnostic Logics can run safely on the server just like they can on the client, such as is the case here in a Server Components Module.
167
- // USE_AGNOSTIC_COMPONENTS allowed, because Agnostic Components can render safely on the server just like they can on the client.
169
+ ) /* $COMMENT#AGNOSTIC20#FORALIASVARIABLES#CLIENTNEVERSERVER */,
170
+ // USE_CLIENT_COMPONENTS $COMMENT#AGNOSTIC20#FORCOMPOSEDVARIABLES#ALLOWEDBECAUSE $COMMENT#AGNOSTIC20#USE_SERVER_COMPONENTS#USE_CLIENT_COMPONENTS
171
+ // USE_AGNOSTIC_LOGICS $COMMENT#AGNOSTIC20#FORCOMPOSEDVARIABLES#ALLOWEDBECAUSE $COMMENT#AGNOSTIC20#FORALIASVARIABLES#AGNOSTICCANSERVERCLIENT
172
+ // USE_AGNOSTIC_COMPONENTS $COMMENT#AGNOSTIC20#FORCOMPOSEDVARIABLES#ALLOWEDBECAUSE $COMMENT#AGNOSTIC20#USE_SERVER_COMPONENTS#USE_AGNOSTIC_COMPONENTS
168
173
  ]),
169
174
  [USE_SERVER_FUNCTIONS]: Object.freeze([
170
- // USE_SERVER_LOGICS allowed, because Server Logics, being logic from the server, can safely support Server Functions.
175
+ // USE_SERVER_LOGICS $COMMENT#AGNOSTIC20#FORCOMPOSEDVARIABLES#ALLOWEDBECAUSE $COMMENT#AGNOSTIC20#USE_SERVER_FUNCTIONS#USE_SERVER_LOGICS
171
176
  makeBlockedImport(
172
177
  USE_SERVER_FUNCTIONS,
173
178
  USE_SERVER_COMPONENTS
174
- ) /* Server Components aren't allowed because Server Functions have no business working with React Components. */,
175
- // USE_SERVER_FUNCTIONS allowed, because Server Functions, even though they don't need to import one another and the same results can be generated via 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.)
179
+ ) /* $COMMENT#AGNOSTIC20#USE_SERVER_FUNCTIONS#USE_SERVER_COMPONENTS */,
180
+ // USE_SERVER_FUNCTIONS $COMMENT#AGNOSTIC20#FORCOMPOSEDVARIABLES#ALLOWEDBECAUSE $COMMENT#AGNOSTIC20#USE_SERVER_FUNCTIONS#USE_SERVER_FUNCTIONS
176
181
  makeBlockedImport(
177
182
  USE_SERVER_FUNCTIONS,
178
183
  USE_CLIENT_LOGICS
179
- ) /* Client Logics should never leak to the server, such as would be the case here in a Server Functions Module. */,
184
+ ) /* $COMMENT#AGNOSTIC20#FORALIASVARIABLES#CLIENTNEVERSERVER */,
180
185
  makeBlockedImport(
181
186
  USE_SERVER_FUNCTIONS,
182
187
  USE_CLIENT_COMPONENTS
183
- ) /* Client Components aren't allowed because Server Functions have no business working with React Components. */,
184
- // USE_AGNOSTIC_LOGICS allowed, because Agnostic Logics can run safely on the server just like they can on the client, such as is the case here in a Server Functions Module.
188
+ ) /* $COMMENT#AGNOSTIC20#USE_SERVER_FUNCTIONS#USE_CLIENT_COMPONENTS */,
189
+ // USE_AGNOSTIC_LOGICS $COMMENT#AGNOSTIC20#FORCOMPOSEDVARIABLES#ALLOWEDBECAUSE $COMMENT#AGNOSTIC20#FORALIASVARIABLES#AGNOSTICCANSERVERCLIENT
185
190
  makeBlockedImport(
186
191
  USE_SERVER_FUNCTIONS,
187
192
  USE_AGNOSTIC_COMPONENTS
188
- ) /* Agnostic Components aren't allowed because Server Functions have no business working with React Components. */,
193
+ ) /* $COMMENT#AGNOSTIC20#USE_SERVER_FUNCTIONS#USE_AGNOSTIC_COMPONENTS */,
189
194
  ]),
190
195
  [USE_CLIENT_LOGICS]: Object.freeze([
191
196
  makeBlockedImportSuggestingUseAgnostic(
192
197
  USE_CLIENT_LOGICS,
193
198
  USE_SERVER_LOGICS
194
- ) /* Server Logics should never leak to the client, such as would be the case here in a Client Logics Module. */,
199
+ ) /* $COMMENT#AGNOSTIC20#FORALIASVARIABLES#SERVERNEVERCLIENT */,
195
200
  makeBlockedImportSuggestingUseAgnostic(
196
201
  USE_CLIENT_LOGICS,
197
202
  USE_SERVER_COMPONENTS
198
- ) /* Server Components cannot be thinkered with on the client. */,
199
- // USE_SERVER_FUNCTIONS allowed, because Server Functions can technically be attached to Client Components that are being tinkered with within Client Logics Modules.
200
- // USE_CLIENT_LOGICS allowed, because Client Logics can compose with one another.
201
- // USE_CLIENT_COMPONENTS allowed, because Client Components are OK to be composed with Client Logics as long as the Client Logics Module, by convention, does not export React components.
202
- // USE_AGNOSTIC_LOGICS allowed, because Agnostic Logics can run safely on the client just like they can on the server, such as is the case here in a Client Logics Module.
203
- // USE_AGNOSTIC_COMPONENTS allowed, because Agnostic Components can be composed with Logics on the client just like they can on the server, as long as the Client Logics Module, by convention, does not export React components.
203
+ ) /* $COMMENT#AGNOSTIC20#USE_CLIENT_LOGICS#USE_SERVER_COMPONENTS */,
204
+ // USE_SERVER_FUNCTIONS $COMMENT#AGNOSTIC20#FORCOMPOSEDVARIABLES#ALLOWEDBECAUSE $COMMENT#AGNOSTIC20#USE_CLIENT_LOGICS#USE_SERVER_FUNCTIONS
205
+ // USE_CLIENT_LOGICS $COMMENT#AGNOSTIC20#FORCOMPOSEDVARIABLES#ALLOWEDBECAUSE $COMMENT#AGNOSTIC20#USE_CLIENT_LOGICS#USE_CLIENT_LOGICS
206
+ // USE_CLIENT_COMPONENTS $COMMENT#AGNOSTIC20#FORCOMPOSEDVARIABLES#ALLOWEDBECAUSE $COMMENT#AGNOSTIC20#USE_CLIENT_LOGICS#USE_CLIENT_COMPONENTS
207
+ // USE_AGNOSTIC_LOGICS $COMMENT#AGNOSTIC20#FORCOMPOSEDVARIABLES#ALLOWEDBECAUSE $COMMENT#AGNOSTIC20#FORALIASVARIABLES#AGNOSTICCANCLIENTSERVER
208
+ // USE_AGNOSTIC_COMPONENTS $COMMENT#AGNOSTIC20#FORCOMPOSEDVARIABLES#ALLOWEDBECAUSE $COMMENT#AGNOSTIC20#USE_CLIENT_LOGICS#USE_AGNOSTIC_COMPONENTS
204
209
  ]),
205
210
  [USE_CLIENT_COMPONENTS]: Object.freeze([
206
211
  makeBlockedImportSuggestingUseAgnostic(
207
212
  USE_CLIENT_LOGICS,
208
213
  USE_SERVER_LOGICS
209
- ) /* Server Logics should never leak to the client, such as would be the case here in a Client Logics Module. */,
214
+ ) /* $COMMENT#AGNOSTIC20#FORALIASVARIABLES#SERVERNEVERCLIENT */,
210
215
  makeBlockedImportSuggestingUseAgnostic(
211
216
  USE_CLIENT_LOGICS,
212
217
  USE_SERVER_COMPONENTS
213
- ) /* Server Components cannot be thinkered with on the client. */,
214
- // USE_SERVER_FUNCTIONS allowed, because Server Functions are specifically triggered by Client Components.
215
- // USE_CLIENT_LOGICS allowed, because Client Logics, being logic from the client, can safely support Client Components.
216
- // USE_CLIENT_COMPONENTS allowed, because Client Components can compose with one another.
217
- // USE_AGNOSTIC_LOGICS allowed, because Agnostic Logics can run safely on the client just like they can on the server, such as is the case here in a Client Components Module.
218
- // USE_AGNOSTIC_COMPONENTS allowed, because Agnostic Components can render safely on the client just like they can on the server.
218
+ ) /* $COMMENT#AGNOSTIC20#USE_CLIENT_LOGICS#USE_SERVER_COMPONENTS */,
219
+ // USE_SERVER_FUNCTIONS $COMMENT#AGNOSTIC20#FORCOMPOSEDVARIABLES#ALLOWEDBECAUSE $COMMENT#AGNOSTIC20#USE_CLIENT_COMPONENTS#USE_SERVER_FUNCTIONS
220
+ // USE_CLIENT_LOGICS $COMMENT#AGNOSTIC20#FORCOMPOSEDVARIABLES#ALLOWEDBECAUSE $COMMENT#AGNOSTIC20#USE_CLIENT_COMPONENTS#USE_CLIENT_LOGICS
221
+ // USE_CLIENT_COMPONENTS $COMMENT#AGNOSTIC20#FORCOMPOSEDVARIABLES#ALLOWEDBECAUSE $COMMENT#AGNOSTIC20#USE_CLIENT_COMPONENTS#USE_CLIENT_COMPONENTS
222
+ // USE_AGNOSTIC_LOGICS $COMMENT#AGNOSTIC20#FORCOMPOSEDVARIABLES#ALLOWEDBECAUSE $COMMENT#AGNOSTIC20#FORALIASVARIABLES#AGNOSTICCANCLIENTSERVER
223
+ // USE_AGNOSTIC_COMPONENTS $COMMENT#AGNOSTIC20#FORCOMPOSEDVARIABLES#ALLOWEDBECAUSE $COMMENT#AGNOSTIC20#USE_CLIENT_COMPONENTS#USE_AGNOSTIC_COMPONENTS
219
224
  ]),
220
225
  [USE_AGNOSTIC_LOGICS]: Object.freeze([
221
226
  makeBlockedImportSuggestingUseAgnostic(
222
227
  USE_AGNOSTIC_LOGICS,
223
228
  USE_SERVER_LOGICS
224
- ) /* Server Logics cannot run on both the server and the client, such as would be the case here in an Agnostic Logics Module. */,
229
+ ) /* $COMMENT#AGNOSTIC20#FORALIASVARIABLES#SERVERLOGICSCANTBOTH */,
225
230
  makeBlockedImportSuggestingUseAgnostic(
226
231
  USE_AGNOSTIC_LOGICS,
227
232
  USE_SERVER_COMPONENTS
228
- ) /* Server Components cannot be tinkered with on both the server and the client. */,
233
+ ) /* $COMMENT#AGNOSTIC20#USE_AGNOSTIC_LOGICS#USE_SERVER_COMPONENTS */,
229
234
  makeBlockedImport(
230
235
  USE_AGNOSTIC_LOGICS,
231
236
  USE_SERVER_FUNCTIONS
232
- ) /* 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. */,
237
+ ) /* $COMMENT#AGNOSTIC20#USE_AGNOSTIC_LOGICS#USE_SERVER_FUNCTIONS */,
233
238
  makeBlockedImport(
234
239
  USE_AGNOSTIC_LOGICS,
235
240
  USE_CLIENT_LOGICS
236
- ) /* Client Logics cannot run on both the server and the client, such as would be the case here in an Agnostic Logics Module. */,
241
+ ) /* $COMMENT#AGNOSTIC20#FORALIASVARIABLES#CLIENTLOGICSCANTBOTH */,
237
242
  makeBlockedImport(
238
243
  USE_AGNOSTIC_LOGICS,
239
244
  USE_CLIENT_COMPONENTS
240
- ) /* Client Components cannot be tinkered with on both the server and the client. */,
241
- // USE_AGNOSTIC_LOGICS allowed, because Agnostic Logics can compose with one another.
242
- // USE_AGNOSTIC_COMPONENTS allowed, because Agnostic Components can be composed with Logics agnostically as long as the Agnostic Logics Module, by convention, does not export React components.
245
+ ) /* $COMMENT#AGNOSTIC20#USE_AGNOSTIC_LOGICS#USE_CLIENT_COMPONENTS */,
246
+ // USE_AGNOSTIC_LOGICS $COMMENT#AGNOSTIC20#FORCOMPOSEDVARIABLES#ALLOWEDBECAUSE $COMMENT#AGNOSTIC20#USE_AGNOSTIC_LOGICS#USE_AGNOSTIC_LOGICS
247
+ // USE_AGNOSTIC_COMPONENTS $COMMENT#AGNOSTIC20#FORCOMPOSEDVARIABLES#ALLOWEDBECAUSE $COMMENT#AGNOSTIC20#USE_AGNOSTIC_LOGICS#USE_AGNOSTIC_COMPONENTS
243
248
  ]),
244
249
  [USE_AGNOSTIC_COMPONENTS]: Object.freeze([
245
250
  makeBlockedImportSuggestingUseAgnostic(
246
251
  USE_AGNOSTIC_COMPONENTS,
247
252
  USE_SERVER_LOGICS
248
- ) /* Server Logics cannot run on both the server and the client, such as would be the case here in an Agnostic Components Module. */,
253
+ ) /* $COMMENT#AGNOSTIC20#FORALIASVARIABLES#SERVERLOGICSCANTBOTH */,
249
254
  makeBlockedImportSuggestingUseAgnostic(
250
255
  USE_AGNOSTIC_COMPONENTS,
251
256
  USE_SERVER_COMPONENTS
252
- ) /* Server Components, unlike 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. */,
253
- // USE_SERVER_FUNCTIONS allowed, because Server Functions can be passed to Client Components as props when Client Components are also legally imported into Agnostic Components Modules.
257
+ ) /* $COMMENT#AGNOSTIC20#USE_AGNOSTIC_COMPONENTS#USE_SERVER_COMPONENTS */,
258
+ // USE_SERVER_FUNCTIONS $COMMENT#AGNOSTIC20#FORCOMPOSEDVARIABLES#ALLOWEDBECAUSE $COMMENT#AGNOSTIC20#USE_AGNOSTIC_COMPONENTS#USE_SERVER_FUNCTIONS
254
259
  makeBlockedImport(
255
260
  USE_AGNOSTIC_COMPONENTS,
256
261
  USE_CLIENT_LOGICS
257
- ) /* Client Logics cannot run on both the server and the client, such as would be the case here in an Agnostic Components Module. */,
258
- // USE_CLIENT_COMPONENTS allowed, because Client Components can be nested inside Agnostic Components either to wrap some of the tree with client state accessible through child Client Components and pass through Server Components (if still on the Server Tree), or to create client boundaries when the root of the application is planted on the server.
259
- // USE_AGNOSTIC_LOGICS allowed, because Agnostic Logics, being environment-agnostic logic, can safely support Agnostic Components.
260
- // USE_AGNOSTIC_COMPONENTS allowed, because Agnostic Components can compose with one another.
262
+ ) /* $COMMENT#AGNOSTIC20#FORALIASVARIABLES#CLIENTLOGICSCANTBOTH */,
263
+ // USE_CLIENT_COMPONENTS $COMMENT#AGNOSTIC20#FORCOMPOSEDVARIABLES#ALLOWEDBECAUSE $COMMENT#AGNOSTIC20#USE_AGNOSTIC_COMPONENTS#USE_CLIENT_COMPONENTS
264
+ // USE_AGNOSTIC_LOGICS $COMMENT#AGNOSTIC20#FORCOMPOSEDVARIABLES#ALLOWEDBECAUSE $COMMENT#AGNOSTIC20#USE_AGNOSTIC_COMPONENTS#USE_AGNOSTIC_LOGICS
265
+ // USE_AGNOSTIC_COMPONENTS $COMMENT#AGNOSTIC20#FORCOMPOSEDVARIABLES#ALLOWEDBECAUSE $COMMENT#AGNOSTIC20#USE_AGNOSTIC_COMPONENTS#USE_AGNOSTIC_COMPONENTS
261
266
  ]),
262
267
  });
@@ -39,9 +39,9 @@ import {
39
39
  /* currentFileFlow */
40
40
 
41
41
  /**
42
- * The flow that begins the import rules enforcement rule, retrieving the effective directive of the current file before comparing it to upcoming effective directives of the files it imports.
43
- * @param {Context} context The ESLint rule's `context` object.
44
- * @returns Either an object with `skip: true` to disregard or one with the non-null `currentFileEffectiveDirective`.
42
+ * $COMMENT#JSDOC#DEFINITIONS#AGNOSTIC20#CURRENTFILEFLOW
43
+ * @param {Context} context $COMMENT#JSDOC#PARAMS#CONTEXTB
44
+ * @returns $COMMENT#JSDOC#RETURNS#AGNOSTIC20#CURRENTFILEFLOW
45
45
  */
46
46
  export const currentFileFlow = (context) => {
47
47
  const skipTrue = { ...skip, currentFileEffectiveDirective: undefined };
@@ -94,10 +94,10 @@ export const currentFileFlow = (context) => {
94
94
  /* importedFileFlow */
95
95
 
96
96
  /**
97
- * The flow that is shared between import and re-export traversals to obtain the import file's effective directive.
98
- * @param {Context} context The ESLint rule's `context` object.
99
- * @param {ImportDeclaration} node The ESLint `node` of the rule's current traversal.
100
- * @returns Either an object with `skip: true` to disregard or one with the non-null `importedFileEffectiveDirective`.
97
+ * $COMMENT#JSDOC#DEFINITIONS#AGNOSTIC20#IMPORTEDFILEFLOW
98
+ * @param {Context} context $COMMENT#JSDOC#PARAMS#CONTEXTB
99
+ * @param {ImportDeclaration} node $COMMENT#JSDOC#PARAMS#NODE
100
+ * @returns $COMMENT#JSDOC#RETURNS#AGNOSTIC20#IMPORTEDFILEFLOW
101
101
  */
102
102
  const importedFileFlow = (context, node) => {
103
103
  const skipTrue = { ...skip, importedFileEffectiveDirective: undefined };
@@ -143,11 +143,11 @@ const importedFileFlow = (context, node) => {
143
143
 
144
144
  /* importsFlow */
145
145
 
146
- /** The full flow for import traversals to enforce effective directives import rules.
147
- * @param {Context} context The ESLint rule's `context` object.
148
- * @param {ImportDeclaration} node The ESLint `node` of the rule's current traversal.
149
- * @param {EffectiveDirective} currentFileEffectiveDirective The current file's effective directive.
150
- * @returns Early if the flow needs to be interrupted.
146
+ /** $COMMENT#JSDOC#DEFINITIONS#AGNOSTIC20#IMPORTSFLOW
147
+ * @param {Context} context $COMMENT#JSDOC#PARAMS#CONTEXTB
148
+ * @param {ImportDeclaration} node $COMMENT#JSDOC#PARAMS#NODE
149
+ * @param {EffectiveDirective} currentFileEffectiveDirective $COMMENT#JSDOC#PARAMS#AGNOSTIC20#CURRENTFILEEFFECTIVEDIRECTIVE
150
+ * @returns $COMMENT#JSDOC#RETURNS#AGNOSTIC20#IMPORTSFLOW
151
151
  */
152
152
  export const importsFlow = (context, node, currentFileEffectiveDirective) => {
153
153
  // does not operate on `import type`
@@ -183,11 +183,11 @@ export const importsFlow = (context, node, currentFileEffectiveDirective) => {
183
183
 
184
184
  /* reExportsFlow */
185
185
 
186
- /** The full flow for export traversals, shared between `ExportNamedDeclaration` and `ExportAllDeclaration`, to ensure same effective directive re-exports.
187
- * @param {Context} context The ESLint rule's `context` object.
188
- * @param {ExportNamedDeclaration | ExportAllDeclaration} node The ESLint `node` of the rule's current traversal.
189
- * @param {EffectiveDirective} currentFileEffectiveDirective The current file's effective directive.
190
- * @returns Early if the flow needs to be interrupted.
186
+ /** $COMMENT#JSDOC#DEFINITIONS#AGNOSTIC20#REEXPORTSFLOW
187
+ * @param {Context} context $COMMENT#JSDOC#PARAMS#CONTEXTB
188
+ * @param {ExportNamedDeclaration | ExportAllDeclaration} node $COMMENT#JSDOC#PARAMS#NODE
189
+ * @param {EffectiveDirective} currentFileEffectiveDirective $COMMENT#JSDOC#PARAMS#AGNOSTIC20#CURRENTFILEEFFECTIVEDIRECTIVE
190
+ * @returns $COMMENT#JSDOC#RETURNS#AGNOSTIC20#IMPORTSFLOW
191
191
  */
192
192
  export const reExportsFlow = (context, node, currentFileEffectiveDirective) => {
193
193
  // does not operate on `export type`
@@ -28,13 +28,13 @@ import {
28
28
  /* getDirectiveFromModule */
29
29
 
30
30
  /**
31
- * Gets the directive of a module from its Abstract Syntax Tree.
32
- * - `null` denotes a server-by-default module, ideally a Server Module.
33
- * - `'use server'` denotes a Server Functions Module.
34
- * - `'use client'` denotes a Client Module.
35
- * - `'use agnostic'` denotes an Agnostic Module (formerly Shared Module).
36
- * @param {AST} ast The module's AST (Abstract Syntax Tree).
37
- * @returns The directive, or lack thereof via `null`. The lack of a directive is considered server-by-default.
31
+ * $COMMENT#JSDOC#DEFINITIONS#AGNOSTIC20#GETDIRECTIVEFROMMODULE
32
+ * - $COMMENT#JSDOC#DETAILS#AGNOSTIC20#NULLDIRECTIVE
33
+ * - $COMMENT#JSDOC#DETAILS#AGNOSTIC20#USESERVER
34
+ * - $COMMENT#JSDOC#DETAILS#AGNOSTIC20#USECLIENT
35
+ * - $COMMENT#JSDOC#DETAILS#AGNOSTIC20#USEAGNOSTIC
36
+ * @param {AST} ast $COMMENT#JSDOC#PARAMS#AGNOSTIC20#AST
37
+ * @returns $COMMENT#JSDOC#RETURNS#AGNOSTIC20#GETDIRECTIVEFROMMODULE
38
38
  */
39
39
  export const getDirectiveFromModule = (ast) => {
40
40
  // the AST body to check for the top-of-the-file directive
@@ -63,13 +63,13 @@ export const getDirectiveFromModule = (ast) => {
63
63
  /* getDirectiveFromCurrentModule */
64
64
 
65
65
  /**
66
- * Gets the directive of the current module.
67
- * - `null` denotes a server-by-default module, ideally a Server Module.
68
- * - `'use server'` denotes a Server Functions Module.
69
- * - `'use client'` denotes a Client Module.
70
- * - `'use agnostic'` denotes an Agnostic Module (formerly Shared Module).
71
- * @param {Context} context The ESLint rule's `context` object.
72
- * @returns The directive, or lack thereof via `null`. The lack of a directive is considered server-by-default.
66
+ * $COMMENT#JSDOC#DEFINITIONS#AGNOSTIC20#GETDIRECTIVEFROMCURRENTMODULE
67
+ * - $COMMENT#JSDOC#DETAILS#AGNOSTIC20#NULLDIRECTIVE
68
+ * - $COMMENT#JSDOC#DETAILS#AGNOSTIC20#USESERVER
69
+ * - $COMMENT#JSDOC#DETAILS#AGNOSTIC20#USECLIENT
70
+ * - $COMMENT#JSDOC#DETAILS#AGNOSTIC20#USEAGNOSTIC
71
+ * @param {Context} context $COMMENT#JSDOC#PARAMS#CONTEXTB
72
+ * @returns $COMMENT#JSDOC#RETURNS#AGNOSTIC20#GETDIRECTIVEFROMMODULE
73
73
  */
74
74
  export const getDirectiveFromCurrentModule = (context) => {
75
75
  // the AST of the current module
@@ -81,13 +81,13 @@ export const getDirectiveFromCurrentModule = (context) => {
81
81
  /* getDirectiveFromImportedModule */
82
82
 
83
83
  /**
84
- * Gets the directive of the imported module.
85
- * - `null` denotes a server-by-default module, ideally a Server Module.
86
- * - `'use server'` denotes a Server Functions Module.
87
- * - `'use client'` denotes a Client Module.
88
- * - `'use agnostic'` denotes an Agnostic Module (formerly Shared Module).
89
- * @param {string} resolvedPath The resolved path of the imported module.
90
- * @returns The directive, or lack thereof via `null`. The lack of a directive is considered server-by-default.
84
+ * $COMMENT#JSDOC#DEFINITIONS#AGNOSTIC20#GETDIRECTIVEFROMIMPORTEDMODULE
85
+ * - $COMMENT#JSDOC#DETAILS#AGNOSTIC20#NULLDIRECTIVE
86
+ * - $COMMENT#JSDOC#DETAILS#AGNOSTIC20#USESERVER
87
+ * - $COMMENT#JSDOC#DETAILS#AGNOSTIC20#USECLIENT
88
+ * - $COMMENT#JSDOC#DETAILS#AGNOSTIC20#USEAGNOSTIC
89
+ * @param {string} resolvedPath $COMMENT#JSDOC#PARAMS#RESOLVEDPATH
90
+ * @returns $COMMENT#JSDOC#RETURNS#AGNOSTIC20#GETDIRECTIVEFROMMODULE
91
91
  */
92
92
  export const getDirectiveFromImportedModule = (resolvedPath) => {
93
93
  // the AST of the imported module
@@ -99,17 +99,17 @@ export const getDirectiveFromImportedModule = (resolvedPath) => {
99
99
  /* getEffectiveDirective */
100
100
 
101
101
  /**
102
- * Gets the effective directive of a module, based on the combination of its directive (or lack thereof) and its extension (depending on whether it ends with 'x' for JSX).
103
- * - `'use server logics'` denotes a Server Logics Module.
104
- * - `'use server components'` denotes a Server Components Module.
105
- * - `'use server functions'` denotes a Server Functions Module.
106
- * - `'use client logics'` denotes a Client Logics Module.
107
- * - `'use client components'` denotes a Client Components Module.
108
- * - `'use agnostic logics'` denotes an Agnostic Logics Module.
109
- * - `'use agnostic components'` denotes an Agnostic Components Module.
110
- * @param {Directive | NoDirective} directive The directive as written on top of the file (`"no directive"` if no valid directive).
111
- * @param {Extension} extension The JavaScript (TypeScript) extension of the file.
112
- * @returns The effective directive, from which imports rules are applied.
102
+ * $COMMENT#JSDOC#DEFINITIONS#AGNOSTIC20#GETEFFECTIVEDIRECTIVE
103
+ * - $COMMENT#JSDOC#DETAILS#AGNOSTIC20#USESERVERLOGICS
104
+ * - $COMMENT#JSDOC#DETAILS#AGNOSTIC20#USESERVERCOMPONENTS
105
+ * - $COMMENT#JSDOC#DETAILS#AGNOSTIC20#USESERVERFUNCTIONS
106
+ * - $COMMENT#JSDOC#DETAILS#AGNOSTIC20#USECLIENTLOGICS
107
+ * - $COMMENT#JSDOC#DETAILS#AGNOSTIC20#USECLIENTCOMPONENTS
108
+ * - $COMMENT#JSDOC#DETAILS#AGNOSTIC20#USEAGNOSTICLOGICS
109
+ * - $COMMENT#JSDOC#DETAILS#AGNOSTIC20#USEAGNOSTICCOMPONENTS
110
+ * @param {Directive | NoDirective} directive $COMMENT#JSDOC#PARAMS#AGNOSTIC20#DIRECTIVE
111
+ * @param {Extension} extension $COMMENT#JSDOC#PARAMS#EXTENSION
112
+ * @returns $COMMENT#JSDOC#RETURNS#AGNOSTIC20#GETEFFECTIVEDIRECTIVE
113
113
  */
114
114
  export const getEffectiveDirective = (directive, extension) => {
115
115
  const moduleKind = extension.endsWith("x")
@@ -124,10 +124,10 @@ export const getEffectiveDirective = (directive, extension) => {
124
124
  /* isImportBlocked */
125
125
 
126
126
  /**
127
- * Returns a boolean deciding if an imported file's effective directive is incompatible with the current file's effective directive.
128
- * @param {EffectiveDirective} currentFileEffectiveDirective The current file's effective directive.
129
- * @param {EffectiveDirective} importedFileEffectiveDirective The imported file's effective directive.
130
- * @returns `true` if the import is blocked, as established in `effectiveDirectives_BlockedImports`.
127
+ * $COMMENT#JSDOC#DEFINITIONS#AGNOSTIC20#ISIMPORTBLOCKED
128
+ * @param {EffectiveDirective} currentFileEffectiveDirective $COMMENT#JSDOC#PARAMS#AGNOSTIC20#CURRENTFILEEFFECTIVEDIRECTIVE
129
+ * @param {EffectiveDirective} importedFileEffectiveDirective $COMMENT#JSDOC#PARAMS#AGNOSTIC20#IMPORTEDFILEEFFECTIVEDIRECTIVE
130
+ * @returns $COMMENT#JSDOC#RETURNS#AGNOSTIC20#ISIMPORTBLOCKED
131
131
  */
132
132
  export const isImportBlocked = (
133
133
  currentFileEffectiveDirective,
@@ -142,9 +142,9 @@ export const isImportBlocked = (
142
142
  /* makeMessageFromCurrentFileEffectiveDirective */
143
143
 
144
144
  /**
145
- * Lists in an message the effective modules incompatible with an effective module based on its effective directive.
146
- * @param {EffectiveDirective} effectiveDirective The effective directive of the effective module.
147
- * @returns The message listing the incompatible effective modules.
145
+ * $COMMENT#JSDOC#DEFINITIONS#AGNOSTIC20#MAKEMESSAGEFROMCURRENTFILEEFFECTIVEDIRECTIVE
146
+ * @param {EffectiveDirective} effectiveDirective $COMMENT#JSDOC#PARAMS#AGNOSTIC20#EFFECTIVEDIRECTIVE
147
+ * @returns $COMMENT#JSDOC#RETURNS#AGNOSTIC20#MAKEMESSAGEFROMCURRENTFILEEFFECTIVEDIRECTIVE
148
148
  */
149
149
  export const makeMessageFromCurrentFileEffectiveDirective = (
150
150
  effectiveDirective
@@ -157,10 +157,10 @@ export const makeMessageFromCurrentFileEffectiveDirective = (
157
157
  /* findSpecificViolationMessage */
158
158
 
159
159
  /**
160
- * Finds the `message` for the specific violation of effective directives import rules based on `effectiveDirectives_BlockedImports`.
161
- * @param {EffectiveDirective} currentFileEffectiveDirective The current file's effective directive.
162
- * @param {EffectiveDirective} importedFileEffectiveDirective The imported file's effective directive.
163
- * @returns The corresponding `message`.
160
+ * $COMMENT#JSDOC#DEFINITIONS#AGNOSTIC20#FINDSPECIFICVIOLATIONMESSAGE
161
+ * @param {EffectiveDirective} currentFileEffectiveDirective $COMMENT#JSDOC#PARAMS#AGNOSTIC20#CURRENTFILEEFFECTIVEDIRECTIVE
162
+ * @param {EffectiveDirective} importedFileEffectiveDirective $COMMENT#JSDOC#PARAMS#AGNOSTIC20#IMPORTEDFILEEFFECTIVEDIRECTIVE
163
+ * @returns $COMMENT#JSDOC#RETURNS#FINDSPECIFICVIOLATIONMESSAGE
164
164
  */
165
165
  export const findSpecificViolationMessage = (
166
166
  currentFileEffectiveDirective,
@@ -12,9 +12,9 @@ import {
12
12
  */
13
13
 
14
14
  /**
15
- * Makes the agnostic20 config for the use-agnostic ESLint plugin.
16
- * @param {Plugin} plugin The use-agnostic ESLint plugin itself.
17
- * @returns The agnostic20 config's name as a key and its config as its value.
15
+ * $COMMENT#JSDOC#DEFINITIONS#AGNOSTIC20#MAKEAGNOSTIC20CONFIG
16
+ * @param {Plugin} plugin $COMMENT#JSDOC#PARAMS#PLUGIN
17
+ * @returns $COMMENT#JSDOC#RETURNS#AGNOSTIC20#MAKEAGNOSTIC20CONFIG
18
18
  */
19
19
  export const makeAgnostic20Config = (plugin) => ({
20
20
  [agnostic20ConfigName]: defineConfig([