eslint-plugin-use-agnostic 1.7.3 → 1.7.5
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 +0 -2
- package/library/index.js +2 -0
- package/package.json +1 -1
- package/types/index.d.ts +34 -13
package/README.md
CHANGED
|
@@ -78,8 +78,6 @@ With this list established, it thus becomes possible to recognize static import
|
|
|
78
78
|
|
|
79
79
|
## Caveats
|
|
80
80
|
|
|
81
|
-
Base url and aliased import paths are currently resolved under the assumption that `process.cwd()` and `context.cwd` have the same value.
|
|
82
|
-
|
|
83
81
|
It is up to you to confirm that your Agnostic Modules are indeed agnostic, meaning that they have neither server- nor client-side code. `eslint-plugin-use-agnostic`, at least at this time, does not do this verification for you.
|
|
84
82
|
|
|
85
83
|
It is also up to you to ensure, as outlined above, that **you avoid** exporting React components along with other logics within the same modules (unless you have to per the design of your current framework), which may derail the linting in some cases. Separating exporting React components within their own modules ending with a JSX file extension, from exporting other logics within modules that don't end with a JSX file extension, is crucial for distinguishing between Components Modules and Logics Modules respectively.
|
package/library/index.js
CHANGED
package/package.json
CHANGED
package/types/index.d.ts
CHANGED
|
@@ -45,6 +45,24 @@ export const commentedDirectives_commentedModules: Readonly<{
|
|
|
45
45
|
"use agnostic strategies": "Agnostic Strategies Module";
|
|
46
46
|
}>;
|
|
47
47
|
|
|
48
|
+
/**
|
|
49
|
+
* Gets the coordinates for the first line of code of a file.
|
|
50
|
+
* @param context An ESLint rule's `context` object.
|
|
51
|
+
* @returns The `context.report` `loc`-compatible coordinates for the first line of code of a file.
|
|
52
|
+
*/
|
|
53
|
+
export const highlightFirstLineOfCode: (
|
|
54
|
+
context: RuleContext<string, readonly unknown[]>
|
|
55
|
+
) => {
|
|
56
|
+
start: {
|
|
57
|
+
line: number;
|
|
58
|
+
column: number;
|
|
59
|
+
};
|
|
60
|
+
end: {
|
|
61
|
+
line: number;
|
|
62
|
+
column: number;
|
|
63
|
+
};
|
|
64
|
+
};
|
|
65
|
+
|
|
48
66
|
// agnostic20
|
|
49
67
|
|
|
50
68
|
// directives
|
|
@@ -408,22 +426,25 @@ export const getCommentedDirectiveFromCurrentModule: (
|
|
|
408
426
|
* - `'use agnostic conditions'`, `"use agnostic conditions"` denoting an Agnostic Conditions Module.
|
|
409
427
|
* - `'use agnostic strategies'`, `"use agnostic strategies"` denoting an Agnostic Strategies Module.
|
|
410
428
|
* @param resolvedPath The resolved path of the imported module.
|
|
411
|
-
* @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.)
|
|
429
|
+
* @returns The commented directive, or lack thereof via `null`. Now also provides the obtained `SourceCode` object. 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.)
|
|
412
430
|
*/
|
|
413
431
|
export const getCommentedDirectiveFromImportedModule: (
|
|
414
432
|
resolvedPath: string
|
|
415
|
-
) =>
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
433
|
+
) => {
|
|
434
|
+
commentedDirective:
|
|
435
|
+
| "use server logics"
|
|
436
|
+
| "use client logics"
|
|
437
|
+
| "use agnostic logics"
|
|
438
|
+
| "use server components"
|
|
439
|
+
| "use client components"
|
|
440
|
+
| "use agnostic components"
|
|
441
|
+
| "use server functions"
|
|
442
|
+
| "use client contexts"
|
|
443
|
+
| "use agnostic conditions"
|
|
444
|
+
| "use agnostic strategies"
|
|
445
|
+
| null;
|
|
446
|
+
sourceCode: ESLintSourceCode;
|
|
447
|
+
};
|
|
427
448
|
|
|
428
449
|
/**
|
|
429
450
|
* Ensures that a module's commented directive is consistent with its file extension (depending on whether it ends with 'x' for JSX).
|