eslint-plugin-use-agnostic 1.6.4 → 1.6.6

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 CHANGED
@@ -9,7 +9,7 @@ _(Now powered by Comment Variables.)_
9
9
  ## Installation
10
10
 
11
11
  ```
12
- npm install eslint@^9.0.0 eslint-plugin-use-agnostic --save-dev
12
+ npm install eslint@^9.0.0 eslint-plugin-use-agnostic@latest --save-dev
13
13
  ```
14
14
 
15
15
  ## Setup
@@ -115,7 +115,7 @@ const effectiveDirectives_effectiveModules = Object.freeze({
115
115
  [USE_AGNOSTIC_COMPONENTS]: AGNOSTIC_COMPONENTS_MODULE,
116
116
  });
117
117
  // and directive21
118
- const commentedDirectives_commentedModules = Object.freeze({
118
+ export const commentedDirectives_commentedModules = Object.freeze({
119
119
  [USE_CLIENT_CONTEXTS]: CLIENT_CONTEXTS_MODULE,
120
120
  [USE_AGNOSTIC_CONDITIONS]: AGNOSTIC_CONDITIONS_MODULE,
121
121
  [USE_AGNOSTIC_STRATEGIES]: AGNOSTIC_STRATEGIES_MODULE,
@@ -47,13 +47,14 @@ Indeed, Server Functions Modules have no business exporting JSX. `,
47
47
  return {
48
48
  ImportDeclaration: (node) =>
49
49
  importsFlow(context, node, currentFileEffectiveDirective),
50
- // that should work
51
50
  ImportExpression: (node) =>
52
51
  importsFlow(context, node, currentFileEffectiveDirective),
53
52
  ExportNamedDeclaration: (node) =>
54
53
  reExportsFlow(context, node, currentFileEffectiveDirective),
55
54
  ExportAllDeclaration: (node) =>
56
55
  reExportsFlow(context, node, currentFileEffectiveDirective),
56
+ // Unlike directive21, no ExportDefaultDeclaration because ExportDefaultDeclaration don't have source. The reason they're addressed in directive21 is specifically for Agnostic Strategies.
57
+ // ...but removed because export default can only be
57
58
  };
58
59
  },
59
60
  };
@@ -1,6 +1,7 @@
1
1
  import path from "path";
2
2
 
3
3
  import { resolveImportingPath } from "resolve-importing-path";
4
+ import { findUpSync } from "find-up";
4
5
 
5
6
  import {
6
7
  EXTENSIONS,
@@ -106,7 +107,9 @@ const importedFileFlow = (context, node) => {
106
107
  const resolvedImportPath = resolveImportingPath(
107
108
  path.dirname(context.filename),
108
109
  node.source.value,
109
- context.cwd
110
+ findUpSync("tsconfig.json", {
111
+ cwd: path.dirname(context.filename),
112
+ }) ?? context.cwd
110
113
  );
111
114
 
112
115
  // does not operate on paths it did not resolve
@@ -57,7 +57,6 @@ Please include a Strategy that corresponds to the kind of module this export wou
57
57
  return {
58
58
  ImportDeclaration: (node) =>
59
59
  importsFlow(context, node, verifiedCommentedDirective),
60
- // that should work
61
60
  ImportExpression: (node) =>
62
61
  importsFlow(context, node, verifiedCommentedDirective),
63
62
  ExportNamedDeclaration: (node) =>
@@ -1,6 +1,7 @@
1
1
  import path from "path";
2
2
 
3
3
  import { resolveImportingPath } from "resolve-importing-path";
4
+ import { findUpSync } from "find-up";
4
5
 
5
6
  import {
6
7
  EXTENSIONS,
@@ -115,7 +116,9 @@ const importedFileFlow = (context, node) => {
115
116
  const resolvedImportPath = resolveImportingPath(
116
117
  path.dirname(context.filename),
117
118
  node.source.value,
118
- context.cwd
119
+ findUpSync("tsconfig.json", {
120
+ cwd: path.dirname(context.filename),
121
+ }) ?? context.cwd
119
122
  );
120
123
 
121
124
  // does not operate on paths it did not resolve
package/library/index.js CHANGED
@@ -48,7 +48,10 @@ export {
48
48
 
49
49
  // NEW: eslint-plugin-use-agnostic is effectively the premier implementation of the Directive-First Architecture. As such, the following imports are to access its constants and utilities across other implementations of the Directive-First Architecture, such as eXtra JSX.
50
50
 
51
- export { EXTENSIONS } from "./_commons/constants/bases.js";
51
+ export {
52
+ EXTENSIONS,
53
+ commentedDirectives_commentedModules,
54
+ } from "./_commons/constants/bases.js";
52
55
 
53
56
  // agnostic20
54
57
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eslint-plugin-use-agnostic",
3
- "version": "1.6.4",
3
+ "version": "1.6.6",
4
4
  "description": "Highlights problematic server-client imports in projects made with the Fullstack React Architecture.",
5
5
  "keywords": [
6
6
  "eslint",
@@ -43,6 +43,7 @@
43
43
  "test": "node tests/agnostic20/import-rules.test.js && node tests/directive21/import-rules.test.js"
44
44
  },
45
45
  "dependencies": {
46
+ "find-up": "^8.0.0",
46
47
  "get-sourcecode-from-file-path": "^1.1.2",
47
48
  "resolve-importing-path": "^1.0.3",
48
49
  "typescript-eslint": "^8.32.0"
package/types/index.d.ts CHANGED
@@ -34,6 +34,19 @@ export const EXTENSIONS: readonly [
34
34
  ".cjs"
35
35
  ];
36
36
 
37
+ export const commentedDirectives_commentedModules: Readonly<{
38
+ "use server logics": "Server Logics Module";
39
+ "use client logics": "Client Logics Module";
40
+ "use agnostic logics": "Agnostic Logics Module";
41
+ "use server components": "Server Components Module";
42
+ "use client components": "Client Components Module";
43
+ "use agnostic components": "Agnostic Components Module";
44
+ "use server functions": "Server Functions Module";
45
+ "use client contexts": "Client Contexts Module";
46
+ "use agnostic conditions": "Agnostic Conditions Module";
47
+ "use agnostic strategies": "Agnostic Strategies Module";
48
+ }>;
49
+
37
50
  // agnostic20
38
51
 
39
52
  // directives