eslint-plugin-use-agnostic 0.11.3 → 0.11.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.
|
@@ -46,9 +46,9 @@ import {
|
|
|
46
46
|
/* currentFileFlow */
|
|
47
47
|
|
|
48
48
|
/**
|
|
49
|
-
* The flow that begins the import rules enforcement rule, retrieving the
|
|
49
|
+
* The flow that begins the import rules enforcement rule, retrieving the verified commented directive of the current file before comparing it to upcoming verified commented directives of the files it imports.
|
|
50
50
|
* @param {Context} context The ESLint rule's `context` object.
|
|
51
|
-
* @returns Either an object with `skip: true` to disregard or one with the non-null `verifiedCommentedDirective`.
|
|
51
|
+
* @returns Either an object with `skip: true` to disregard or one with the non-null `verifiedCommentedDirective`.
|
|
52
52
|
*/
|
|
53
53
|
export const currentFileFlow = (context) => {
|
|
54
54
|
const skipTrue = { ...skip, verifiedCommentedDirective: undefined };
|
|
@@ -135,7 +135,7 @@ const importedFileFlow = (context, node) => {
|
|
|
135
135
|
if (!importedFileCommentedDirective) {
|
|
136
136
|
console.warn(
|
|
137
137
|
"WARNING. The imported file, whose path has been resolved, has no directive. It is thus ignored since the report on that circumstance is available on the imported file itself."
|
|
138
|
-
);
|
|
138
|
+
); // The decision not to report has been taken to not inflate the number of warnings.
|
|
139
139
|
return skipTrue;
|
|
140
140
|
}
|
|
141
141
|
|
|
@@ -32,8 +32,8 @@ import {
|
|
|
32
32
|
|
|
33
33
|
/**
|
|
34
34
|
* Detects whether a string is single- or double-quoted.
|
|
35
|
-
* @param {string} string
|
|
36
|
-
* @returns
|
|
35
|
+
* @param {string} string The original string.
|
|
36
|
+
* @returns `true` if single-quoted, `false` if double-quoted, `null` if neither.
|
|
37
37
|
*/
|
|
38
38
|
const detectQuoteType = (string) => {
|
|
39
39
|
if (string.startsWith("'") && string.endsWith("'")) {
|
|
@@ -47,8 +47,8 @@ const detectQuoteType = (string) => {
|
|
|
47
47
|
|
|
48
48
|
/**
|
|
49
49
|
* Removes single quotes from a string known to be single-quoted.
|
|
50
|
-
* @param {string} string
|
|
51
|
-
* @returns
|
|
50
|
+
* @param {string} string The original string.
|
|
51
|
+
* @returns The string with quotes removed.
|
|
52
52
|
*/
|
|
53
53
|
const stripSingleQuotes = (string) => {
|
|
54
54
|
if (string.startsWith("'") && string.endsWith("'")) {
|
|
@@ -59,8 +59,8 @@ const stripSingleQuotes = (string) => {
|
|
|
59
59
|
|
|
60
60
|
/**
|
|
61
61
|
* Removes double quotes from a string known to be double-quoted.
|
|
62
|
-
* @param {string} string
|
|
63
|
-
* @returns
|
|
62
|
+
* @param {string} string The original string.
|
|
63
|
+
* @returns The string with quotes removed.
|
|
64
64
|
*/
|
|
65
65
|
const stripDoubleQuotes = (string) => {
|
|
66
66
|
if (string.startsWith('"') && string.endsWith('"')) {
|
|
@@ -224,8 +224,9 @@ export const getStrategizedDirective = (context, node) => {
|
|
|
224
224
|
/**
|
|
225
225
|
* Returns a boolean deciding if an imported file's commented directive is incompatible with the current file's commented directive.
|
|
226
226
|
* @template {CommentedDirectiveWithoutUseAgnosticStrategies} T
|
|
227
|
+
* @template {CommentedDirectiveWithoutUseAgnosticStrategies} U
|
|
227
228
|
* @param {T} currentFileCommentedDirective The current file's commented directive.
|
|
228
|
-
* @param {
|
|
229
|
+
* @param {U} importedFileCommentedDirective The imported file's commented directive.
|
|
229
230
|
* @returns `true` if the import is blocked, as established in `commentedDirectives_BlockedImports`.
|
|
230
231
|
*/
|
|
231
232
|
export const isImportBlocked = (
|
|
@@ -258,8 +259,9 @@ export const makeMessageFromCurrentFileCommentedDirective = (
|
|
|
258
259
|
/**
|
|
259
260
|
* Finds the `message` for the specific violation of commented directives import rules based on `commentedDirectives_BlockedImports`.
|
|
260
261
|
* @template {CommentedDirectiveWithoutUseAgnosticStrategies} T
|
|
262
|
+
* @template {CommentedDirectiveWithoutUseAgnosticStrategies} U
|
|
261
263
|
* @param {T} currentFileCommentedDirective The current file's commented directive.
|
|
262
|
-
* @param {
|
|
264
|
+
* @param {U} importedFileCommentedDirective The imported file's commented directive.
|
|
263
265
|
* @returns The corresponding `message`.
|
|
264
266
|
*/
|
|
265
267
|
export const findSpecificViolationMessage = (
|
|
@@ -275,11 +277,11 @@ export const findSpecificViolationMessage = (
|
|
|
275
277
|
/* addressDirectiveIfAgnosticStrategies */
|
|
276
278
|
|
|
277
279
|
/**
|
|
278
|
-
* Verifies the current node's export strategy if `"use agnostic strategies"` by reporting `exportNotStrategized` in case an export is not strategized in an Agnostic Strategies Module.
|
|
280
|
+
* Verifies the current node's export strategy if the current commented directive is `"use agnostic strategies"` by reporting `exportNotStrategized` in case an export is not strategized in an Agnostic Strategies Module.
|
|
279
281
|
* @param {Context} context The ESLint rule's `context` object.
|
|
280
282
|
* @param {ExportNamedDeclaration | ExportAllDeclaration | ExportDefaultDeclaration} node The ESLint `node` of the rule's current traversal.
|
|
281
283
|
* @param {CommentedDirective} currentFileCommentedDirective The current file's commented directive.
|
|
282
|
-
* @returns The commented directive, the addressed strategy (as a commented directive) or null in case of failure.
|
|
284
|
+
* @returns The commented directive, the addressed strategy (as a commented directive) or `null` in case of failure.
|
|
283
285
|
*/
|
|
284
286
|
export const addressDirectiveIfAgnosticStrategies = (
|
|
285
287
|
context,
|