eslint-plugin-use-agnostic 1.6.8 → 1.6.10

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/types/index.d.ts CHANGED
@@ -92,56 +92,56 @@ export const directives_effectiveDirectives: Readonly<{
92
92
  }>;
93
93
 
94
94
  /**
95
- * Gets the directive of a module from its Abstract Syntax Tree.
96
- * - `null` denotes a server-by-default module, ideally a Server Module.
97
- * - `'use server'` denotes a Server Functions Module.
98
- * - `'use client'` denotes a Client Module.
99
- * - `'use agnostic'` denotes an Agnostic Module (formerly Shared Module).
100
- * @param ast The module's AST (Abstract Syntax Tree).
101
- * @returns The directive, or lack thereof via `null`. The lack of a directive is considered server-by-default.
95
+ * $COMMENT#JSDOC#DEFINITIONS#AGNOSTIC20#GETDIRECTIVEFROMMODULE
96
+ * - $COMMENT#JSDOC#DETAILS#AGNOSTIC20#NULLDIRECTIVE
97
+ * - $COMMENT#JSDOC#DETAILS#AGNOSTIC20#USESERVER
98
+ * - $COMMENT#JSDOC#DETAILS#AGNOSTIC20#USECLIENT
99
+ * - $COMMENT#JSDOC#DETAILS#AGNOSTIC20#USEAGNOSTIC
100
+ * @param ast $COMMENT#JSDOC#PARAMS#AGNOSTIC20#AST
101
+ * @returns $COMMENT#JSDOC#RETURNS#AGNOSTIC20#GETDIRECTIVEFROMMODULE
102
102
  */
103
103
  export const getDirectiveFromModule: (
104
104
  ast: TSESLintSourceCode.Program
105
105
  ) => "use server" | "use client" | "use agnostic" | null;
106
106
 
107
107
  /**
108
- * Gets the directive of the current module.
109
- * - `null` denotes a server-by-default module, ideally a Server Module.
110
- * - `'use server'` denotes a Server Functions Module.
111
- * - `'use client'` denotes a Client Module.
112
- * - `'use agnostic'` denotes an Agnostic Module (formerly Shared Module).
113
- * @param context The ESLint rule's `context` object.
114
- * @returns The directive, or lack thereof via `null`. The lack of a directive is considered server-by-default.
108
+ * $COMMENT#JSDOC#DEFINITIONS#AGNOSTIC20#GETDIRECTIVEFROMCURRENTMODULE
109
+ * - $COMMENT#JSDOC#DETAILS#AGNOSTIC20#NULLDIRECTIVE
110
+ * - $COMMENT#JSDOC#DETAILS#AGNOSTIC20#USESERVER
111
+ * - $COMMENT#JSDOC#DETAILS#AGNOSTIC20#USECLIENT
112
+ * - $COMMENT#JSDOC#DETAILS#AGNOSTIC20#USEAGNOSTIC
113
+ * @param context $COMMENT#JSDOC#PARAMS#CONTEXTB
114
+ * @returns $COMMENT#JSDOC#RETURNS#AGNOSTIC20#GETDIRECTIVEFROMMODULE
115
115
  */
116
116
  export const getDirectiveFromCurrentModule: (
117
117
  context: RuleContext<string, readonly unknown[]>
118
118
  ) => "use server" | "use client" | "use agnostic" | null;
119
119
 
120
120
  /**
121
- * Gets the directive of the imported module.
122
- * - `null` denotes a server-by-default module, ideally a Server Module.
123
- * - `'use server'` denotes a Server Functions Module.
124
- * - `'use client'` denotes a Client Module.
125
- * - `'use agnostic'` denotes an Agnostic Module (formerly Shared Module).
126
- * @param resolvedPath The resolved path of the imported module.
127
- * @returns The directive, or lack thereof via `null`. The lack of a directive is considered server-by-default.
121
+ * $COMMENT#JSDOC#DEFINITIONS#AGNOSTIC20#GETDIRECTIVEFROMIMPORTEDMODULE
122
+ * - $COMMENT#JSDOC#DETAILS#AGNOSTIC20#NULLDIRECTIVE
123
+ * - $COMMENT#JSDOC#DETAILS#AGNOSTIC20#USESERVER
124
+ * - $COMMENT#JSDOC#DETAILS#AGNOSTIC20#USECLIENT
125
+ * - $COMMENT#JSDOC#DETAILS#AGNOSTIC20#USEAGNOSTIC
126
+ * @param resolvedPath $COMMENT#JSDOC#PARAMS#RESOLVEDPATH
127
+ * @returns $COMMENT#JSDOC#RETURNS#AGNOSTIC20#GETDIRECTIVEFROMMODULE
128
128
  */
