eslint-plugin-use-agnostic 2.0.2 → 2.0.4
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/library/_commons/utilities/helpers.js +24 -24
- package/library/_commons/utilities/walk-ast.js +8 -8
- package/library/agnostic20/_commons/constants/bases.js +57 -57
- package/library/agnostic20/_commons/utilities/flows.js +26 -26
- package/library/agnostic20/_commons/utilities/helpers.js +43 -43
- package/library/agnostic20/config.js +3 -3
- package/library/directive21/_commons/constants/bases.js +105 -117
- package/library/directive21/_commons/rules/import-rules.js +58 -4
- package/library/directive21/_commons/utilities/analyze-exports-re.js +3 -3
- package/library/directive21/_commons/utilities/flows.js +51 -51
- package/library/directive21/_commons/utilities/helpers.js +85 -85
- package/library/directive21/config.js +3 -3
- package/library/index.js +8 -8
- package/package.json +4 -3
- package/types/index.d.ts +114 -114
|
@@ -133,9 +133,9 @@ export const fileIsRegularJavaScript = (filePath) =>
|
|
|
133
133
|
//
|
|
134
134
|
|
|
135
135
|
/**
|
|
136
|
-
*
|
|
137
|
-
* @param {Context} context
|
|
138
|
-
* @returns
|
|
136
|
+
* $COMMENT#JSDOC#DEFINITIONS#DIRECTIVE21#CURRENTFILEFLOW
|
|
137
|
+
* @param {Context} context $COMMENT#JSDOC#PARAMS#CONTEXTB
|
|
138
|
+
* @returns $COMMENT#JSDOC#RETURNS#DIRECTIVE21#CURRENTFILEFLOW
|
|
139
139
|
*/
|
|
140
140
|
export const currentFileFlow = (context) => {
|
|
141
141
|
const skipTrue = { ...skip, verifiedCommentedDirective: undefined };
|
|
@@ -231,10 +231,10 @@ export const currentFileFlow = (context) => {
|
|
|
231
231
|
/* importedFileFlow */
|
|
232
232
|
|
|
233
233
|
/**
|
|
234
|
-
*
|
|
235
|
-
* @param {Context} context
|
|
236
|
-
* @param {ImportDeclaration} node
|
|
237
|
-
* @returns
|
|
234
|
+
* $COMMENT#JSDOC#DEFINITIONS#DIRECTIVE21#IMPORTEDFILEFLOW
|
|
235
|
+
* @param {Context} context $COMMENT#JSDOC#PARAMS#CONTEXTB
|
|
236
|
+
* @param {ImportDeclaration} node $COMMENT#JSDOC#PARAMS#NODE
|
|
237
|
+
* @returns $COMMENT#JSDOC#RETURNS#DIRECTIVE21#IMPORTEDFILEFLOW
|
|
238
238
|
*/
|
|
239
239
|
const importedFileFlow = (context, node) => {
|
|
240
240
|
const skipTrue = {
|
|
@@ -271,7 +271,7 @@ const importedFileFlow = (context, node) => {
|
|
|
271
271
|
// 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.
|
|
272
272
|
|
|
273
273
|
// console.warn(
|
|
274
|
-
// `WARNING. The imported file ${resolvedImportPath}, whose path has been resolved from ${context.filename}, has no commented
|
|
274
|
+
// `WARNING. The imported file ${resolvedImportPath}, whose path has been resolved from ${context.filename}, has no commented $COMMENT#JSDOC#FORCOMPOSEDVARIABLES#DIRECTIVEPERIOD It is thus ignored since the report on that circumstance would be available on the imported file itself.`
|
|
275
275
|
// ); // The decision not to report has been taken to not inflate the number of warnings.
|
|
276
276
|
return skipTrue;
|
|
277
277
|
}
|
|
@@ -333,10 +333,10 @@ const importedFileFlow = (context, node) => {
|
|
|
333
333
|
|
|
334
334
|
// NEW!! Currently strictly adapted from importedFileFlow
|
|
335
335
|
/**
|
|
336
|
-
*
|
|
337
|
-
* @param {Context} context
|
|
338
|
-
* @param {CallExpression} node
|
|
339
|
-
* @returns
|
|
336
|
+
* $COMMENT#JSDOC#DEFINITIONS#DIRECTIVE21#IMPORTEDFILEFLOWREQUIRE
|
|
337
|
+
* @param {Context} context $COMMENT#JSDOC#PARAMS#CONTEXTB
|
|
338
|
+
* @param {CallExpression} node $COMMENT#JSDOC#PARAMS#NODE
|
|
339
|
+
* @returns $COMMENT#JSDOC#RETURNS#DIRECTIVE21#IMPORTEDFILEFLOW
|
|
340
340
|
*/
|
|
341
341
|
const importedFileFlowRequire = (context, node) => {
|
|
342
342
|
const skipTrue = {
|
|
@@ -383,7 +383,7 @@ const importedFileFlowRequire = (context, node) => {
|
|
|
383
383
|
// 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.
|
|
384
384
|
|
|
385
385
|
// console.warn(
|
|
386
|
-
// `WARNING. The imported file ${resolvedImportPath}, whose path has been resolved from ${context.filename}, has no commented
|
|
386
|
+
// `WARNING. The imported file ${resolvedImportPath}, whose path has been resolved from ${context.filename}, has no commented $COMMENT#JSDOC#FORCOMPOSEDVARIABLES#DIRECTIVEPERIOD It is thus ignored since the report on that circumstance would be available on the imported file itself.`
|
|
387
387
|
// ); // The decision not to report has been taken to not inflate the number of warnings.
|
|
388
388
|
return skipTrue;
|
|
389
389
|
}
|
|
@@ -444,11 +444,11 @@ const importedFileFlowRequire = (context, node) => {
|
|
|
444
444
|
/* importsFlow */
|
|
445
445
|
|
|
446
446
|
/**
|
|
447
|
-
*
|
|
448
|
-
* @param {Context} context
|
|
449
|
-
* @param {ImportDeclaration} node
|
|
450
|
-
* @param {CommentedDirective} currentFileCommentedDirective
|
|
451
|
-
* @returns
|
|
447
|
+
* $COMMENT#JSDOC#FORALIASVARIABLES#IMPORTSFLOWCOMMENTED
|
|
448
|
+
* @param {Context} context $COMMENT#JSDOC#PARAMS#CONTEXTB
|
|
449
|
+
* @param {ImportDeclaration} node $COMMENT#JSDOC#PARAMS#NODE
|
|
450
|
+
* @param {CommentedDirective} currentFileCommentedDirective $COMMENT#JSDOC#PARAMS#DIRECTIVE21#CURRENTFILECOMMENTEDDIRECTIVE
|
|
451
|
+
* @returns $COMMENT#JSDOC#FORALIASVARIABLES#FLOWRETURNSEARLY
|
|
452
452
|
*/
|
|
453
453
|
export const importsFlow = (context, node, currentFileCommentedDirective) => {
|
|
454
454
|
// does not operate on `import type`
|
|
@@ -521,11 +521,11 @@ export const importsFlow = (context, node, currentFileCommentedDirective) => {
|
|
|
521
521
|
|
|
522
522
|
// NEW!! Currently strictly adapted from importsFlow
|
|
523
523
|
/**
|
|
524
|
-
*
|
|
525
|
-
* @param {Context} context
|
|
526
|
-
* @param {CallExpression} node
|
|
527
|
-
* @param {CommentedDirective} currentFileCommentedDirective
|
|
528
|
-
* @returns
|
|
524
|
+
* $COMMENT#JSDOC#FORALIASVARIABLES#IMPORTSFLOWCOMMENTEDREQUIRE
|
|
525
|
+
* @param {Context} context $COMMENT#JSDOC#PARAMS#CONTEXTB
|
|
526
|
+
* @param {CallExpression} node $COMMENT#JSDOC#PARAMS#NODE
|
|
527
|
+
* @param {CommentedDirective} currentFileCommentedDirective $COMMENT#JSDOC#PARAMS#DIRECTIVE21#CURRENTFILECOMMENTEDDIRECTIVE
|
|
528
|
+
* @returns $COMMENT#JSDOC#FORALIASVARIABLES#FLOWRETURNSEARLY
|
|
529
529
|
*/
|
|
530
530
|
export const importsFlowRequire = (
|
|
531
531
|
context,
|
|
@@ -600,11 +600,11 @@ export const importsFlowRequire = (
|
|
|
600
600
|
/* allExportsFlow */
|
|
601
601
|
|
|
602
602
|
/**
|
|
603
|
-
*
|
|
604
|
-
* @param {Context} context
|
|
605
|
-
* @param {ExportNamedDeclaration | ExportAllDeclaration | ExportDefaultDeclaration} node
|
|
606
|
-
* @param {CommentedDirective} currentFileCommentedDirective
|
|
607
|
-
* @returns
|
|
603
|
+
* $COMMENT#JSDOC#DEFINITIONS#DIRECTIVE21#ALLEXPORTSFLOW
|
|
604
|
+
* @param {Context} context $COMMENT#JSDOC#PARAMS#CONTEXTB
|
|
605
|
+
* @param {ExportNamedDeclaration | ExportAllDeclaration | ExportDefaultDeclaration} node $COMMENT#JSDOC#PARAMS#NODE
|
|
606
|
+
* @param {CommentedDirective} currentFileCommentedDirective $COMMENT#JSDOC#PARAMS#DIRECTIVE21#CURRENTFILECOMMENTEDDIRECTIVE
|
|
607
|
+
* @returns $COMMENT#JSDOC#FORALIASVARIABLES#FLOWRETURNSEARLY
|
|
608
608
|
*/
|
|
609
609
|
export const allExportsFlow = (
|
|
610
610
|
context,
|
|
@@ -644,12 +644,12 @@ export const allExportsFlow = (
|
|
|
644
644
|
// else
|
|
645
645
|
currentFileCommentedDirective = addressedDirective; // to still keep compatibility with strategies
|
|
646
646
|
|
|
647
|
-
// Lints imports of Agnostic Strategies Modules beyond strategy resolution, such as to warn imports of Special Agnostic Modules. Does the same with
|
|
647
|
+
// Lints imports of Agnostic Strategies Modules beyond strategy resolution, such as to warn imports of Special Agnostic Modules. Does the same with $COMMENT#DIRECTIVE21#USE_AGNOSTIC_CONDITIONS#KINDSSIMPLE Modules, since they are the only other modules which cannot import themselves.
|
|
648
648
|
if (
|
|
649
649
|
currentFileCommentedDirective === USE_AGNOSTIC_STRATEGIES ||
|
|
650
650
|
currentFileCommentedDirective === USE_AGNOSTIC_CONDITIONS
|
|
651
651
|
) {
|
|
652
|
-
// Basically, all modules need to do reexports that correspond to their own modules, but not Agnostic Strategies Modules and
|
|
652
|
+
// Basically, all modules need to do reexports that correspond to their own modules, but not Agnostic Strategies Modules and $COMMENT#DIRECTIVE21#USE_AGNOSTIC_CONDITIONS#KINDSSIMPLE Modules, the latter which are in fact NOT allowed to do re-exports.
|
|
653
653
|
if (
|
|
654
654
|
isImportBlocked(
|
|
655
655
|
currentFileCommentedDirective,
|
|
@@ -727,9 +727,9 @@ export const allExportsFlow = (
|
|
|
727
727
|
/* functionDeclarationFlow */
|
|
728
728
|
|
|
729
729
|
/**
|
|
730
|
-
*
|
|
731
|
-
* @param {string} name
|
|
732
|
-
* @returns
|
|
730
|
+
* $COMMENT#JSDOC#DEFINITIONS#DIRECTIVE21#NAMEISPASCALCASE
|
|
731
|
+
* @param {string} name $COMMENT#JSDOC#PARAMS#DIRECTIVE21#NAME
|
|
732
|
+
* @returns $COMMENT#JSDOC#RETURNS#DIRECTIVE21#NAMEISPASCALCASE
|
|
733
733
|
*/
|
|
734
734
|
const nameIsPascalCase = (name) => {
|
|
735
735
|
// PascalCase: starts with capital, no underscores, no hyphens
|
|
@@ -737,9 +737,9 @@ const nameIsPascalCase = (name) => {
|
|
|
737
737
|
};
|
|
738
738
|
|
|
739
739
|
/**
|
|
740
|
-
*
|
|
741
|
-
* @param {Parameter[]} params
|
|
742
|
-
* @returns
|
|
740
|
+
* $COMMENT#JSDOC#DEFINITIONS#DIRECTIVE21#DECLARESCHILDRENPROP
|
|
741
|
+
* @param {Parameter[]} params $COMMENT#JSDOC#PARAMS#DIRECTIVE21#PARAMS
|
|
742
|
+
* @returns $COMMENT#JSDOC#RETURNS#DIRECTIVE21#DECLARESCHILDRENPROP
|
|
743
743
|
*/
|
|
744
744
|
const declaresChildrenProp = (params) => {
|
|
745
745
|
if (params.length === 0) return false;
|
|
@@ -760,11 +760,11 @@ const declaresChildrenProp = (params) => {
|
|
|
760
760
|
};
|
|
761
761
|
|
|
762
762
|
/**
|
|
763
|
-
*
|
|
764
|
-
* @param {Context} context
|
|
765
|
-
* @param {FunctionDeclaration} node
|
|
766
|
-
* @param {CommentedDirective} currentFileCommentedDirective
|
|
767
|
-
* @returns
|
|
763
|
+
* $COMMENT#JSDOC#DEFINITIONS#DIRECTIVE21#FUNCTIONDECLARATIONFLOW
|
|
764
|
+
* @param {Context} context $COMMENT#JSDOC#PARAMS#CONTEXTB
|
|
765
|
+
* @param {FunctionDeclaration} node $COMMENT#JSDOC#PARAMS#NODE
|
|
766
|
+
* @param {CommentedDirective} currentFileCommentedDirective $COMMENT#JSDOC#PARAMS#DIRECTIVE21#CURRENTFILECOMMENTEDDIRECTIVE
|
|
767
|
+
* @returns $COMMENT#JSDOC#FORALIASVARIABLES#FLOWRETURNSEARLY
|
|
768
768
|
*/
|
|
769
769
|
export const functionDeclarationFlow = (
|
|
770
770
|
context,
|
|
@@ -806,11 +806,11 @@ export const functionDeclarationFlow = (
|
|
|
806
806
|
/* jsxElementFlow */
|
|
807
807
|
|
|
808
808
|
/**
|
|
809
|
-
*
|
|
810
|
-
* @param {Context} context
|
|
811
|
-
* @param {JSXElement} node
|
|
812
|
-
* @param {CommentedDirective} currentFileCommentedDirective
|
|
813
|
-
* @returns
|
|
809
|
+
* $COMMENT#JSDOC#DEFINITIONS#DIRECTIVE21#JSXELEMENTFLOW
|
|
810
|
+
* @param {Context} context $COMMENT#JSDOC#PARAMS#CONTEXTB
|
|
811
|
+
* @param {JSXElement} node $COMMENT#JSDOC#PARAMS#NODE
|
|
812
|
+
* @param {CommentedDirective} currentFileCommentedDirective $COMMENT#JSDOC#PARAMS#DIRECTIVE21#CURRENTFILECOMMENTEDDIRECTIVE
|
|
813
|
+
* @returns $COMMENT#JSDOC#FORALIASVARIABLES#FLOWRETURNSEARLY
|
|
814
814
|
*/
|
|
815
815
|
export const jsxElementFlow = (
|
|
816
816
|
context,
|
|
@@ -841,11 +841,11 @@ export const jsxElementFlow = (
|
|
|
841
841
|
/* jsxOpeningElementFlow */
|
|
842
842
|
|
|
843
843
|
/**
|
|
844
|
-
*
|
|
845
|
-
* @param {Context} context
|
|
846
|
-
* @param {JSXOpeningElement} node
|
|
847
|
-
* @param {CommentedDirective} currentFileCommentedDirective
|
|
848
|
-
* @returns
|
|
844
|
+
* $COMMENT#JSDOC#DEFINITIONS#DIRECTIVE21#JSXOPENINGELEMENTFLOW
|
|
845
|
+
* @param {Context} context $COMMENT#JSDOC#PARAMS#CONTEXTB
|
|
846
|
+
* @param {JSXOpeningElement} node $COMMENT#JSDOC#PARAMS#NODE
|
|
847
|
+
* @param {CommentedDirective} currentFileCommentedDirective $COMMENT#JSDOC#PARAMS#DIRECTIVE21#CURRENTFILECOMMENTEDDIRECTIVE
|
|
848
|
+
* @returns $COMMENT#JSDOC#FORALIASVARIABLES#FLOWRETURNSEARLY
|
|
849
849
|
*/
|
|
850
850
|
export const jsxOpeningElementFlow = (
|
|
851
851
|
context,
|
|
@@ -30,9 +30,9 @@ import {
|
|
|
30
30
|
/* getCommentedDirectiveFromSourceCode */
|
|
31
31
|
|
|
32
32
|
/**
|
|
33
|
-
*
|
|
34
|
-
* @param {string} string
|
|
35
|
-
* @returns
|
|
33
|
+
* $COMMENT#JSDOC#DEFINITIONS#DIRECTIVE21#DETECTQUOTETYPE
|
|
34
|
+
* @param {string} string $COMMENT#JSDOC#PARAMS#DIRECTIVE21#STRING
|
|
35
|
+
* @returns $COMMENT#JSDOC#RETURNS#DIRECTIVE21#DETECTQUOTETYPE
|
|
36
36
|
*/
|
|
37
37
|
const detectQuoteType = (string) => {
|
|
38
38
|
if (string.startsWith("'") && string.endsWith("'")) {
|
|
@@ -45,9 +45,9 @@ const detectQuoteType = (string) => {
|
|
|
45
45
|
};
|
|
46
46
|
|
|
47
47
|
/**
|
|
48
|
-
*
|
|
49
|
-
* @param {string} string
|
|
50
|
-
* @returns
|
|
48
|
+
* $COMMENT#JSDOC#DEFINITIONS#DIRECTIVE21#STRIPSINGLEQUOTES
|
|
49
|
+
* @param {string} string $COMMENT#JSDOC#PARAMS#DIRECTIVE21#STRING
|
|
50
|
+
* @returns $COMMENT#JSDOC#RETURNS#DIRECTIVE21#STRIPSINGLEQUOTES
|
|
51
51
|
*/
|
|
52
52
|
const stripSingleQuotes = (string) => {
|
|
53
53
|
if (string.startsWith("'") && string.endsWith("'")) {
|
|
@@ -57,9 +57,9 @@ const stripSingleQuotes = (string) => {
|
|
|
57
57
|
};
|
|
58
58
|
|
|
59
59
|
/**
|
|
60
|
-
*
|
|
61
|
-
* @param {string} string
|
|
62
|
-
* @returns
|
|
60
|
+
* $COMMENT#JSDOC#DEFINITIONS#DIRECTIVE21#STRIPDOUBLEQUOTES
|
|
61
|
+
* @param {string} string $COMMENT#JSDOC#PARAMS#DIRECTIVE21#STRING
|
|
62
|
+
* @returns $COMMENT#JSDOC#RETURNS#DIRECTIVE21#STRIPSINGLEQUOTES
|
|
63
63
|
*/
|
|
64
64
|
const stripDoubleQuotes = (string) => {
|
|
65
65
|
if (string.startsWith('"') && string.endsWith('"')) {
|
|
@@ -69,21 +69,21 @@ const stripDoubleQuotes = (string) => {
|
|
|
69
69
|
};
|
|
70
70
|
|
|
71
71
|
/**
|
|
72
|
-
*
|
|
72
|
+
* $COMMENT#JSDOC#DEFINITIONS#DIRECTIVE21#GETCOMMENTEDDIRECTIVEFROMSOURCECODE1
|
|
73
73
|
*
|
|
74
|
-
*
|
|
75
|
-
* -
|
|
76
|
-
* -
|
|
77
|
-
* -
|
|
78
|
-
* -
|
|
79
|
-
* -
|
|
80
|
-
* -
|
|
81
|
-
* -
|
|
82
|
-
* -
|
|
83
|
-
* -
|
|
84
|
-
* -
|
|
85
|
-
* @param {SourceCode} sourceCode
|
|
86
|
-
* @returns
|
|
74
|
+
* $COMMENT#JSDOC#DEFINITIONS#DIRECTIVE21#GETCOMMENTEDDIRECTIVEFROMSOURCECODE2
|
|
75
|
+
* - $COMMENT#JSDOC#DETAILS#DIRECTIVE21#USESERVERLOGICSA
|
|
76
|
+
* - $COMMENT#JSDOC#DETAILS#DIRECTIVE21#USECLIENTLOGICSA
|
|
77
|
+
* - $COMMENT#JSDOC#DETAILS#DIRECTIVE21#USEAGNOSTICLOGICSA
|
|
78
|
+
* - $COMMENT#JSDOC#DETAILS#DIRECTIVE21#USESERVERCOMPONENTSA
|
|
79
|
+
* - $COMMENT#JSDOC#DETAILS#DIRECTIVE21#USECLIENTCOMPONENTSA
|
|
80
|
+
* - $COMMENT#JSDOC#DETAILS#DIRECTIVE21#USEAGNOSTICCOMPONENTSA
|
|
81
|
+
* - $COMMENT#JSDOC#DETAILS#DIRECTIVE21#USESERVERFUNCTIONSA
|
|
82
|
+
* - $COMMENT#JSDOC#DETAILS#DIRECTIVE21#USECLIENTCONTEXTSA
|
|
83
|
+
* - $COMMENT#JSDOC#DETAILS#DIRECTIVE21#USEAGNOSTICCONDITIONSA
|
|
84
|
+
* - $COMMENT#JSDOC#DETAILS#DIRECTIVE21#USEAGNOSTICSTRATEGIESA
|
|
85
|
+
* @param {SourceCode} sourceCode $COMMENT#JSDOC#PARAMS#DIRECTIVE21#SOURCECODE
|
|
86
|
+
* @returns $COMMENT#JSDOC#RETURNS#DIRECTIVE21#GETCOMMENTEDDIRECTIVEFROMSOURCECODE
|
|
87
87
|
*/
|
|
88
88
|
export const getCommentedDirectiveFromSourceCode = (sourceCode) => {
|
|
89
89
|
// returns null IMMEDIATELY if the SourceCode is faulty (inexistent)
|
|
@@ -134,21 +134,21 @@ export const getCommentedDirectiveFromSourceCode = (sourceCode) => {
|
|
|
134
134
|
/* getCommentedDirectiveFromCurrentModule */
|
|
135
135
|
|
|
136
136
|
/**
|
|
137
|
-
*
|
|
137
|
+
* $COMMENT#JSDOC#DEFINITIONS#DIRECTIVE21#GETCOMMENTEDDIRECTIVEFROMCURRENTMODULE1
|
|
138
138
|
*
|
|
139
|
-
*
|
|
140
|
-
* -
|
|
141
|
-
* -
|
|
142
|
-
* -
|
|
143
|
-
* -
|
|
144
|
-
* -
|
|
145
|
-
* -
|
|
146
|
-
* -
|
|
147
|
-
* -
|
|
148
|
-
* -
|
|
149
|
-
* -
|
|
150
|
-
* @param {Context} context
|
|
151
|
-
* @returns
|
|
139
|
+
* $COMMENT#JSDOC#DEFINITIONS#DIRECTIVE21#GETCOMMENTEDDIRECTIVEFROMSOURCECODE2
|
|
140
|
+
* - $COMMENT#JSDOC#DETAILS#DIRECTIVE21#USESERVERLOGICSA
|
|
141
|
+
* - $COMMENT#JSDOC#DETAILS#DIRECTIVE21#USECLIENTLOGICSA
|
|
142
|
+
* - $COMMENT#JSDOC#DETAILS#DIRECTIVE21#USEAGNOSTICLOGICSA
|
|
143
|
+
* - $COMMENT#JSDOC#DETAILS#DIRECTIVE21#USESERVERCOMPONENTSA
|
|
144
|
+
* - $COMMENT#JSDOC#DETAILS#DIRECTIVE21#USECLIENTCOMPONENTSA
|
|
145
|
+
* - $COMMENT#JSDOC#DETAILS#DIRECTIVE21#USEAGNOSTICCOMPONENTSA
|
|
146
|
+
* - $COMMENT#JSDOC#DETAILS#DIRECTIVE21#USESERVERFUNCTIONSA
|
|
147
|
+
* - $COMMENT#JSDOC#DETAILS#DIRECTIVE21#USECLIENTCONTEXTSA
|
|
148
|
+
* - $COMMENT#JSDOC#DETAILS#DIRECTIVE21#USEAGNOSTICCONDITIONSA
|
|
149
|
+
* - $COMMENT#JSDOC#DETAILS#DIRECTIVE21#USEAGNOSTICSTRATEGIESA
|
|
150
|
+
* @param {Context} context $COMMENT#JSDOC#PARAMS#CONTEXTB
|
|
151
|
+
* @returns $COMMENT#JSDOC#RETURNS#DIRECTIVE21#GETCOMMENTEDDIRECTIVEFROMSOURCECODE
|
|
152
152
|
*/
|
|
153
153
|
export const getCommentedDirectiveFromCurrentModule = (context) => {
|
|
154
154
|
const sourceCode = context.sourceCode;
|
|
@@ -163,21 +163,21 @@ export const getCommentedDirectiveFromCurrentModule = (context) => {
|
|
|
163
163
|
/* getCommentedDirectiveFromImportedModule */
|
|
164
164
|
|
|
165
165
|
/**
|
|
166
|
-
*
|
|
166
|
+
* $COMMENT#JSDOC#DEFINITIONS#DIRECTIVE21#GETCOMMENTEDDIRECTIVEFROMIMPORTEDMODULE1
|
|
167
167
|
*
|
|
168
|
-
*
|
|
169
|
-
* -
|
|
170
|
-
* -
|
|
171
|
-
* -
|
|
172
|
-
* -
|
|
173
|
-
* -
|
|
174
|
-
* -
|
|
175
|
-
* -
|
|
176
|
-
* -
|
|
177
|
-
* -
|
|
178
|
-
* -
|
|
179
|
-
* @param {string} resolvedPath
|
|
180
|
-
* @returns
|
|
168
|
+
* $COMMENT#JSDOC#DEFINITIONS#DIRECTIVE21#GETCOMMENTEDDIRECTIVEFROMSOURCECODE2
|
|
169
|
+
* - $COMMENT#JSDOC#DETAILS#DIRECTIVE21#USESERVERLOGICSA
|
|
170
|
+
* - $COMMENT#JSDOC#DETAILS#DIRECTIVE21#USECLIENTLOGICSA
|
|
171
|
+
* - $COMMENT#JSDOC#DETAILS#DIRECTIVE21#USEAGNOSTICLOGICSA
|
|
172
|
+
* - $COMMENT#JSDOC#DETAILS#DIRECTIVE21#USESERVERCOMPONENTSA
|
|
173
|
+
* - $COMMENT#JSDOC#DETAILS#DIRECTIVE21#USECLIENTCOMPONENTSA
|
|
174
|
+
* - $COMMENT#JSDOC#DETAILS#DIRECTIVE21#USEAGNOSTICCOMPONENTSA
|
|
175
|
+
* - $COMMENT#JSDOC#DETAILS#DIRECTIVE21#USESERVERFUNCTIONSA
|
|
176
|
+
* - $COMMENT#JSDOC#DETAILS#DIRECTIVE21#USECLIENTCONTEXTSA
|
|
177
|
+
* - $COMMENT#JSDOC#DETAILS#DIRECTIVE21#USEAGNOSTICCONDITIONSA
|
|
178
|
+
* - $COMMENT#JSDOC#DETAILS#DIRECTIVE21#USEAGNOSTICSTRATEGIESA
|
|
179
|
+
* @param {string} resolvedPath $COMMENT#JSDOC#PARAMS#RESOLVEDPATH
|
|
180
|
+
* @returns $COMMENT#JSDOC#RETURNS#DIRECTIVE21#GETCOMMENTEDDIRECTIVEFROMIMPORTEDMODULE
|
|
181
181
|
*/
|
|
182
182
|
export const getCommentedDirectiveFromImportedModule = (resolvedPath) => {
|
|
183
183
|
const sourceCode = getSourceCodeFromFilePath(resolvedPath);
|
|
@@ -192,20 +192,20 @@ export const getCommentedDirectiveFromImportedModule = (resolvedPath) => {
|
|
|
192
192
|
/* getVerifiedCommentedDirective */
|
|
193
193
|
|
|
194
194
|
/**
|
|
195
|
-
*
|
|
196
|
-
* -
|
|
197
|
-
* -
|
|
198
|
-
* -
|
|
199
|
-
* -
|
|
200
|
-
* -
|
|
201
|
-
* -
|
|
202
|
-
* -
|
|
203
|
-
* -
|
|
204
|
-
* -
|
|
205
|
-
* -
|
|
206
|
-
* @param {CommentedDirective} directive
|
|
207
|
-
* @param {Extension} extension
|
|
208
|
-
* @returns
|
|
195
|
+
* $COMMENT#JSDOC#DEFINITIONS#DIRECTIVE21#GETVERIFIEDCOMMENTEDDIRECTIVE
|
|
196
|
+
* - $COMMENT#JSDOC#DETAILS#DIRECTIVE21#USESERVERLOGICSB
|
|
197
|
+
* - $COMMENT#JSDOC#DETAILS#DIRECTIVE21#USECLIENTLOGICSB
|
|
198
|
+
* - $COMMENT#JSDOC#DETAILS#DIRECTIVE21#USEAGNOSTICLOGICSB
|
|
199
|
+
* - $COMMENT#JSDOC#DETAILS#DIRECTIVE21#USESERVERCOMPONENTSB
|
|
200
|
+
* - $COMMENT#JSDOC#DETAILS#DIRECTIVE21#USECLIENTCOMPONENTSB
|
|
201
|
+
* - $COMMENT#JSDOC#DETAILS#DIRECTIVE21#USEAGNOSTICCOMPONENTSB
|
|
202
|
+
* - $COMMENT#JSDOC#DETAILS#DIRECTIVE21#USESERVERFUNCTIONSB
|
|
203
|
+
* - $COMMENT#JSDOC#DETAILS#DIRECTIVE21#USECLIENTCONTEXTSB
|
|
204
|
+
* - $COMMENT#JSDOC#DETAILS#DIRECTIVE21#USEAGNOSTICCONDITIONSB
|
|
205
|
+
* - $COMMENT#JSDOC#DETAILS#DIRECTIVE21#USEAGNOSTICSTRATEGIESB
|
|
206
|
+
* @param {CommentedDirective} directive $COMMENT#JSDOC#PARAMS#DIRECTIVE21#DIRECTIVE
|
|
207
|
+
* @param {Extension} extension $COMMENT#JSDOC#PARAMS#EXTENSION
|
|
208
|
+
* @returns $COMMENT#JSDOC#RETURNS#DIRECTIVE21#GETVERIFIEDCOMMENTEDDIRECTIVE
|
|
209
209
|
*/
|
|
210
210
|
export const getVerifiedCommentedDirective = (directive, extension) => {
|
|
211
211
|
const rule = commentedDirectives_extensionRules[directive];
|
|
@@ -222,10 +222,10 @@ export const getVerifiedCommentedDirective = (directive, extension) => {
|
|
|
222
222
|
/* getStrategizedDirective */
|
|
223
223
|
|
|
224
224
|
/**
|
|
225
|
-
*
|
|
226
|
-
* @param {Context} context
|
|
227
|
-
* @param {ImportDeclaration | ExportNamedDeclaration | ExportAllDeclaration | ExportDefaultDeclaration} node
|
|
228
|
-
* @returns
|
|
225
|
+
* $COMMENT#JSDOC#DEFINITIONS#DIRECTIVE21#GETSTRATEGIZEDDIRECTIVE
|
|
226
|
+
* @param {Context} context $COMMENT#JSDOC#PARAMS#CONTEXTB
|
|
227
|
+
* @param {ImportDeclaration | ExportNamedDeclaration | ExportAllDeclaration | ExportDefaultDeclaration} node $COMMENT#JSDOC#PARAMS#NODE
|
|
228
|
+
* @returns $COMMENT#JSDOC#RETURNS#DIRECTIVE21#GETSTRATEGIZEDDIRECTIVE
|
|
229
229
|
*/
|
|
230
230
|
export const getStrategizedDirective = (context, node) => {
|
|
231
231
|
// gets the first nested `/* */` comment inside the node
|
|
@@ -314,11 +314,11 @@ export const fileIsRegularJavaScript = (filePath) =>
|
|
|
314
314
|
//
|
|
315
315
|
|
|
316
316
|
/**
|
|
317
|
-
*
|
|
318
|
-
* @param {Context} context
|
|
319
|
-
* @param {ExportNamedDeclaration | ExportAllDeclaration | ExportDefaultDeclaration} node
|
|
320
|
-
* @param {CommentedDirective} currentFileCommentedDirective
|
|
321
|
-
* @returns
|
|
317
|
+
* $COMMENT#JSDOC#DEFINITIONS#DIRECTIVE21#ADDRESSDIRECTIVEIFAGNOSTICSTRATEGIES
|
|
318
|
+
* @param {Context} context $COMMENT#JSDOC#PARAMS#CONTEXTB
|
|
319
|
+
* @param {ExportNamedDeclaration | ExportAllDeclaration | ExportDefaultDeclaration} node $COMMENT#JSDOC#PARAMS#NODE
|
|
320
|
+
* @param {CommentedDirective} currentFileCommentedDirective $COMMENT#JSDOC#PARAMS#DIRECTIVE21#CURRENTFILECOMMENTEDDIRECTIVE
|
|
321
|
+
* @returns $COMMENT#JSDOC#RETURNS#DIRECTIVE21#ADDRESSDIRECTIVEIFAGNOSTICSTRATEGIES
|
|
322
322
|
*/
|
|
323
323
|
export const addressDirectiveIfAgnosticStrategies = (
|
|
324
324
|
context,
|
|
@@ -352,10 +352,10 @@ export const addressDirectiveIfAgnosticStrategies = (
|
|
|
352
352
|
/* isImportBlocked */
|
|
353
353
|
|
|
354
354
|
/**
|
|
355
|
-
*
|
|
356
|
-
* @param {CommentedDirective} currentFileCommentedDirective
|
|
357
|
-
* @param {CommentedDirective} importedFileCommentedDirective
|
|
358
|
-
* @returns
|
|
355
|
+
* $COMMENT#JSDOC#DEFINITIONS#DIRECTIVE21#ISIMPORTBLOCKED
|
|
356
|
+
* @param {CommentedDirective} currentFileCommentedDirective $COMMENT#JSDOC#PARAMS#DIRECTIVE21#CURRENTFILECOMMENTEDDIRECTIVE
|
|
357
|
+
* @param {CommentedDirective} importedFileCommentedDirective $COMMENT#JSDOC#PARAMS#DIRECTIVE21#IMPORTEDFILECOMMENTEDDIRECTIVE
|
|
358
|
+
* @returns $COMMENT#JSDOC#RETURNS#DIRECTIVE21#ISIMPORTBLOCKED
|
|
359
359
|
*/
|
|
360
360
|
export const isImportBlocked = (
|
|
361
361
|
currentFileCommentedDirective,
|
|
@@ -370,9 +370,9 @@ export const isImportBlocked = (
|
|
|
370
370
|
/* makeMessageFromCurrentFileCommentedDirective */
|
|
371
371
|
|
|
372
372
|
/**
|
|
373
|
-
*
|
|
374
|
-
* @param {CommentedDirective} commentedDirective
|
|
375
|
-
* @returns
|
|
373
|
+
* $COMMENT#JSDOC#DEFINITIONS#DIRECTIVE21#MAKEMESSAGEFROMCURRENTFILECOMMENTEDDIRECTIVE
|
|
374
|
+
* @param {CommentedDirective} commentedDirective $COMMENT#JSDOC#PARAMS#DIRECTIVE21#COMMENTEDDIRECTIVE
|
|
375
|
+
* @returns $COMMENT#JSDOC#RETURNS#DIRECTIVE21#MAKEMESSAGEFROMCURRENTFILECOMMENTEDDIRECTIVE
|
|
376
376
|
*/
|
|
377
377
|
export const makeMessageFromCurrentFileCommentedDirective = (
|
|
378
378
|
commentedDirective,
|
|
@@ -385,10 +385,10 @@ export const makeMessageFromCurrentFileCommentedDirective = (
|
|
|
385
385
|
/* findSpecificViolationMessage */
|
|
386
386
|
|
|
387
387
|
/**
|
|
388
|
-
*
|
|
389
|
-
* @param {CommentedDirective} currentFileCommentedDirective
|
|
390
|
-
* @param {CommentedDirective} importedFileCommentedDirective
|
|
391
|
-
* @returns
|
|
388
|
+
* $COMMENT#JSDOC#DEFINITIONS#DIRECTIVE21#FINDSPECIFICVIOLATIONMESSAGE
|
|
389
|
+
* @param {CommentedDirective} currentFileCommentedDirective $COMMENT#JSDOC#PARAMS#DIRECTIVE21#CURRENTFILECOMMENTEDDIRECTIVE
|
|
390
|
+
* @param {CommentedDirective} importedFileCommentedDirective $COMMENT#JSDOC#PARAMS#DIRECTIVE21#IMPORTEDFILECOMMENTEDDIRECTIVE
|
|
391
|
+
* @returns $COMMENT#JSDOC#RETURNS#FINDSPECIFICVIOLATIONMESSAGE
|
|
392
392
|
*/
|
|
393
393
|
export const findSpecificViolationMessage = (
|
|
394
394
|
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/library/index.js
CHANGED
|
@@ -165,10 +165,10 @@ export {
|
|
|
165
165
|
export { directive21Data } from "../jscomments/_commons/constants/data.js";
|
|
166
166
|
|
|
167
167
|
/**
|
|
168
|
-
*
|
|
168
|
+
* $COMMENT#JSDOC#DEFINITIONS#DEFINEDIRECTIVE21
|
|
169
169
|
* @template {string} T
|
|
170
|
-
* @param {T} reactFolder
|
|
171
|
-
* @returns
|
|
170
|
+
* @param {T} reactFolder $COMMENT#JSDOC#PARAMS#REACTFOLDER
|
|
171
|
+
* @returns $COMMENT#JSDOC#RETURNS#DEFINEDIRECTIVE21
|
|
172
172
|
*/
|
|
173
173
|
export const defineDirective21 = (reactFolder) => {
|
|
174
174
|
/** @type {[`${T}/*\*\/*.tsx`, `${T}/*\*\/*.ts`, `${T}/*\*\/*.jsx`, `${T}/*\*\/*.js`, `${T}/*\*\/*.mjs`, `${T}/*\*\/*.cjs`]} */
|
|
@@ -195,13 +195,13 @@ export const defineDirective21 = (reactFolder) => {
|
|
|
195
195
|
};
|
|
196
196
|
|
|
197
197
|
/**
|
|
198
|
-
*
|
|
198
|
+
* $COMMENT#JSDOC#DEFINITIONS#DEFINECONFIGSETTINGS
|
|
199
199
|
* @template {string} T
|
|
200
200
|
* @template {string} U
|
|
201
|
-
* @param {Object} settings
|
|
202
|
-
* @param {T} settings.reactFolder
|
|
203
|
-
* @param {U} settings.rootPath
|
|
204
|
-
* @returns
|
|
201
|
+
* @param {Object} settings $COMMENT#JSDOC#PARAMS#SETTINGS
|
|
202
|
+
* @param {T} settings.reactFolder $COMMENT#JSDOC#PARAMS#REACTFOLDER
|
|
203
|
+
* @param {U} settings.rootPath $COMMENT#JSDOC#PARAMS#ROOTPATH
|
|
204
|
+
* @returns $COMMENT#JSDOC#RETURNS#DEFINECONFIGSETTINGS
|
|
205
205
|
*/
|
|
206
206
|
export const defineConfigSettings = ({ reactFolder, rootPath }) => {
|
|
207
207
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "eslint-plugin-use-agnostic",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.4",
|
|
4
4
|
"description": "Highlights problematic server-client imports in projects made with the Fullstack React Architecture.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"eslint",
|
|
@@ -45,14 +45,15 @@
|
|
|
45
45
|
"dependencies": {
|
|
46
46
|
"find-up": "^8.0.0",
|
|
47
47
|
"get-sourcecode-from-file-path": "^1.2.0",
|
|
48
|
+
"oxc-resolver": "^11.19.1",
|
|
48
49
|
"resolve-importing-path": "^1.0.4",
|
|
50
|
+
"typescript": "^5.9.3",
|
|
49
51
|
"typescript-eslint": "^8.32.0"
|
|
50
52
|
},
|
|
51
53
|
"devDependencies": {
|
|
52
54
|
"@typescript-eslint/utils": "^8.31.1",
|
|
53
55
|
"eslint": ">=9.0.0",
|
|
54
|
-
"tsconfig-paths": "^4.2.0"
|
|
55
|
-
"typescript": "^5.8.3"
|
|
56
|
+
"tsconfig-paths": "^4.2.0"
|
|
56
57
|
},
|
|
57
58
|
"peerDependencies": {
|
|
58
59
|
"eslint": ">=9.0.0"
|