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.
- package/README.md +4 -0
- package/comments.config.js +16 -15
- package/jscomments/_commons/constants/bases.js +20 -94
- package/jscomments/agnostic20/comments.js +79 -0
- package/jscomments/agnostic20/modules-comments.js +199 -0
- package/jscomments/directive21/comments.js +105 -0
- package/jscomments/directive21/modules-comments.js +353 -0
- package/jscomments/jsdoc/alias-variables.js +6 -0
- package/jscomments/jsdoc/comments.js +331 -0
- package/jscomments/jsdoc/composed-variables.js +99 -0
- package/jscomments/tests/comments.js +27 -0
- package/library/_commons/utilities/helpers.js +21 -21
- package/library/agnostic20/_commons/constants/bases.js +64 -59
- 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 +87 -87
- package/library/directive21/_commons/utilities/flows.js +18 -18
- package/library/directive21/_commons/utilities/helpers.js +86 -86
- package/library/directive21/config.js +3 -3
- package/package.json +4 -3
- package/jscomments/agnostic20/constants/bases.js +0 -29
- package/jscomments/agnostic20/constants/modules-comments.js +0 -143
- package/jscomments/directive21/constants/bases.js +0 -38
- package/jscomments/directive21/constants/modules-comments.js +0 -228
|
@@ -31,9 +31,9 @@ import {
|
|
|
31
31
|
/* getCommentedDirectiveFromSourceCode */
|
|
32
32
|
|
|
33
33
|
/**
|
|
34
|
-
*
|
|
35
|
-
* @param {string} string
|
|
36
|
-
* @returns
|
|
34
|
+
* $COMMENT#JSDOC#DEFINITIONS#DIRECTIVE21#DETECTQUOTETYPE
|
|
35
|
+
* @param {string} string $COMMENT#JSDOC#PARAMS#DIRECTIVE21#STRING
|
|
36
|
+
* @returns $COMMENT#JSDOC#RETURNS#DIRECTIVE21#DETECTQUOTETYPE
|
|
37
37
|
*/
|
|
38
38
|
const detectQuoteType = (string) => {
|
|
39
39
|
if (string.startsWith("'") && string.endsWith("'")) {
|
|
@@ -46,9 +46,9 @@ const detectQuoteType = (string) => {
|
|
|
46
46
|
};
|
|
47
47
|
|
|
48
48
|
/**
|
|
49
|
-
*
|
|
50
|
-
* @param {string} string
|
|
51
|
-
* @returns
|
|
49
|
+
* $COMMENT#JSDOC#DEFINITIONS#DIRECTIVE21#STRIPSINGLEQUOTES
|
|
50
|
+
* @param {string} string $COMMENT#JSDOC#PARAMS#DIRECTIVE21#STRING
|
|
51
|
+
* @returns $COMMENT#JSDOC#RETURNS#DIRECTIVE21#STRIPSINGLEQUOTES
|
|
52
52
|
*/
|
|
53
53
|
const stripSingleQuotes = (string) => {
|
|
54
54
|
if (string.startsWith("'") && string.endsWith("'")) {
|
|
@@ -58,9 +58,9 @@ const stripSingleQuotes = (string) => {
|
|
|
58
58
|
};
|
|
59
59
|
|
|
60
60
|
/**
|
|
61
|
-
*
|
|
62
|
-
* @param {string} string
|
|
63
|
-
* @returns
|
|
61
|
+
* $COMMENT#JSDOC#DEFINITIONS#DIRECTIVE21#STRIPDOUBLEQUOTES
|
|
62
|
+
* @param {string} string $COMMENT#JSDOC#PARAMS#DIRECTIVE21#STRING
|
|
63
|
+
* @returns $COMMENT#JSDOC#RETURNS#DIRECTIVE21#STRIPSINGLEQUOTES
|
|
64
64
|
*/
|
|
65
65
|
const stripDoubleQuotes = (string) => {
|
|
66
66
|
if (string.startsWith('"') && string.endsWith('"')) {
|
|
@@ -70,21 +70,21 @@ const stripDoubleQuotes = (string) => {
|
|
|
70
70
|
};
|
|
71
71
|
|
|
72
72
|
/**
|
|
73
|
-
*
|
|
73
|
+
* $COMMENT#JSDOC#DEFINITIONS#DIRECTIVE21#GETCOMMENTEDDIRECTIVEFROMSOURCECODE1
|
|
74
74
|
*
|
|
75
|
-
*
|
|
76
|
-
* -
|
|
77
|
-
* -
|
|
78
|
-
* -
|
|
79
|
-
* -
|
|
80
|
-
* -
|
|
81
|
-
* -
|
|
82
|
-
* -
|
|
83
|
-
* -
|
|
84
|
-
* -
|
|
85
|
-
* -
|
|
86
|
-
* @param {SourceCode} sourceCode
|
|
87
|
-
* @returns
|
|
75
|
+
* $COMMENT#JSDOC#DEFINITIONS#DIRECTIVE21#GETCOMMENTEDDIRECTIVEFROMSOURCECODE2
|
|
76
|
+
* - $COMMENT#JSDOC#DETAILS#DIRECTIVE21#USESERVERLOGICSA
|
|
77
|
+
* - $COMMENT#JSDOC#DETAILS#DIRECTIVE21#USECLIENTLOGICSA
|
|
78
|
+
* - $COMMENT#JSDOC#DETAILS#DIRECTIVE21#USEAGNOSTICLOGICSA
|
|
79
|
+
* - $COMMENT#JSDOC#DETAILS#DIRECTIVE21#USESERVERCOMPONENTSA
|
|
80
|
+
* - $COMMENT#JSDOC#DETAILS#DIRECTIVE21#USECLIENTCOMPONENTSA
|
|
81
|
+
* - $COMMENT#JSDOC#DETAILS#DIRECTIVE21#USEAGNOSTICCOMPONENTSA
|
|
82
|
+
* - $COMMENT#JSDOC#DETAILS#DIRECTIVE21#USESERVERFUNCTIONSA
|
|
83
|
+
* - $COMMENT#JSDOC#DETAILS#DIRECTIVE21#USECLIENTCONTEXTSA
|
|
84
|
+
* - $COMMENT#JSDOC#DETAILS#DIRECTIVE21#USEAGNOSTICCONDITIONSA
|
|
85
|
+
* - $COMMENT#JSDOC#DETAILS#DIRECTIVE21#USEAGNOSTICSTRATEGIESA
|
|
86
|
+
* @param {SourceCode} sourceCode $COMMENT#JSDOC#PARAMS#DIRECTIVE21#SOURCECODE
|
|
87
|
+
* @returns $COMMENT#JSDOC#RETURNS#DIRECTIVE21#GETCOMMENTEDDIRECTIVEFROMSOURCECODE
|
|
88
88
|
*/
|
|
89
89
|
export const getCommentedDirectiveFromSourceCode = (sourceCode) => {
|
|
90
90
|
// gets the first comment from the source code
|
|
@@ -128,21 +128,21 @@ export const getCommentedDirectiveFromSourceCode = (sourceCode) => {
|
|
|
128
128
|
/* getCommentedDirectiveFromCurrentModule */
|
|
129
129
|
|
|
130
130
|
/**
|
|
131
|
-
*
|
|
131
|
+
* $COMMENT#JSDOC#DEFINITIONS#DIRECTIVE21#GETCOMMENTEDDIRECTIVEFROMCURRENTMODULE1
|
|
132
132
|
*
|
|
133
|
-
*
|
|
134
|
-
* -
|
|
135
|
-
* -
|
|
136
|
-
* -
|
|
137
|
-
* -
|
|
138
|
-
* -
|
|
139
|
-
* -
|
|
140
|
-
* -
|
|
141
|
-
* -
|
|
142
|
-
* -
|
|
143
|
-
* -
|
|
144
|
-
* @param {Context} context
|
|
145
|
-
* @returns
|
|
133
|
+
* $COMMENT#JSDOC#DEFINITIONS#DIRECTIVE21#GETCOMMENTEDDIRECTIVEFROMSOURCECODE2
|
|
134
|
+
* - $COMMENT#JSDOC#DETAILS#DIRECTIVE21#USESERVERLOGICSA
|
|
135
|
+
* - $COMMENT#JSDOC#DETAILS#DIRECTIVE21#USECLIENTLOGICSA
|
|
136
|
+
* - $COMMENT#JSDOC#DETAILS#DIRECTIVE21#USEAGNOSTICLOGICSA
|
|
137
|
+
* - $COMMENT#JSDOC#DETAILS#DIRECTIVE21#USESERVERCOMPONENTSA
|
|
138
|
+
* - $COMMENT#JSDOC#DETAILS#DIRECTIVE21#USECLIENTCOMPONENTSA
|
|
139
|
+
* - $COMMENT#JSDOC#DETAILS#DIRECTIVE21#USEAGNOSTICCOMPONENTSA
|
|
140
|
+
* - $COMMENT#JSDOC#DETAILS#DIRECTIVE21#USESERVERFUNCTIONSA
|
|
141
|
+
* - $COMMENT#JSDOC#DETAILS#DIRECTIVE21#USECLIENTCONTEXTSA
|
|
142
|
+
* - $COMMENT#JSDOC#DETAILS#DIRECTIVE21#USEAGNOSTICCONDITIONSA
|
|
143
|
+
* - $COMMENT#JSDOC#DETAILS#DIRECTIVE21#USEAGNOSTICSTRATEGIESA
|
|
144
|
+
* @param {Context} context $COMMENT#JSDOC#PARAMS#CONTEXTB
|
|
145
|
+
* @returns $COMMENT#JSDOC#RETURNS#DIRECTIVE21#GETCOMMENTEDDIRECTIVEFROMSOURCECODE
|
|
146
146
|
*/
|
|
147
147
|
export const getCommentedDirectiveFromCurrentModule = (context) => {
|
|
148
148
|
const sourceCode = context.sourceCode;
|
|
@@ -154,21 +154,21 @@ export const getCommentedDirectiveFromCurrentModule = (context) => {
|
|
|
154
154
|
/* getCommentedDirectiveFromImportedModule */
|
|
155
155
|
|
|
156
156
|
/**
|
|
157
|
-
*
|
|
157
|
+
* $COMMENT#JSDOC#DEFINITIONS#DIRECTIVE21#GETCOMMENTEDDIRECTIVEFROMIMPORTEDMODULE1
|
|
158
158
|
*
|
|
159
|
-
*
|
|
160
|
-
* -
|
|
161
|
-
* -
|
|
162
|
-
* -
|
|
163
|
-
* -
|
|
164
|
-
* -
|
|
165
|
-
* -
|
|
166
|
-
* -
|
|
167
|
-
* -
|
|
168
|
-
* -
|
|
169
|
-
* -
|
|
170
|
-
* @param {string} resolvedPath
|
|
171
|
-
* @returns
|
|
159
|
+
* $COMMENT#JSDOC#DEFINITIONS#DIRECTIVE21#GETCOMMENTEDDIRECTIVEFROMSOURCECODE2
|
|
160
|
+
* - $COMMENT#JSDOC#DETAILS#DIRECTIVE21#USESERVERLOGICSA
|
|
161
|
+
* - $COMMENT#JSDOC#DETAILS#DIRECTIVE21#USECLIENTLOGICSA
|
|
162
|
+
* - $COMMENT#JSDOC#DETAILS#DIRECTIVE21#USEAGNOSTICLOGICSA
|
|
163
|
+
* - $COMMENT#JSDOC#DETAILS#DIRECTIVE21#USESERVERCOMPONENTSA
|
|
164
|
+
* - $COMMENT#JSDOC#DETAILS#DIRECTIVE21#USECLIENTCOMPONENTSA
|
|
165
|
+
* - $COMMENT#JSDOC#DETAILS#DIRECTIVE21#USEAGNOSTICCOMPONENTSA
|
|
166
|
+
* - $COMMENT#JSDOC#DETAILS#DIRECTIVE21#USESERVERFUNCTIONSA
|
|
167
|
+
* - $COMMENT#JSDOC#DETAILS#DIRECTIVE21#USECLIENTCONTEXTSA
|
|
168
|
+
* - $COMMENT#JSDOC#DETAILS#DIRECTIVE21#USEAGNOSTICCONDITIONSA
|
|
169
|
+
* - $COMMENT#JSDOC#DETAILS#DIRECTIVE21#USEAGNOSTICSTRATEGIESA
|
|
170
|
+
* @param {string} resolvedPath $COMMENT#JSDOC#PARAMS#RESOLVEDPATH
|
|
171
|
+
* @returns $COMMENT#JSDOC#RETURNS#DIRECTIVE21#GETCOMMENTEDDIRECTIVEFROMSOURCECODE
|
|
172
172
|
*/
|
|
173
173
|
export const getCommentedDirectiveFromImportedModule = (resolvedPath) => {
|
|
174
174
|
const sourceCode = getSourceCodeFromFilePath(resolvedPath);
|
|
@@ -180,20 +180,20 @@ export const getCommentedDirectiveFromImportedModule = (resolvedPath) => {
|
|
|
180
180
|
/* getVerifiedCommentedDirective */
|
|
181
181
|
|
|
182
182
|
/**
|
|
183
|
-
*
|
|
184
|
-
* -
|
|
185
|
-
* -
|
|
186
|
-
* -
|
|
187
|
-
* -
|
|
188
|
-
* -
|
|
189
|
-
* -
|
|
190
|
-
* -
|
|
191
|
-
* -
|
|
192
|
-
* -
|
|
193
|
-
* -
|
|
194
|
-
* @param {CommentedDirective} directive
|
|
195
|
-
* @param {Extension} extension
|
|
196
|
-
* @returns
|
|
183
|
+
* $COMMENT#JSDOC#DEFINITIONS#DIRECTIVE21#GETVERIFIEDCOMMENTEDDIRECTIVE
|
|
184
|
+
* - $COMMENT#JSDOC#DETAILS#DIRECTIVE21#USESERVERLOGICSB
|
|
185
|
+
* - $COMMENT#JSDOC#DETAILS#DIRECTIVE21#USECLIENTLOGICSB
|
|
186
|
+
* - $COMMENT#JSDOC#DETAILS#DIRECTIVE21#USEAGNOSTICLOGICSB
|
|
187
|
+
* - $COMMENT#JSDOC#DETAILS#DIRECTIVE21#USESERVERCOMPONENTSB
|
|
188
|
+
* - $COMMENT#JSDOC#DETAILS#DIRECTIVE21#USECLIENTCOMPONENTSB
|
|
189
|
+
* - $COMMENT#JSDOC#DETAILS#DIRECTIVE21#USEAGNOSTICCOMPONENTSB
|
|
190
|
+
* - $COMMENT#JSDOC#DETAILS#DIRECTIVE21#USESERVERFUNCTIONSB
|
|
191
|
+
* - $COMMENT#JSDOC#DETAILS#DIRECTIVE21#USECLIENTCONTEXTSB
|
|
192
|
+
* - $COMMENT#JSDOC#DETAILS#DIRECTIVE21#USEAGNOSTICCONDITIONSB
|
|
193
|
+
* - $COMMENT#JSDOC#DETAILS#DIRECTIVE21#USEAGNOSTICSTRATEGIESB
|
|
194
|
+
* @param {CommentedDirective} directive $COMMENT#JSDOC#PARAMS#DIRECTIVE21#DIRECTIVE
|
|
195
|
+
* @param {Extension} extension $COMMENT#JSDOC#PARAMS#EXTENSION
|
|
196
|
+
* @returns $COMMENT#JSDOC#RETURNS#DIRECTIVE21#GETVERIFIEDCOMMENTEDDIRECTIVE
|
|
197
197
|
*/
|
|
198
198
|
export const getVerifiedCommentedDirective = (directive, extension) => {
|
|
199
199
|
const rule = commentedDirectives_extensionRules[directive];
|
|
@@ -209,10 +209,10 @@ export const getVerifiedCommentedDirective = (directive, extension) => {
|
|
|
209
209
|
/* getStrategizedDirective */
|
|
210
210
|
|
|
211
211
|
/**
|
|
212
|
-
*
|
|
213
|
-
* @param {Context} context
|
|
214
|
-
* @param {ImportDeclaration} node
|
|
215
|
-
* @returns
|
|
212
|
+
* $COMMENT#JSDOC#DEFINITIONS#DIRECTIVE21#GETSTRATEGIZEDDIRECTIVE
|
|
213
|
+
* @param {Context} context $COMMENT#JSDOC#PARAMS#CONTEXTB
|
|
214
|
+
* @param {ImportDeclaration} node $COMMENT#JSDOC#PARAMS#NODE
|
|
215
|
+
* @returns $COMMENT#JSDOC#RETURNS#DIRECTIVE21#GETSTRATEGIZEDDIRECTIVE
|
|
216
216
|
*/
|
|
217
217
|
export const getStrategizedDirective = (context, node) => {
|
|
218
218
|
// gets the first nested `/* */` comment inside the node
|
|
@@ -240,18 +240,18 @@ export const getStrategizedDirective = (context, node) => {
|
|
|
240
240
|
/* addressDirectiveIfAgnosticStrategies */
|
|
241
241
|
|
|
242
242
|
/**
|
|
243
|
-
*
|
|
244
|
-
* @param {Context} context
|
|
245
|
-
* @param {ExportNamedDeclaration | ExportAllDeclaration | ExportDefaultDeclaration} node
|
|
246
|
-
* @param {CommentedDirective} currentFileCommentedDirective
|
|
247
|
-
* @returns
|
|
243
|
+
* $COMMENT#JSDOC#DEFINITIONS#DIRECTIVE21#ADDRESSDIRECTIVEIFAGNOSTICSTRATEGIES
|
|
244
|
+
* @param {Context} context $COMMENT#JSDOC#PARAMS#CONTEXTB
|
|
245
|
+
* @param {ExportNamedDeclaration | ExportAllDeclaration | ExportDefaultDeclaration} node $COMMENT#JSDOC#PARAMS#NODE
|
|
246
|
+
* @param {CommentedDirective} currentFileCommentedDirective $COMMENT#JSDOC#PARAMS#DIRECTIVE21#CURRENTFILECOMMENTEDDIRECTIVE
|
|
247
|
+
* @returns $COMMENT#JSDOC#RETURNS#DIRECTIVE21#ADDRESSDIRECTIVEIFAGNOSTICSTRATEGIES
|
|
248
248
|
*/
|
|
249
249
|
export const addressDirectiveIfAgnosticStrategies = (
|
|
250
250
|
context,
|
|
251
251
|
node,
|
|
252
252
|
currentFileCommentedDirective
|
|
253
253
|
) => {
|
|
254
|
-
// ignores if not addressing an Agnostic Strategies
|
|
254
|
+
// ignores if not addressing an Agnostic Strategies $COMMENT#TESTS#FORCOMPOSEDVARIABLES#MODULE
|
|
255
255
|
if (currentFileCommentedDirective !== USE_AGNOSTIC_STRATEGIES)
|
|
256
256
|
return currentFileCommentedDirective;
|
|
257
257
|
|
|
@@ -270,10 +270,10 @@ export const addressDirectiveIfAgnosticStrategies = (
|
|
|
270
270
|
/* isImportBlocked */
|
|
271
271
|
|
|
272
272
|
/**
|
|
273
|
-
*
|
|
274
|
-
* @param {CommentedDirectiveWithoutUseAgnosticStrategies} currentFileCommentedDirective
|
|
275
|
-
* @param {CommentedDirectiveWithoutUseAgnosticStrategies} importedFileCommentedDirective
|
|
276
|
-
* @returns
|
|
273
|
+
* $COMMENT#JSDOC#DEFINITIONS#DIRECTIVE21#ISIMPORTBLOCKED
|
|
274
|
+
* @param {CommentedDirectiveWithoutUseAgnosticStrategies} currentFileCommentedDirective $COMMENT#JSDOC#PARAMS#DIRECTIVE21#CURRENTFILECOMMENTEDDIRECTIVE
|
|
275
|
+
* @param {CommentedDirectiveWithoutUseAgnosticStrategies} importedFileCommentedDirective $COMMENT#JSDOC#PARAMS#DIRECTIVE21#IMPORTEDFILECOMMENTEDDIRECTIVE
|
|
276
|
+
* @returns $COMMENT#JSDOC#RETURNS#DIRECTIVE21#ISIMPORTBLOCKED
|
|
277
277
|
*/
|
|
278
278
|
export const isImportBlocked = (
|
|
279
279
|
currentFileCommentedDirective,
|
|
@@ -288,9 +288,9 @@ export const isImportBlocked = (
|
|
|
288
288
|
/* makeMessageFromCurrentFileCommentedDirective */
|
|
289
289
|
|
|
290
290
|
/**
|
|
291
|
-
*
|
|
292
|
-
* @param {CommentedDirectiveWithoutUseAgnosticStrategies} commentedDirective
|
|
293
|
-
* @returns
|
|
291
|
+
* $COMMENT#JSDOC#DEFINITIONS#DIRECTIVE21#MAKEMESSAGEFROMCURRENTFILECOMMENTEDDIRECTIVE
|
|
292
|
+
* @param {CommentedDirectiveWithoutUseAgnosticStrategies} commentedDirective $COMMENT#JSDOC#PARAMS#DIRECTIVE21#COMMENTEDDIRECTIVE
|
|
293
|
+
* @returns $COMMENT#JSDOC#RETURNS#DIRECTIVE21#MAKEMESSAGEFROMCURRENTFILECOMMENTEDDIRECTIVE
|
|
294
294
|
*/
|
|
295
295
|
export const makeMessageFromCurrentFileCommentedDirective = (
|
|
296
296
|
commentedDirective
|
|
@@ -303,10 +303,10 @@ export const makeMessageFromCurrentFileCommentedDirective = (
|
|
|
303
303
|
/* findSpecificViolationMessage */
|
|
304
304
|
|
|
305
305
|
/**
|
|
306
|
-
*
|
|
307
|
-
* @param {CommentedDirectiveWithoutUseAgnosticStrategies} currentFileCommentedDirective
|
|
308
|
-
* @param {CommentedDirectiveWithoutUseAgnosticStrategies} importedFileCommentedDirective
|
|
309
|
-
* @returns
|
|
306
|
+
* $COMMENT#JSDOC#DEFINITIONS#DIRECTIVE21#FINDSPECIFICVIOLATIONMESSAGE
|
|
307
|
+
* @param {CommentedDirectiveWithoutUseAgnosticStrategies} currentFileCommentedDirective $COMMENT#JSDOC#PARAMS#DIRECTIVE21#CURRENTFILECOMMENTEDDIRECTIVE
|
|
308
|
+
* @param {CommentedDirectiveWithoutUseAgnosticStrategies} importedFileCommentedDirective $COMMENT#JSDOC#PARAMS#DIRECTIVE21#IMPORTEDFILECOMMENTEDDIRECTIVE
|
|
309
|
+
* @returns $COMMENT#JSDOC#RETURNS#FINDSPECIFICVIOLATIONMESSAGE
|
|
310
310
|
*/
|
|
311
311
|
export const findSpecificViolationMessage = (
|
|
312
312
|
currentFileCommentedDirective,
|
|
@@ -12,9 +12,9 @@ import {
|
|
|
12
12
|
*/
|
|
13
13
|
|
|
14
14
|
/**
|
|
15
|
-
*
|
|
16
|
-
* @param {Plugin} plugin
|
|
17
|
-
* @returns
|
|
15
|
+
* $COMMENT#JSDOC#DEFINITIONS#DIRECTIVE21#MAKEDIRECTIVE21CONFIG
|
|
16
|
+
* @param {Plugin} plugin $COMMENT#JSDOC#PARAMS#PLUGIN
|
|
17
|
+
* @returns $COMMENT#JSDOC#RETURNS#DIRECTIVE21#MAKEDIRECTIVE21CONFIG
|
|
18
18
|
*/
|
|
19
19
|
export const makeDirective21Config = (plugin) => ({
|
|
20
20
|
[directive21ConfigName]: defineConfig([
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "eslint-plugin-use-agnostic",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.3.0",
|
|
4
4
|
"description": "Highlights problematic server-client imports in projects made with the Fullstack React Architecture.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"eslint",
|
|
@@ -41,8 +41,9 @@
|
|
|
41
41
|
"test": "node tests/agnostic20/import-rules.test.js && node tests/directive21/import-rules.test.js"
|
|
42
42
|
},
|
|
43
43
|
"dependencies": {
|
|
44
|
-
"
|
|
45
|
-
"
|
|
44
|
+
"comment-variables-resolve-config": "^1.9.0",
|
|
45
|
+
"get-sourcecode-from-file-path": "^1.1.2",
|
|
46
|
+
"resolve-importing-path": "^1.0.3",
|
|
46
47
|
"tsconfig-paths": "^4.2.0",
|
|
47
48
|
"typescript-eslint": "^8.32.0"
|
|
48
49
|
},
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
serverLogicsComments,
|
|
3
|
-
serverComponentsComments,
|
|
4
|
-
serverFunctionsComments,
|
|
5
|
-
clientLogicsComments,
|
|
6
|
-
clientComponentsComments,
|
|
7
|
-
agnosticLogicsComments,
|
|
8
|
-
agnosticComponentsComments,
|
|
9
|
-
} from "./modules-comments.js";
|
|
10
|
-
|
|
11
|
-
import {
|
|
12
|
-
USE_SERVER_LOGICS,
|
|
13
|
-
USE_CLIENT_LOGICS,
|
|
14
|
-
USE_AGNOSTIC_LOGICS,
|
|
15
|
-
USE_SERVER_COMPONENTS,
|
|
16
|
-
USE_CLIENT_COMPONENTS,
|
|
17
|
-
USE_AGNOSTIC_COMPONENTS,
|
|
18
|
-
USE_SERVER_FUNCTIONS,
|
|
19
|
-
} from "../../../library/_commons/constants/bases.js";
|
|
20
|
-
|
|
21
|
-
export const agnostic20Comments = Object.freeze({
|
|
22
|
-
[USE_SERVER_LOGICS]: serverLogicsComments,
|
|
23
|
-
[USE_SERVER_COMPONENTS]: serverComponentsComments,
|
|
24
|
-
[USE_SERVER_FUNCTIONS]: serverFunctionsComments,
|
|
25
|
-
[USE_CLIENT_LOGICS]: clientLogicsComments,
|
|
26
|
-
[USE_CLIENT_COMPONENTS]: clientComponentsComments,
|
|
27
|
-
[USE_AGNOSTIC_LOGICS]: agnosticLogicsComments,
|
|
28
|
-
[USE_AGNOSTIC_COMPONENTS]: agnosticComponentsComments,
|
|
29
|
-
});
|
|
@@ -1,143 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
USE_SERVER_LOGICS,
|
|
3
|
-
USE_CLIENT_LOGICS,
|
|
4
|
-
USE_AGNOSTIC_LOGICS,
|
|
5
|
-
USE_SERVER_COMPONENTS,
|
|
6
|
-
USE_CLIENT_COMPONENTS,
|
|
7
|
-
USE_AGNOSTIC_COMPONENTS,
|
|
8
|
-
USE_SERVER_FUNCTIONS,
|
|
9
|
-
} from "../../../library/_commons/constants/bases.js";
|
|
10
|
-
|
|
11
|
-
export const serverLogicsComments = Object.freeze({
|
|
12
|
-
// $COMMENT#AGNOSTIC20#USE_SERVER_LOGICS#USE_SERVER_LOGICS
|
|
13
|
-
[USE_SERVER_LOGICS]:
|
|
14
|
-
/* valid */ "Server Logics can compose with one another.",
|
|
15
|
-
[USE_SERVER_COMPONENTS]:
|
|
16
|
-
/* valid */ "Server Components are OK to be composed with Server Logics as long as the Server Logics Module, by convention, does not export React components.",
|
|
17
|
-
[USE_SERVER_FUNCTIONS]:
|
|
18
|
-
/* valid */ "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.)",
|
|
19
|
-
[USE_CLIENT_LOGICS]:
|
|
20
|
-
/* invalid */ "Client Logics should never leak to the server, such as would be the case here in a Server Logics Module.",
|
|
21
|
-
[USE_CLIENT_COMPONENTS]:
|
|
22
|
-
/* invalid */ "Client Components cannot be tinkered with on the server.",
|
|
23
|
-
[USE_AGNOSTIC_LOGICS]:
|
|
24
|
-
/* valid */ "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.",
|
|
25
|
-
[USE_AGNOSTIC_COMPONENTS]:
|
|
26
|
-
/* valid */ "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.",
|
|
27
|
-
module: "Server Logics Module",
|
|
28
|
-
modulePeriod: "Server Logics Module.",
|
|
29
|
-
});
|
|
30
|
-
|
|
31
|
-
export const serverComponentsComments = Object.freeze({
|
|
32
|
-
[USE_SERVER_LOGICS]:
|
|
33
|
-
/* valid */ "Server Logics, being logic from the server, can safely support Server Components.",
|
|
34
|
-
[USE_SERVER_COMPONENTS]:
|
|
35
|
-
/* valid */ "Server Components can compose with one another, assuming thanks to the inclusion of the 'use agnostic' directive that they are actual Server Components.",
|
|
36
|
-
[USE_SERVER_FUNCTIONS]:
|
|
37
|
-
/* valid */ "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.",
|
|
38
|
-
[USE_CLIENT_LOGICS]:
|
|
39
|
-
/* invalid */ "Client Logics should never leak to the server, such as would be the case here in a Server Components Module.",
|
|
40
|
-
[USE_CLIENT_COMPONENTS]:
|
|
41
|
-
/* valid */ "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.",
|
|
42
|
-
[USE_AGNOSTIC_LOGICS]:
|
|
43
|
-
/* valid */ "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.",
|
|
44
|
-
[USE_AGNOSTIC_COMPONENTS]:
|
|
45
|
-
/* valid */ "Agnostic Components can render safely on the server just like they can on the client.",
|
|
46
|
-
module: "Server Components Module",
|
|
47
|
-
modulePeriod: "Server Components Module.",
|
|
48
|
-
});
|
|
49
|
-
|
|
50
|
-
export const serverFunctionsComments = Object.freeze({
|
|
51
|
-
[USE_SERVER_LOGICS]:
|
|
52
|
-
/* valid */ "Server Logics, being logic from the server, can safely support Server Functions.",
|
|
53
|
-
[USE_SERVER_COMPONENTS]:
|
|
54
|
-
/* invalid */ "Server Components aren't allowed because Server Functions have no business working with React Components.",
|
|
55
|
-
[USE_SERVER_FUNCTIONS]:
|
|
56
|
-
/* valid */ "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.)",
|
|
57
|
-
[USE_CLIENT_LOGICS]:
|
|
58
|
-
/* invalid */ "Client Logics should never leak to the server, such as would be the case here in a Server Functions Module.",
|
|
59
|
-
[USE_CLIENT_COMPONENTS]:
|
|
60
|
-
/* invalid */ "Client Components aren't allowed because Server Functions have no business working with React Components.",
|
|
61
|
-
[USE_AGNOSTIC_LOGICS]:
|
|
62
|
-
/* valid */ "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.",
|
|
63
|
-
[USE_AGNOSTIC_COMPONENTS]:
|
|
64
|
-
/* invalid */ "Agnostic Components aren't allowed because Server Functions have no business working with React Components.",
|
|
65
|
-
module: "Server Functions Module",
|
|
66
|
-
modulePeriod: "Server Functions Module.",
|
|
67
|
-
});
|
|
68
|
-
|
|
69
|
-
export const clientLogicsComments = Object.freeze({
|
|
70
|
-
[USE_SERVER_LOGICS]:
|
|
71
|
-
/* invalid */ "Server Logics should never leak to the client, such as would be the case here in a Client Logics Module.",
|
|
72
|
-
[USE_SERVER_COMPONENTS]:
|
|
73
|
-
/* invalid */ "Server Components cannot be thinkered with on the client.",
|
|
74
|
-
[USE_SERVER_FUNCTIONS]:
|
|
75
|
-
/* valid */ "Server Functions can technically be attached to Client Components that are being tinkered with within Client Logics Modules.",
|
|
76
|
-
[USE_CLIENT_LOGICS]:
|
|
77
|
-
/* valid */ "Client Logics can compose with one another.",
|
|
78
|
-
[USE_CLIENT_COMPONENTS]:
|
|
79
|
-
/* valid */ "Client Components are OK to be composed with Client Logics as long as the Client Logics Module, by convention, does not export React components.",
|
|
80
|
-
[USE_AGNOSTIC_LOGICS]:
|
|
81
|
-
/* valid */ "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.",
|
|
82
|
-
[USE_AGNOSTIC_COMPONENTS]:
|
|
83
|
-
/* valid */ "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.",
|
|
84
|
-
module: "Client Logics Module",
|
|
85
|
-
modulePeriod: "Client Logics Module.",
|
|
86
|
-
});
|
|
87
|
-
|
|
88
|
-
export const clientComponentsComments = Object.freeze({
|
|
89
|
-
[USE_SERVER_LOGICS]:
|
|
90
|
-
/* invalid */ "Server Logics should never leak to the client, such as would be the case here in a Client Components Module.",
|
|
91
|
-
[USE_SERVER_COMPONENTS]:
|
|
92
|
-
/* invalid */ "Server Components may only pass through Client Components via the children prop within Server Components Modules.",
|
|
93
|
-
[USE_SERVER_FUNCTIONS]:
|
|
94
|
-
/* valid */ "Server Functions are specifically triggered by Client Components.",
|
|
95
|
-
[USE_CLIENT_LOGICS]:
|
|
96
|
-
/* valid */ "Client Logics, being logic from the client, can safely support Client Components.",
|
|
97
|
-
[USE_CLIENT_COMPONENTS]:
|
|
98
|
-
/* valid */ "Client Components can compose with one another.",
|
|
99
|
-
[USE_AGNOSTIC_LOGICS]:
|
|
100
|
-
/* valid */ "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.",
|
|
101
|
-
[USE_AGNOSTIC_COMPONENTS]:
|
|
102
|
-
/* valid */ "Agnostic Components can render safely on the client just like they can on the server.",
|
|
103
|
-
module: "Client Components Module",
|
|
104
|
-
modulePeriod: "Client Components Module.",
|
|
105
|
-
});
|
|
106
|
-
|
|
107
|
-
export const agnosticLogicsComments = Object.freeze({
|
|
108
|
-
[USE_SERVER_LOGICS]:
|
|
109
|
-
/* invalid */ "Server Logics cannot run on both the server and the client, such as would be the case here in an Agnostic Logics Module.",
|
|
110
|
-
[USE_SERVER_COMPONENTS]:
|
|
111
|
-
/* invalid */ "Server Components cannot be tinkered with on both the server and the client.",
|
|
112
|
-
[USE_SERVER_FUNCTIONS]:
|
|
113
|
-
/* invalid */ "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.",
|
|
114
|
-
[USE_CLIENT_LOGICS]:
|
|
115
|
-
/* invalid */ "Client Logics cannot run on both the server and the client, such as would be the case here in an Agnostic Logics Module.",
|
|
116
|
-
[USE_CLIENT_COMPONENTS]:
|
|
117
|
-
/* invalid */ "Client Components cannot be tinkered with on both the server and the client.",
|
|
118
|
-
[USE_AGNOSTIC_LOGICS]:
|
|
119
|
-
/* valid */ "Agnostic Logics can compose with one another.",
|
|
120
|
-
[USE_AGNOSTIC_COMPONENTS]:
|
|
121
|
-
/* valid */ "Agnostic Components can be composed with Logics agnostically as long as the Agnostic Logics Module, by convention, does not export React components.",
|
|
122
|
-
module: "Agnostic Logics Module",
|
|
123
|
-
modulePeriod: "Agnostic Logics Module.",
|
|
124
|
-
});
|
|
125
|
-
|
|
126
|
-
export const agnosticComponentsComments = Object.freeze({
|
|
127
|
-
[USE_SERVER_LOGICS]:
|
|
128
|
-
/* invalid */ "Server Logics cannot run on both the server and the client, such as would be the case here in an Agnostic Components Module.",
|
|
129
|
-
[USE_SERVER_COMPONENTS]:
|
|
130
|
-
/* invalid */ "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.",
|
|
131
|
-
[USE_SERVER_FUNCTIONS]:
|
|
132
|
-
/* valid */ "Server Functions can be passed to Client Components as props when Client Components are also legally imported into Agnostic Components Modules.",
|
|
133
|
-
[USE_CLIENT_LOGICS]:
|
|
134
|
-
/* invalid */ "Client Logics cannot run on both the server and the client, such as would be the case here in an Agnostic Components Module.",
|
|
135
|
-
[USE_CLIENT_COMPONENTS]:
|
|
136
|
-
/* valid */ "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.",
|
|
137
|
-
[USE_AGNOSTIC_LOGICS]:
|
|
138
|
-
/* valid */ "Agnostic Logics, being environment-agnostic logic, can safely support Agnostic Components.",
|
|
139
|
-
[USE_AGNOSTIC_COMPONENTS]:
|
|
140
|
-
/* valid */ "Agnostic Components can compose with one another.",
|
|
141
|
-
module: "Agnostic Components Module",
|
|
142
|
-
modulePeriod: "Agnostic Components Module.",
|
|
143
|
-
});
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
serverLogicsComments,
|
|
3
|
-
clientLogicsComments,
|
|
4
|
-
agnosticLogicsComments,
|
|
5
|
-
serverComponentsComments,
|
|
6
|
-
clientComponentsComments,
|
|
7
|
-
agnosticComponentsComments,
|
|
8
|
-
serverFunctionsComments,
|
|
9
|
-
clientContextsComments,
|
|
10
|
-
agnosticConditionsComments,
|
|
11
|
-
} from "./modules-comments.js";
|
|
12
|
-
|
|
13
|
-
import {
|
|
14
|
-
USE_SERVER_LOGICS,
|
|
15
|
-
USE_CLIENT_LOGICS,
|
|
16
|
-
USE_AGNOSTIC_LOGICS,
|
|
17
|
-
USE_SERVER_COMPONENTS,
|
|
18
|
-
USE_CLIENT_COMPONENTS,
|
|
19
|
-
USE_AGNOSTIC_COMPONENTS,
|
|
20
|
-
USE_SERVER_FUNCTIONS,
|
|
21
|
-
USE_CLIENT_CONTEXTS,
|
|
22
|
-
USE_AGNOSTIC_CONDITIONS,
|
|
23
|
-
USE_AGNOSTIC_STRATEGIES,
|
|
24
|
-
} from "../../../library/_commons/constants/bases.js";
|
|
25
|
-
|
|
26
|
-
export const directive21Comments = Object.freeze({
|
|
27
|
-
[USE_SERVER_LOGICS]: serverLogicsComments,
|
|
28
|
-
[USE_CLIENT_LOGICS]: clientLogicsComments,
|
|
29
|
-
[USE_AGNOSTIC_LOGICS]: agnosticLogicsComments,
|
|
30
|
-
[USE_SERVER_COMPONENTS]: serverComponentsComments,
|
|
31
|
-
[USE_CLIENT_COMPONENTS]: clientComponentsComments,
|
|
32
|
-
[USE_AGNOSTIC_COMPONENTS]: agnosticComponentsComments,
|
|
33
|
-
[USE_SERVER_FUNCTIONS]: serverFunctionsComments,
|
|
34
|
-
[USE_CLIENT_CONTEXTS]: clientContextsComments,
|
|
35
|
-
[USE_AGNOSTIC_CONDITIONS]: agnosticConditionsComments,
|
|
36
|
-
[USE_AGNOSTIC_STRATEGIES]:
|
|
37
|
-
/* valid */ "(Special) Agnostic Strategies Modules can import all known modules, except themselves since they cannot be imported as they are, only as and via Strategies. (Since Agnostic Strategies Modules cannot be imported as they are, there is no such things as a 'use agnostic strategies' importFileCommentedDirective.)",
|
|
38
|
-
});
|