129
129
  export const getDirectiveFromImportedModule: (
130
130
  resolvedPath: string
131
131
  ) => "use server" | "use client" | "use agnostic" | null;
132
132
 
133
133
  /**
134
- * 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).
135
- * - `'use server logics'` denotes a Server Logics Module.
136
- * - `'use server components'` denotes a Server Components Module.
137
- * - `'use server functions'` denotes a Server Functions Module.
138
- * - `'use client logics'` denotes a Client Logics Module.
139
- * - `'use client components'` denotes a Client Components Module.
140
- * - `'use agnostic logics'` denotes an Agnostic Logics Module.
141
- * - `'use agnostic components'` denotes an Agnostic Components Module.
142
- * @param directive The directive as written on top of the file (`"no directive"` if no valid directive).
143
- * @param extension The JavaScript (TypeScript) extension of the file.
144
- * @returns The effective directive, from which imports rules are applied.
134
+ * $COMMENT#JSDOC#DEFINITIONS#AGNOSTIC20#GETEFFECTIVEDIRECTIVE
135
+ * - $COMMENT#JSDOC#DETAILS#AGNOSTIC20#USESERVERLOGICS
136
+ * - $COMMENT#JSDOC#DETAILS#AGNOSTIC20#USESERVERCOMPONENTS
137
+ * - $COMMENT#JSDOC#DETAILS#AGNOSTIC20#USESERVERFUNCTIONS
138
+ * - $COMMENT#JSDOC#DETAILS#AGNOSTIC20#USECLIENTLOGICS
139
+ * - $COMMENT#JSDOC#DETAILS#AGNOSTIC20#USECLIENTCOMPONENTS
140
+ * - $COMMENT#JSDOC#DETAILS#AGNOSTIC20#USEAGNOSTICLOGICS
141
+ * - $COMMENT#JSDOC#DETAILS#AGNOSTIC20#USEAGNOSTICCOMPONENTS
142
+ * @param directive $COMMENT#JSDOC#PARAMS#AGNOSTIC20#DIRECTIVE
143
+ * @param extension $COMMENT#JSDOC#PARAMS#EXTENSION
144
+ * @returns $COMMENT#JSDOC#RETURNS#AGNOSTIC20#GETEFFECTIVEDIRECTIVE
145
145
  */
146
146
  export const getEffectiveDirective: (
147
147
  directive: "use server" | "use client" | "use agnostic" | "no directive",
@@ -169,10 +169,10 @@ export const getEffectiveDirective: (
169
169
  | null;
170
170
 
171
171
  /**
172
- * Returns a boolean deciding if an imported file's effective directive is incompatible with the current file's effective directive.
173
- * @param currentFileEffectiveDirective The current file's effective directive.
174
- * @param importedFileEffectiveDirective The imported file's effective directive.
175
- * @returns `true` if the import is blocked, as established in `effectiveDirectives_BlockedImports`.
172
+ * $COMMENT#JSDOC#DEFINITIONS#AGNOSTIC20#ISIMPORTBLOCKED
173
+ * @param currentFileEffectiveDirective $COMMENT#JSDOC#PARAMS#AGNOSTIC20#CURRENTFILEEFFECTIVEDIRECTIVE
174
+ * @param importedFileEffectiveDirective $COMMENT#JSDOC#PARAMS#AGNOSTIC20#IMPORTEDFILEEFFECTIVEDIRECTIVE
175
+ * @returns $COMMENT#JSDOC#RETURNS#AGNOSTIC20#ISIMPORTBLOCKED
176
176
  */
177
177
  export const isImportBlockedAgnostic20: (
178
178
  currentFileEffectiveDirective:
@@ -304,21 +304,21 @@ export const commentedStrategies_commentedDirectives: Readonly<{
304
304
  }>;
305
305
 
306
306
  /**
307
- * Gets the commented directive of a module from its ESLint `SourceCode` object.
307
+ * $COMMENT#JSDOC#DEFINITIONS#DIRECTIVE21#GETCOMMENTEDDIRECTIVEFROMSOURCECODE1
308
308
  *
309
- * Accepted directives for the default Directive-First Architecture are (single or double quotes included):
310
- * - `'use server logics'`, `"use server logics"` denoting a Server Logics Module.
311
- * - `'use client logics'`, `"use client logics"` denoting a Client Logics Module.
312
- * - `'use agnostic logics'`, `"use agnostic logics"` denoting an Agnostic Logics Module.
313
- * - `'use server components'`, `"use server components"` denoting a Server Components Module.
314
- * - `'use client components'`, `"use client components"` denoting a Client Components Module.
315
- * - `'use agnostic components'`, `"use agnostic components"` denoting an Agnostic Components Module.
316
- * - `'use server functions'`, `"use server functions"` denoting a Server Functions Module.
317
- * - `'use client contexts'`, `"use client contexts"` denoting a Client Contexts Module.
318
- * - `'use agnostic conditions'`, `"use agnostic conditions"` denoting an Agnostic Conditions Module.
319
- * - `'use agnostic strategies'`, `"use agnostic strategies"` denoting an Agnostic Strategies Module.
320
- * @param sourceCode The ESLint SourceCode object.
321
- * @returns The commented directive, or lack thereof via `null`. Given the strictness of this architecture, the lack of a directive is considered a mistake. (Though rules may provide the opportunity to declare a default, and configs with preset defaults may become provided.)
309
+ * $COMMENT#JSDOC#DEFINITIONS#DIRECTIVE21#GETCOMMENTEDDIRECTIVEFROMSOURCECODE2
310
+ * - $COMMENT#JSDOC#DETAILS#DIRECTIVE21#USESERVERLOGICSA
311
+ * - $COMMENT#JSDOC#DETAILS#DIRECTIVE21#USECLIENTLOGICSA
312
+ * - $COMMENT#JSDOC#DETAILS#DIRECTIVE21#USEAGNOSTICLOGICSA
313
+ * - $COMMENT#JSDOC#DETAILS#DIRECTIVE21#USESERVERCOMPONENTSA
314
+ * - $COMMENT#JSDOC#DETAILS#DIRECTIVE21#USECLIENTCOMPONENTSA
315
+ * - $COMMENT#JSDOC#DETAILS#DIRECTIVE21#USEAGNOSTICCOMPONENTSA
316
+ * - $COMMENT#JSDOC#DETAILS#DIRECTIVE21#USESERVERFUNCTIONSA
317
+ * - $COMMENT#JSDOC#DETAILS#DIRECTIVE21#USECLIENTCONTEXTSA
318
+ * - $COMMENT#JSDOC#DETAILS#DIRECTIVE21#USEAGNOSTICCONDITIONSA
319
+ * - $COMMENT#JSDOC#DETAILS#DIRECTIVE21#USEAGNOSTICSTRATEGIESA
320
+ * @param sourceCode $COMMENT#JSDOC#PARAMS#DIRECTIVE21#SOURCECODE
321
+ * @returns $COMMENT#JSDOC#RETURNS#DIRECTIVE21#GETCOMMENTEDDIRECTIVEFROMSOURCECODE
322
322
  */
323
323
  export const getCommentedDirectiveFromSourceCode: (
324
324
  sourceCode: ESLintSourceCode
@@ -336,21 +336,21 @@ export const getCommentedDirectiveFromSourceCode: (
336
336
  | null;
337
337
 
338
338
  /**
339
- * Gets the commented directive of the current module.
339
+ * $COMMENT#JSDOC#DEFINITIONS#DIRECTIVE21#GETCOMMENTEDDIRECTIVEFROMCURRENTMODULE1
340
340
  *
341
- * Accepted directives for the default Directive-First Architecture are (single or double quotes included):
342
- * - `'use server logics'`, `"use server logics"` denoting a Server Logics Module.
343
- * - `'use client logics'`, `"use client logics"` denoting a Client Logics Module.
344
- * - `'use agnostic logics'`, `"use agnostic logics"` denoting an Agnostic Logics Module.
345
- * - `'use server components'`, `"use server components"` denoting a Server Components Module.
346
- * - `'use client components'`, `"use client components"` denoting a Client Components Module.
347
- * - `'use agnostic components'`, `"use agnostic components"` denoting an Agnostic Components Module.
348
- * - `'use server functions'`, `"use server functions"` denoting a Server Functions Module.
349
- * - `'use client contexts'`, `"use client contexts"` denoting a Client Contexts Module.
350
- * - `'use agnostic conditions'`, `"use agnostic conditions"` denoting an Agnostic Conditions Module.
351
- * - `'use agnostic strategies'`, `"use agnostic strategies"` denoting an Agnostic Strategies Module.
352
- * @param context The ESLint rule's `context` object.
353
- * @returns The commented directive, or lack thereof via `null`. Given the strictness of this architecture, the lack of a directive is considered a mistake. (Though rules may provide the opportunity to declare a default, and configs with preset defaults may become provided.)
341
+ * $COMMENT#JSDOC#DEFINITIONS#DIRECTIVE21#GETCOMMENTEDDIRECTIVEFROMSOURCECODE2
342
+ * - $COMMENT#JSDOC#DETAILS#DIRECTIVE21#USESERVERLOGICSA
343
+ * - $COMMENT#JSDOC#DETAILS#DIRECTIVE21#USECLIENTLOGICSA
344
+ * - $COMMENT#JSDOC#DETAILS#DIRECTIVE21#USEAGNOSTICLOGICSA
345
+ * - $COMMENT#JSDOC#DETAILS#DIRECTIVE21#USESERVERCOMPONENTSA
346
+ * - $COMMENT#JSDOC#DETAILS#DIRECTIVE21#USECLIENTCOMPONENTSA
347
+ * - $COMMENT#JSDOC#DETAILS#DIRECTIVE21#USEAGNOSTICCOMPONENTSA
348
+ * - $COMMENT#JSDOC#DETAILS#DIRECTIVE21#USESERVERFUNCTIONSA
349
+ * - $COMMENT#JSDOC#DETAILS#DIRECTIVE21#USECLIENTCONTEXTSA
350
+ * - $COMMENT#JSDOC#DETAILS#DIRECTIVE21#USEAGNOSTICCONDITIONSA
351
+ * - $COMMENT#JSDOC#DETAILS#DIRECTIVE21#USEAGNOSTICSTRATEGIESA
352
+ * @param context $COMMENT#JSDOC#PARAMS#CONTEXTB
353
+ * @returns $COMMENT#JSDOC#RETURNS#DIRECTIVE21#GETCOMMENTEDDIRECTIVEFROMSOURCECODE
354
354
  */
355
355
  export const getCommentedDirectiveFromCurrentModule: (
356
356
  context: RuleContext<string, readonly unknown[]>
@@ -368,21 +368,21 @@ export const getCommentedDirectiveFromCurrentModule: (
368
368
  | null;
369
369
 
370
370
  /**
371
- * Gets the commented directive of the imported module.
371
+ * $COMMENT#JSDOC#DEFINITIONS#DIRECTIVE21#GETCOMMENTEDDIRECTIVEFROMIMPORTEDMODULE1
372
372
  *
373
- * Accepted directives for the default Directive-First Architecture are (single or double quotes included):
374
- * - `'use server logics'`, `"use server logics"` denoting a Server Logics Module.
375
- * - `'use client logics'`, `"use client logics"` denoting a Client Logics Module.
376
- * - `'use agnostic logics'`, `"use agnostic logics"` denoting an Agnostic Logics Module.
377
- * - `'use server components'`, `"use server components"` denoting a Server Components Module.
378
- * - `'use client components'`, `"use client components"` denoting a Client Components Module.
379
- * - `'use agnostic components'`, `"use agnostic components"` denoting an Agnostic Components Module.
380
- * - `'use server functions'`, `"use server functions"` denoting a Server Functions Module.
381
- * - `'use client contexts'`, `"use client contexts"` denoting a Client Contexts Module.
382
- * - `'use agnostic conditions'`, `"use agnostic conditions"` denoting an Agnostic Conditions Module.
383
- * - `'use agnostic strategies'`, `"use agnostic strategies"` denoting an Agnostic Strategies Module.
384
- * @param resolvedPath The resolved path of the imported module.
385
- * @returns The commented directive, or lack thereof via `null`. Given the strictness of this architecture, the lack of a directive is considered a mistake. (Though rules may provide the opportunity to declare a default, and configs with preset defaults may become provided.)
373
+ * $COMMENT#JSDOC#DEFINITIONS#DIRECTIVE21#GETCOMMENTEDDIRECTIVEFROMSOURCECODE2
374
+ * - $COMMENT#JSDOC#DETAILS#DIRECTIVE21#USESERVERLOGICSA
375
+ * - $COMMENT#JSDOC#DETAILS#DIRECTIVE21#USECLIENTLOGICSA
376
+ * - $COMMENT#JSDOC#DETAILS#DIRECTIVE21#USEAGNOSTICLOGICSA
377
+ * - $COMMENT#JSDOC#DETAILS#DIRECTIVE21#USESERVERCOMPONENTSA
378
+ * - $COMMENT#JSDOC#DETAILS#DIRECTIVE21#USECLIENTCOMPONENTSA
379
+ * - $COMMENT#JSDOC#DETAILS#DIRECTIVE21#USEAGNOSTICCOMPONENTSA
380
+ * - $COMMENT#JSDOC#DETAILS#DIRECTIVE21#USESERVERFUNCTIONSA
381
+ * - $COMMENT#JSDOC#DETAILS#DIRECTIVE21#USECLIENTCONTEXTSA
382
+ * - $COMMENT#JSDOC#DETAILS#DIRECTIVE21#USEAGNOSTICCONDITIONSA
383
+ * - $COMMENT#JSDOC#DETAILS#DIRECTIVE21#USEAGNOSTICSTRATEGIESA
384
+ * @param resolvedPath $COMMENT#JSDOC#PARAMS#RESOLVEDPATH
385
+ * @returns $COMMENT#JSDOC#RETURNS#DIRECTIVE21#GETCOMMENTEDDIRECTIVEFROMSOURCECODE
386
386
  */
387
387
  export const getCommentedDirectiveFromImportedModule: (
388
388
  resolvedPath: string
@@ -400,20 +400,20 @@ export const getCommentedDirectiveFromImportedModule: (
400
400
  | null;
401
401
 
402
402
  /**
403
- * Ensures that a module's commented directive is consistent with its file extension (depending on whether it ends with 'x' for JSX).
404
- * - `'use server logics'`: Server Logics Modules do NOT export JSX.
405
- * - `'use client logics'`: Client Logics Modules do NOT export JSX.
406
- * - `'use agnostic logics'`: Agnostic Logics Modules do NOT export JSX.
407
- * - `'use server components'`: Server Components Modules ONLY export JSX.
408
- * - `'use client components'`: Client Components Modules ONLY export JSX.
409
- * - `'use agnostic components'`: Agnostic Components Modules ONLY export JSX.
410
- * - `'use server functions'`: Server Functions Modules do NOT export JSX.
411
- * - `'use client contexts'`: Client Contexts Modules ONLY export JSX.
412
- * - `'use agnostic conditions'`: Agnostic Conditions Modules ONLY export JSX.
413
- * - `'use agnostic strategies'`: Agnostic Strategies Modules may export JSX.
414
- * @param directive The commented directive as written on top of the file (cannot be `null` at that stage).
415
- * @param extension The JavaScript (TypeScript) extension of the file.
416
- * @returns The verified commented directive, from which imports rules are applied. Returns `null` if the verification failed, upon which an error will be reported depending on the commented directive, since the error logic here is strictly binary.
403
+ * $COMMENT#JSDOC#DEFINITIONS#DIRECTIVE21#GETVERIFIEDCOMMENTEDDIRECTIVE
404
+ * - $COMMENT#JSDOC#DETAILS#DIRECTIVE21#USESERVERLOGICSB
405
+ * - $COMMENT#JSDOC#DETAILS#DIRECTIVE21#USECLIENTLOGICSB
406
+ * - $COMMENT#JSDOC#DETAILS#DIRECTIVE21#USEAGNOSTICLOGICSB
407
+ * - $COMMENT#JSDOC#DETAILS#DIRECTIVE21#USESERVERCOMPONENTSB
408
+ * - $COMMENT#JSDOC#DETAILS#DIRECTIVE21#USECLIENTCOMPONENTSB
409
+ * - $COMMENT#JSDOC#DETAILS#DIRECTIVE21#USEAGNOSTICCOMPONENTSB
410
+ * - $COMMENT#JSDOC#DETAILS#DIRECTIVE21#USESERVERFUNCTIONSB
411
+ * - $COMMENT#JSDOC#DETAILS#DIRECTIVE21#USECLIENTCONTEXTSB
412
+ * - $COMMENT#JSDOC#DETAILS#DIRECTIVE21#USEAGNOSTICCONDITIONSB
413
+ * - $COMMENT#JSDOC#DETAILS#DIRECTIVE21#USEAGNOSTICSTRATEGIESB
414
+ * @param directive $COMMENT#JSDOC#PARAMS#DIRECTIVE21#DIRECTIVE
415
+ * @param extension $COMMENT#JSDOC#PARAMS#EXTENSION
416
+ * @returns $COMMENT#JSDOC#RETURNS#DIRECTIVE21#GETVERIFIEDCOMMENTEDDIRECTIVE
417
417
  */
418
418
  export const getVerifiedCommentedDirective: (
419
419
  directive:
@@ -454,10 +454,10 @@ export const getVerifiedCommentedDirective: (
454
454
  | null;
455
455
 
456
456
  /**
457
- * Gets the interpreted directive from a specified commented Strategy (such as `@serverLogics`) nested inside the import (or export) declaration for an import (or export) from an Agnostic Strategies Module.
458
- * @param context The ESLint rule's `context` object.
459
- * @param node The ESLint `node` of the rule's current traversal.
460
- * @returns The interpreted directive, a.k.a. strategized directive, or lack thereof via `null`.
457
+ * $COMMENT#JSDOC#DEFINITIONS#DIRECTIVE21#GETSTRATEGIZEDDIRECTIVE
458
+ * @param context $COMMENT#JSDOC#PARAMS#CONTEXTB
459
+ * @param node $COMMENT#JSDOC#PARAMS#NODE
460
+ * @returns $COMMENT#JSDOC#RETURNS#DIRECTIVE21#GETSTRATEGIZEDDIRECTIVE
461
461
  */
462
462
  export const getStrategizedDirective: (
463
463
  context: RuleContext<string, readonly unknown[]>,
@@ -479,10 +479,10 @@ export const getStrategizedDirective: (
479
479
  | null;
480
480
 
481
481
  /**
482
- * Returns a boolean deciding if an imported file's commented directive is incompatible with the current file's commented directive.
483
- * @param currentFileCommentedDirective The current file's commented directive.
484
- * @param importedFileCommentedDirective The imported file's commented directive.
485
- * @returns `true` if the import is blocked, as established in `commentedDirectives_BlockedImports`.
482
+ * $COMMENT#JSDOC#DEFINITIONS#DIRECTIVE21#ISIMPORTBLOCKED
483
+ * @param currentFileCommentedDirective $COMMENT#JSDOC#PARAMS#DIRECTIVE21#CURRENTFILECOMMENTEDDIRECTIVE
484
+ * @param importedFileCommentedDirective $COMMENT#JSDOC#PARAMS#DIRECTIVE21#IMPORTEDFILECOMMENTEDDIRECTIVE
485
+ * @returns $COMMENT#JSDOC#RETURNS#DIRECTIVE21#ISIMPORTBLOCKED
486
486
  */
487
487
  export const isImportBlockedDirective21: (
488
488
  currentFileCommentedDirective: