@n8n/eslint-plugin-community-nodes 0.7.0 → 0.9.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/.turbo/turbo-build.log +1 -1
- package/README.md +15 -13
- package/dist/plugin.d.ts +12 -0
- package/dist/plugin.d.ts.map +1 -1
- package/dist/plugin.js +4 -0
- package/dist/plugin.js.map +1 -1
- package/dist/rules/ai-node-package-json.d.ts +2 -0
- package/dist/rules/ai-node-package-json.d.ts.map +1 -0
- package/dist/rules/ai-node-package-json.js +80 -0
- package/dist/rules/ai-node-package-json.js.map +1 -0
- package/dist/rules/index.d.ts +2 -0
- package/dist/rules/index.d.ts.map +1 -1
- package/dist/rules/index.js +4 -0
- package/dist/rules/index.js.map +1 -1
- package/dist/rules/no-deprecated-workflow-functions.d.ts.map +1 -1
- package/dist/rules/no-deprecated-workflow-functions.js +1 -13
- package/dist/rules/no-deprecated-workflow-functions.js.map +1 -1
- package/dist/rules/no-http-request-with-manual-auth.d.ts +19 -0
- package/dist/rules/no-http-request-with-manual-auth.d.ts.map +1 -0
- package/dist/rules/no-http-request-with-manual-auth.js +65 -0
- package/dist/rules/no-http-request-with-manual-auth.js.map +1 -0
- package/dist/rules/no-restricted-imports.d.ts.map +1 -1
- package/dist/rules/no-restricted-imports.js +2 -0
- package/dist/rules/no-restricted-imports.js.map +1 -1
- package/dist/rules/node-usable-as-tool.d.ts.map +1 -1
- package/dist/rules/node-usable-as-tool.js +18 -0
- package/dist/rules/node-usable-as-tool.js.map +1 -1
- package/dist/rules/package-name-convention.d.ts.map +1 -1
- package/dist/rules/package-name-convention.js +3 -5
- package/dist/rules/package-name-convention.js.map +1 -1
- package/dist/utils/ast-utils.d.ts +7 -0
- package/dist/utils/ast-utils.d.ts.map +1 -1
- package/dist/utils/ast-utils.js +27 -0
- package/dist/utils/ast-utils.js.map +1 -1
- package/docs/rules/ai-node-package-json.md +62 -0
- package/docs/rules/credential-documentation-url.md +5 -3
- package/docs/rules/no-http-request-with-manual-auth.md +57 -0
- package/package.json +2 -2
- package/src/plugin.ts +4 -0
- package/src/rules/ai-node-package-json.test.ts +111 -0
- package/src/rules/ai-node-package-json.ts +100 -0
- package/src/rules/index.ts +4 -0
- package/src/rules/no-deprecated-workflow-functions.ts +1 -17
- package/src/rules/no-http-request-with-manual-auth.test.ts +104 -0
- package/src/rules/no-http-request-with-manual-auth.ts +78 -0
- package/src/rules/no-restricted-imports.test.ts +2 -1
- package/src/rules/no-restricted-imports.ts +2 -0
- package/src/rules/node-usable-as-tool.test.ts +66 -0
- package/src/rules/node-usable-as-tool.ts +22 -0
- package/src/rules/package-name-convention.ts +3 -8
- package/src/utils/ast-utils.ts +43 -0
- package/tsconfig.build.tsbuildinfo +1 -1
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
|
|
2
|
-
> @n8n/eslint-plugin-community-nodes@0.
|
|
2
|
+
> @n8n/eslint-plugin-community-nodes@0.9.0 build /home/runner/work/n8n/n8n/packages/@n8n/eslint-plugin-community-nodes
|
|
3
3
|
> tsc --project tsconfig.build.json
|
|
4
4
|
|
package/README.md
CHANGED
|
@@ -43,18 +43,20 @@ export default [
|
|
|
43
43
|
🔧 Automatically fixable by the [`--fix` CLI option](https://eslint.org/docs/user-guide/command-line-interface#--fix).\
|
|
44
44
|
💡 Manually fixable by [editor suggestions](https://eslint.org/docs/latest/use/core-concepts#rule-suggestions).
|
|
45
45
|
|
|
46
|
-
| Name | Description
|
|
47
|
-
| :--------------------------------------------------------------------------------- |
|
|
48
|
-
| [
|
|
49
|
-
| [credential-
|
|
50
|
-
| [credential-
|
|
51
|
-
| [
|
|
52
|
-
| [
|
|
53
|
-
| [no-
|
|
54
|
-
| [no-
|
|
55
|
-
| [no-
|
|
56
|
-
| [
|
|
57
|
-
| [
|
|
58
|
-
| [
|
|
46
|
+
| Name | Description | 💼 | ⚠️ | 🔧 | 💡 |
|
|
47
|
+
| :--------------------------------------------------------------------------------- | :------------------------------------------------------------------------------------------------------------------------------------------ | :--- | :--- | :- | :- |
|
|
48
|
+
| [ai-node-package-json](docs/rules/ai-node-package-json.md) | Enforce consistency between n8n.aiNodeSdkVersion and ai-node-sdk peer dependency in community node packages | ✅ ☑️ | | | |
|
|
49
|
+
| [credential-documentation-url](docs/rules/credential-documentation-url.md) | Enforce valid credential documentationUrl format (URL or lowercase alphanumeric slug) | ✅ ☑️ | | 🔧 | |
|
|
50
|
+
| [credential-password-field](docs/rules/credential-password-field.md) | Ensure credential fields with sensitive names have typeOptions.password = true | ✅ ☑️ | | 🔧 | |
|
|
51
|
+
| [credential-test-required](docs/rules/credential-test-required.md) | Ensure credentials have a credential test | ✅ ☑️ | | | 💡 |
|
|
52
|
+
| [icon-validation](docs/rules/icon-validation.md) | Validate node and credential icon files exist, are SVG format, and light/dark icons are different | ✅ ☑️ | | | 💡 |
|
|
53
|
+
| [no-credential-reuse](docs/rules/no-credential-reuse.md) | Prevent credential re-use security issues by ensuring nodes only reference credentials from the same package | ✅ ☑️ | | | 💡 |
|
|
54
|
+
| [no-deprecated-workflow-functions](docs/rules/no-deprecated-workflow-functions.md) | Disallow usage of deprecated functions and types from n8n-workflow package | ✅ ☑️ | | | 💡 |
|
|
55
|
+
| [no-http-request-with-manual-auth](docs/rules/no-http-request-with-manual-auth.md) | Disallow this.helpers.httpRequest() in functions that call this.getCredentials(). Use this.helpers.httpRequestWithAuthentication() instead. | ✅ ☑️ | | | |
|
|
56
|
+
| [no-restricted-globals](docs/rules/no-restricted-globals.md) | Disallow usage of restricted global variables in community nodes. | ✅ | | | |
|
|
57
|
+
| [no-restricted-imports](docs/rules/no-restricted-imports.md) | Disallow usage of restricted imports in community nodes. | ✅ | | | |
|
|
58
|
+
| [node-usable-as-tool](docs/rules/node-usable-as-tool.md) | Ensure node classes have usableAsTool property | ✅ ☑️ | | 🔧 | |
|
|
59
|
+
| [package-name-convention](docs/rules/package-name-convention.md) | Enforce correct package naming convention for n8n community nodes | ✅ ☑️ | | | 💡 |
|
|
60
|
+
| [resource-operation-pattern](docs/rules/resource-operation-pattern.md) | Enforce proper resource/operation pattern for better UX in n8n nodes | | ✅ ☑️ | | |
|
|
59
61
|
|
|
60
62
|
<!-- end auto-generated rules list -->
|
package/dist/plugin.d.ts
CHANGED
|
@@ -14,6 +14,7 @@ declare const configs: {
|
|
|
14
14
|
};
|
|
15
15
|
};
|
|
16
16
|
rules: {
|
|
17
|
+
'@n8n/community-nodes/ai-node-package-json': "error";
|
|
17
18
|
'@n8n/community-nodes/no-restricted-globals': "error";
|
|
18
19
|
'@n8n/community-nodes/no-restricted-imports': "error";
|
|
19
20
|
'@n8n/community-nodes/credential-password-field': "error";
|
|
@@ -22,6 +23,7 @@ declare const configs: {
|
|
|
22
23
|
'@n8n/community-nodes/package-name-convention': "error";
|
|
23
24
|
'@n8n/community-nodes/credential-test-required': "error";
|
|
24
25
|
'@n8n/community-nodes/no-credential-reuse': "error";
|
|
26
|
+
'@n8n/community-nodes/no-http-request-with-manual-auth': "error";
|
|
25
27
|
'@n8n/community-nodes/icon-validation': "error";
|
|
26
28
|
'@n8n/community-nodes/resource-operation-pattern': "warn";
|
|
27
29
|
'@n8n/community-nodes/credential-documentation-url': "error";
|
|
@@ -40,12 +42,14 @@ declare const configs: {
|
|
|
40
42
|
};
|
|
41
43
|
};
|
|
42
44
|
rules: {
|
|
45
|
+
'@n8n/community-nodes/ai-node-package-json': "error";
|
|
43
46
|
'@n8n/community-nodes/credential-password-field': "error";
|
|
44
47
|
'@n8n/community-nodes/no-deprecated-workflow-functions': "error";
|
|
45
48
|
'@n8n/community-nodes/node-usable-as-tool': "error";
|
|
46
49
|
'@n8n/community-nodes/package-name-convention': "error";
|
|
47
50
|
'@n8n/community-nodes/credential-test-required': "error";
|
|
48
51
|
'@n8n/community-nodes/no-credential-reuse': "error";
|
|
52
|
+
'@n8n/community-nodes/no-http-request-with-manual-auth': "error";
|
|
49
53
|
'@n8n/community-nodes/icon-validation': "error";
|
|
50
54
|
'@n8n/community-nodes/credential-documentation-url': "error";
|
|
51
55
|
'@n8n/community-nodes/resource-operation-pattern': "warn";
|
|
@@ -67,6 +71,7 @@ declare const pluginWithConfigs: {
|
|
|
67
71
|
};
|
|
68
72
|
};
|
|
69
73
|
rules: {
|
|
74
|
+
'@n8n/community-nodes/ai-node-package-json': "error";
|
|
70
75
|
'@n8n/community-nodes/no-restricted-globals': "error";
|
|
71
76
|
'@n8n/community-nodes/no-restricted-imports': "error";
|
|
72
77
|
'@n8n/community-nodes/credential-password-field': "error";
|
|
@@ -75,6 +80,7 @@ declare const pluginWithConfigs: {
|
|
|
75
80
|
'@n8n/community-nodes/package-name-convention': "error";
|
|
76
81
|
'@n8n/community-nodes/credential-test-required': "error";
|
|
77
82
|
'@n8n/community-nodes/no-credential-reuse': "error";
|
|
83
|
+
'@n8n/community-nodes/no-http-request-with-manual-auth': "error";
|
|
78
84
|
'@n8n/community-nodes/icon-validation': "error";
|
|
79
85
|
'@n8n/community-nodes/resource-operation-pattern': "warn";
|
|
80
86
|
'@n8n/community-nodes/credential-documentation-url': "error";
|
|
@@ -93,12 +99,14 @@ declare const pluginWithConfigs: {
|
|
|
93
99
|
};
|
|
94
100
|
};
|
|
95
101
|
rules: {
|
|
102
|
+
'@n8n/community-nodes/ai-node-package-json': "error";
|
|
96
103
|
'@n8n/community-nodes/credential-password-field': "error";
|
|
97
104
|
'@n8n/community-nodes/no-deprecated-workflow-functions': "error";
|
|
98
105
|
'@n8n/community-nodes/node-usable-as-tool': "error";
|
|
99
106
|
'@n8n/community-nodes/package-name-convention': "error";
|
|
100
107
|
'@n8n/community-nodes/credential-test-required': "error";
|
|
101
108
|
'@n8n/community-nodes/no-credential-reuse': "error";
|
|
109
|
+
'@n8n/community-nodes/no-http-request-with-manual-auth': "error";
|
|
102
110
|
'@n8n/community-nodes/icon-validation': "error";
|
|
103
111
|
'@n8n/community-nodes/credential-documentation-url': "error";
|
|
104
112
|
'@n8n/community-nodes/resource-operation-pattern': "warn";
|
|
@@ -127,6 +135,7 @@ declare const n8nCommunityNodesPlugin: {
|
|
|
127
135
|
};
|
|
128
136
|
};
|
|
129
137
|
rules: {
|
|
138
|
+
'@n8n/community-nodes/ai-node-package-json': "error";
|
|
130
139
|
'@n8n/community-nodes/no-restricted-globals': "error";
|
|
131
140
|
'@n8n/community-nodes/no-restricted-imports': "error";
|
|
132
141
|
'@n8n/community-nodes/credential-password-field': "error";
|
|
@@ -135,6 +144,7 @@ declare const n8nCommunityNodesPlugin: {
|
|
|
135
144
|
'@n8n/community-nodes/package-name-convention': "error";
|
|
136
145
|
'@n8n/community-nodes/credential-test-required': "error";
|
|
137
146
|
'@n8n/community-nodes/no-credential-reuse': "error";
|
|
147
|
+
'@n8n/community-nodes/no-http-request-with-manual-auth': "error";
|
|
138
148
|
'@n8n/community-nodes/icon-validation': "error";
|
|
139
149
|
'@n8n/community-nodes/resource-operation-pattern': "warn";
|
|
140
150
|
'@n8n/community-nodes/credential-documentation-url': "error";
|
|
@@ -153,12 +163,14 @@ declare const n8nCommunityNodesPlugin: {
|
|
|
153
163
|
};
|
|
154
164
|
};
|
|
155
165
|
rules: {
|
|
166
|
+
'@n8n/community-nodes/ai-node-package-json': "error";
|
|
156
167
|
'@n8n/community-nodes/credential-password-field': "error";
|
|
157
168
|
'@n8n/community-nodes/no-deprecated-workflow-functions': "error";
|
|
158
169
|
'@n8n/community-nodes/node-usable-as-tool': "error";
|
|
159
170
|
'@n8n/community-nodes/package-name-convention': "error";
|
|
160
171
|
'@n8n/community-nodes/credential-test-required': "error";
|
|
161
172
|
'@n8n/community-nodes/no-credential-reuse': "error";
|
|
173
|
+
'@n8n/community-nodes/no-http-request-with-manual-auth': "error";
|
|
162
174
|
'@n8n/community-nodes/icon-validation': "error";
|
|
163
175
|
'@n8n/community-nodes/credential-documentation-url': "error";
|
|
164
176
|
'@n8n/community-nodes/resource-operation-pattern': "warn";
|
package/dist/plugin.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../src/plugin.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAU,MAAM,QAAQ,CAAC;AAG7C,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAYzC,QAAA,MAAM,OAAO;;;;;;;;;;uBAHI,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC
|
|
1
|
+
{"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../src/plugin.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAU,MAAM,QAAQ,CAAC;AAG7C,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAYzC,QAAA,MAAM,OAAO;;;;;;;;;;uBAHI,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;uBAAtB,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC;;;;;;;;;;;;;;;;;CA4CE,CAAC;AAE1C,QAAA,MAAM,iBAAiB;;;;;;;;;;;2BA9CN,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;2BAAtB,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC;;;;;;;;;;;;;;;;;;;;;;;WAAtB,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC;CA8CiC,CAAC;AAEzE,QAAA,MAAM,uBAAuB;;;;;;;;;;;2BAhDZ,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;2BAAtB,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC;;;;;;;;;;;;;;;;;;;;;;;WAAtB,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC;CAgDU,CAAC;AAClD,eAAe,iBAAiB,CAAC;AACjC,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,uBAAuB,EAAE,CAAC"}
|
package/dist/plugin.js
CHANGED
|
@@ -16,6 +16,7 @@ const configs = {
|
|
|
16
16
|
'@n8n/community-nodes': plugin,
|
|
17
17
|
},
|
|
18
18
|
rules: {
|
|
19
|
+
'@n8n/community-nodes/ai-node-package-json': 'error',
|
|
19
20
|
'@n8n/community-nodes/no-restricted-globals': 'error',
|
|
20
21
|
'@n8n/community-nodes/no-restricted-imports': 'error',
|
|
21
22
|
'@n8n/community-nodes/credential-password-field': 'error',
|
|
@@ -24,6 +25,7 @@ const configs = {
|
|
|
24
25
|
'@n8n/community-nodes/package-name-convention': 'error',
|
|
25
26
|
'@n8n/community-nodes/credential-test-required': 'error',
|
|
26
27
|
'@n8n/community-nodes/no-credential-reuse': 'error',
|
|
28
|
+
'@n8n/community-nodes/no-http-request-with-manual-auth': 'error',
|
|
27
29
|
'@n8n/community-nodes/icon-validation': 'error',
|
|
28
30
|
'@n8n/community-nodes/resource-operation-pattern': 'warn',
|
|
29
31
|
'@n8n/community-nodes/credential-documentation-url': 'error',
|
|
@@ -35,12 +37,14 @@ const configs = {
|
|
|
35
37
|
'@n8n/community-nodes': plugin,
|
|
36
38
|
},
|
|
37
39
|
rules: {
|
|
40
|
+
'@n8n/community-nodes/ai-node-package-json': 'error',
|
|
38
41
|
'@n8n/community-nodes/credential-password-field': 'error',
|
|
39
42
|
'@n8n/community-nodes/no-deprecated-workflow-functions': 'error',
|
|
40
43
|
'@n8n/community-nodes/node-usable-as-tool': 'error',
|
|
41
44
|
'@n8n/community-nodes/package-name-convention': 'error',
|
|
42
45
|
'@n8n/community-nodes/credential-test-required': 'error',
|
|
43
46
|
'@n8n/community-nodes/no-credential-reuse': 'error',
|
|
47
|
+
'@n8n/community-nodes/no-http-request-with-manual-auth': 'error',
|
|
44
48
|
'@n8n/community-nodes/icon-validation': 'error',
|
|
45
49
|
'@n8n/community-nodes/credential-documentation-url': 'error',
|
|
46
50
|
'@n8n/community-nodes/resource-operation-pattern': 'warn',
|
package/dist/plugin.js.map
CHANGED
|
@@ -1 +1 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EAAE;YACN,2CAA2C,EAAE,OAAO;YACpD,gDAAgD,EAAE,OAAO;YACzD,uDAAuD,EAAE,OAAO;YAChE,0CAA0C,EAAE,OAAO;YACnD,8CAA8C,EAAE,OAAO;YACvD,+CAA+C,EAAE,OAAO;YACxD,0CAA0C,EAAE,OAAO;YACnD,uDAAuD,EAAE,OAAO;YAChE,sCAAsC,EAAE,OAAO;YAC/C,mDAAmD,EAAE,OAAO;YAC5D,iDAAiD,EAAE,MAAM;SACzD;KACD;CACuC,CAAC;AAE1C,MAAM,iBAAiB,GAAG,EAAE,GAAG,MAAM,EAAE,OAAO,EAA0B,CAAC;AAEzE,MAAM,uBAAuB,GAAG,iBAAiB,CAAC;AAClD,eAAe,iBAAiB,CAAC;AACjC,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,uBAAuB,EAAE,CAAC"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export declare const AiNodePackageJsonRule: import("@typescript-eslint/utils/ts-eslint").RuleModule<"missingPeerDep" | "missingSdkVersion" | "invalidSdkVersion" | "wrongLocation", [], unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
|
|
2
|
+
//# sourceMappingURL=ai-node-package-json.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ai-node-package-json.d.ts","sourceRoot":"","sources":["../../src/rules/ai-node-package-json.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,qBAAqB,iNA0FhC,CAAC"}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { AST_NODE_TYPES } from '@typescript-eslint/utils';
|
|
2
|
+
import { createRule, findJsonProperty } from '../utils/index.js';
|
|
3
|
+
export const AiNodePackageJsonRule = createRule({
|
|
4
|
+
name: 'ai-node-package-json',
|
|
5
|
+
meta: {
|
|
6
|
+
type: 'problem',
|
|
7
|
+
docs: {
|
|
8
|
+
description: 'Enforce consistency between n8n.aiNodeSdkVersion and ai-node-sdk peer dependency in community node packages',
|
|
9
|
+
},
|
|
10
|
+
messages: {
|
|
11
|
+
missingPeerDep: 'Package declares "n8n.aiNodeSdkVersion" but is missing "ai-node-sdk" in peerDependencies. Add "ai-node-sdk": "*" to peerDependencies.',
|
|
12
|
+
missingSdkVersion: 'Package has "ai-node-sdk" in peerDependencies but is missing "aiNodeSdkVersion" in the "n8n" section of package.json.',
|
|
13
|
+
invalidSdkVersion: '"n8n.aiNodeSdkVersion" must be a positive integer, got {{ value }}.',
|
|
14
|
+
wrongLocation: '"aiNodeSdkVersion" must be inside the "n8n" section, not at the root level of package.json.',
|
|
15
|
+
},
|
|
16
|
+
schema: [],
|
|
17
|
+
},
|
|
18
|
+
defaultOptions: [],
|
|
19
|
+
create(context) {
|
|
20
|
+
if (!context.filename.endsWith('package.json')) {
|
|
21
|
+
return {};
|
|
22
|
+
}
|
|
23
|
+
return {
|
|
24
|
+
ObjectExpression(node) {
|
|
25
|
+
// Only process the root object, not nested ones
|
|
26
|
+
if (node.parent?.type === AST_NODE_TYPES.Property) {
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
29
|
+
const n8nProp = findJsonProperty(node, 'n8n');
|
|
30
|
+
const n8nObject = n8nProp?.value.type === AST_NODE_TYPES.ObjectExpression ? n8nProp.value : null;
|
|
31
|
+
const aiNodeSdkVersionProp = n8nObject
|
|
32
|
+
? findJsonProperty(n8nObject, 'aiNodeSdkVersion')
|
|
33
|
+
: null;
|
|
34
|
+
const rootAiNodeSdkVersionProp = findJsonProperty(node, 'aiNodeSdkVersion');
|
|
35
|
+
const peerDependenciesProp = findJsonProperty(node, 'peerDependencies');
|
|
36
|
+
const hasAiNodeSdkVersion = aiNodeSdkVersionProp !== null;
|
|
37
|
+
const hasAiNodeSdkPeerDep = peerDependenciesProp?.value.type === AST_NODE_TYPES.ObjectExpression &&
|
|
38
|
+
findJsonProperty(peerDependenciesProp.value, 'ai-node-sdk') !== null;
|
|
39
|
+
// Catch aiNodeSdkVersion placed at root level instead of inside n8n
|
|
40
|
+
if (rootAiNodeSdkVersionProp) {
|
|
41
|
+
context.report({
|
|
42
|
+
node: rootAiNodeSdkVersionProp,
|
|
43
|
+
messageId: 'wrongLocation',
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
// Validate aiNodeSdkVersion is a positive integer when present
|
|
47
|
+
if (hasAiNodeSdkVersion) {
|
|
48
|
+
const valueNode = aiNodeSdkVersionProp.value;
|
|
49
|
+
if (valueNode.type !== AST_NODE_TYPES.Literal || !isPositiveInteger(valueNode.value)) {
|
|
50
|
+
context.report({
|
|
51
|
+
node: aiNodeSdkVersionProp,
|
|
52
|
+
messageId: 'invalidSdkVersion',
|
|
53
|
+
data: {
|
|
54
|
+
value: String(valueNode.type === AST_NODE_TYPES.Literal ? valueNode.value : 'non-literal'),
|
|
55
|
+
},
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
// If aiNodeSdkVersion is declared, ai-node-sdk must be in peerDependencies
|
|
60
|
+
if (hasAiNodeSdkVersion && !hasAiNodeSdkPeerDep) {
|
|
61
|
+
context.report({
|
|
62
|
+
node: aiNodeSdkVersionProp,
|
|
63
|
+
messageId: 'missingPeerDep',
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
// If ai-node-sdk is in peerDependencies, aiNodeSdkVersion must be declared
|
|
67
|
+
if (hasAiNodeSdkPeerDep && !hasAiNodeSdkVersion) {
|
|
68
|
+
context.report({
|
|
69
|
+
node: peerDependenciesProp,
|
|
70
|
+
messageId: 'missingSdkVersion',
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
},
|
|
74
|
+
};
|
|
75
|
+
},
|
|
76
|
+
});
|
|
77
|
+
function isPositiveInteger(value) {
|
|
78
|
+
return typeof value === 'number' && Number.isInteger(value) && value > 0;
|
|
79
|
+
}
|
|
80
|
+
//# sourceMappingURL=ai-node-package-json.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ai-node-package-json.js","sourceRoot":"","sources":["../../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jD,OAAO,CAAC,MAAM,CAAC;wBACd,IAAI,EAAE,oBAAoB;wBAC1B,SAAS,EAAE,mBAAmB;qBAC9B,CAAC,CAAC;gBACJ,CAAC;YACF,CAAC;SACD,CAAC;IACH,CAAC;CACD,CAAC,CAAC;AAEH,SAAS,iBAAiB,CAAC,KAAc;IACxC,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,MAAM,CAAC,SAAS,CAAC,KAAK,CAAC,IAAI,KAAK,GAAG,CAAC,CAAC;AAC1E,CAAC"}
|
package/dist/rules/index.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export declare const rules: {
|
|
2
|
+
'ai-node-package-json': import("@typescript-eslint/utils/ts-eslint").RuleModule<"missingPeerDep" | "missingSdkVersion" | "invalidSdkVersion" | "wrongLocation", [], unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
|
|
2
3
|
'no-restricted-globals': import("@typescript-eslint/utils/ts-eslint").RuleModule<"restrictedGlobal", [], unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
|
|
3
4
|
'no-restricted-imports': import("@typescript-eslint/utils/ts-eslint").RuleModule<"restrictedImport" | "restrictedRequire" | "restrictedDynamicImport", [], unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
|
|
4
5
|
'credential-password-field': import("@typescript-eslint/utils/ts-eslint").RuleModule<"missingPasswordOption", [], unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
|
|
@@ -7,6 +8,7 @@ export declare const rules: {
|
|
|
7
8
|
'package-name-convention': import("@typescript-eslint/utils/ts-eslint").RuleModule<"renameTo" | "invalidPackageName", [], unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
|
|
8
9
|
'credential-test-required': import("@typescript-eslint/utils/ts-eslint").RuleModule<"addTemplate" | "missingCredentialTest", [], unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
|
|
9
10
|
'no-credential-reuse': import("@typescript-eslint/utils/ts-eslint").RuleModule<"didYouMean" | "useAvailable" | "credentialNotInPackage", [], unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
|
|
11
|
+
'no-http-request-with-manual-auth': import("@typescript-eslint/utils/ts-eslint").RuleModule<"useHttpRequestWithAuthentication", [], unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
|
|
10
12
|
'icon-validation': import("@typescript-eslint/utils/ts-eslint").RuleModule<"iconFileNotFound" | "iconNotSvg" | "lightDarkSame" | "invalidIconPath" | "missingIcon" | "addPlaceholder" | "addFileProtocol" | "changeExtension" | "similarIcon", [], unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
|
|
11
13
|
'resource-operation-pattern': import("@typescript-eslint/utils/ts-eslint").RuleModule<"tooManyOperationsWithoutResources", [], unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
|
|
12
14
|
'credential-documentation-url': import("@typescript-eslint/utils/ts-eslint").RuleModule<"invalidDocumentationUrl", [{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/rules/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/rules/index.ts"],"names":[],"mappings":"AAgBA,eAAO,MAAM,KAAK;;;;;;;;;;;;;;;;;CAcuB,CAAC"}
|
package/dist/rules/index.js
CHANGED
|
@@ -1,15 +1,18 @@
|
|
|
1
|
+
import { AiNodePackageJsonRule } from './ai-node-package-json.js';
|
|
1
2
|
import { CredentialDocumentationUrlRule } from './credential-documentation-url.js';
|
|
2
3
|
import { CredentialPasswordFieldRule } from './credential-password-field.js';
|
|
3
4
|
import { CredentialTestRequiredRule } from './credential-test-required.js';
|
|
4
5
|
import { IconValidationRule } from './icon-validation.js';
|
|
5
6
|
import { NoCredentialReuseRule } from './no-credential-reuse.js';
|
|
6
7
|
import { NoDeprecatedWorkflowFunctionsRule } from './no-deprecated-workflow-functions.js';
|
|
8
|
+
import { NoHttpRequestWithManualAuthRule } from './no-http-request-with-manual-auth.js';
|
|
7
9
|
import { NoRestrictedGlobalsRule } from './no-restricted-globals.js';
|
|
8
10
|
import { NoRestrictedImportsRule } from './no-restricted-imports.js';
|
|
9
11
|
import { NodeUsableAsToolRule } from './node-usable-as-tool.js';
|
|
10
12
|
import { PackageNameConventionRule } from './package-name-convention.js';
|
|
11
13
|
import { ResourceOperationPatternRule } from './resource-operation-pattern.js';
|
|
12
14
|
export const rules = {
|
|
15
|
+
'ai-node-package-json': AiNodePackageJsonRule,
|
|
13
16
|
'no-restricted-globals': NoRestrictedGlobalsRule,
|
|
14
17
|
'no-restricted-imports': NoRestrictedImportsRule,
|
|
15
18
|
'credential-password-field': CredentialPasswordFieldRule,
|
|
@@ -18,6 +21,7 @@ export const rules = {
|
|
|
18
21
|
'package-name-convention': PackageNameConventionRule,
|
|
19
22
|
'credential-test-required': CredentialTestRequiredRule,
|
|
20
23
|
'no-credential-reuse': NoCredentialReuseRule,
|
|
24
|
+
'no-http-request-with-manual-auth': NoHttpRequestWithManualAuthRule,
|
|
21
25
|
'icon-validation': IconValidationRule,
|
|
22
26
|
'resource-operation-pattern': ResourceOperationPatternRule,
|
|
23
27
|
'credential-documentation-url': CredentialDocumentationUrlRule,
|
package/dist/rules/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/rules/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,8BAA8B,EAAE,MAAM,mCAAmC,CAAC;AACnF,OAAO,EAAE,2BAA2B,EAAE,MAAM,gCAAgC,CAAC;AAC7E,OAAO,EAAE,0BAA0B,EAAE,MAAM,+BAA+B,CAAC;AAC3E,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,qBAAqB,EAAE,MAAM,0BAA0B,CAAC;AACjE,OAAO,EAAE,iCAAiC,EAAE,MAAM,uCAAuC,CAAC;AAC1F,OAAO,EAAE,uBA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AO,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AAChE,OAAO,EAAE,yBAAyB,EAAE,MAAM,8BAA8B,CAAC;AACzE,OAAO,EAAE,4BAA4B,EAAE,MAAM,iCAAiC,CAAC;AAE/E,MAAM,CAAC,MAAM,KAAK,GAAG;IACpB,sBAAsB,EAAE,qBAAqB;IAC7C,uBAAuB,EAAE,uBAAuB;IAChD,uBAAuB,EAAE,uBAAuB;IAChD,2BAA2B,EAAE,2BAA2B;IACxD,kCAAkC,EAAE,iCAAiC;IACrE,qBAAqB,EAAE,oBAAoB;IAC3C,yBAAyB,EAAE,yBAAyB;IACpD,0BAA0B,EAAE,0BAA0B;IACtD,qBAAqB,EAAE,qBAAqB;IAC5C,kCAAkC,EAAE,+BAA+B;IACnE,iBAAiB,EAAE,kBAAkB;IACrC,4BAA4B,EAAE,4BAA4B;IAC1D,8BAA8B,EAAE,8BAA8B;CACtB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"no-deprecated-workflow-functions.d.ts","sourceRoot":"","sources":["../../src/rules/no-deprecated-workflow-functions.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"no-deprecated-workflow-functions.d.ts","sourceRoot":"","sources":["../../src/rules/no-deprecated-workflow-functions.ts"],"names":[],"mappings":"AAyBA,eAAO,MAAM,iCAAiC,2RA6I5C,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { AST_NODE_TYPES } from '@typescript-eslint/utils';
|
|
2
|
-
import { createRule } from '../utils/index.js';
|
|
2
|
+
import { createRule, isThisHelpersAccess } from '../utils/index.js';
|
|
3
3
|
const DEPRECATED_FUNCTIONS = {
|
|
4
4
|
request: 'httpRequest',
|
|
5
5
|
requestWithAuthentication: 'httpRequestWithAuthentication',
|
|
@@ -141,18 +141,6 @@ export const NoDeprecatedWorkflowFunctionsRule = createRule({
|
|
|
141
141
|
};
|
|
142
142
|
},
|
|
143
143
|
});
|
|
144
|
-
/**
|
|
145
|
-
* Check if the MemberExpression follows the this.helpers.* pattern
|
|
146
|
-
*/
|
|
147
|
-
function isThisHelpersAccess(node) {
|
|
148
|
-
if (node.object?.type === AST_NODE_TYPES.MemberExpression) {
|
|
149
|
-
const outerObject = node.object;
|
|
150
|
-
return (outerObject.object?.type === AST_NODE_TYPES.ThisExpression &&
|
|
151
|
-
outerObject.property?.type === AST_NODE_TYPES.Identifier &&
|
|
152
|
-
outerObject.property.name === 'helpers');
|
|
153
|
-
}
|
|
154
|
-
return false;
|
|
155
|
-
}
|
|
156
144
|
function getDeprecationMessage(functionName) {
|
|
157
145
|
switch (functionName) {
|
|
158
146
|
case 'request':
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"no-deprecated-workflow-functions.js","sourceRoot":"","sources":["../../src/rules/no-deprecated-workflow-functions.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"no-deprecated-workflow-functions.js","sourceRoot":"","sources":["../../src/rules/no-deprecated-workflow-functions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAE1D,OAAO,EAAE,UAAU,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAEpE,MAAM,oBAAoB,GAAG;IAC5B,OAAO,EAAE,aAAa;IACtB,yBAAyB,EAAE,+BAA+B;IAC1D,aAAa,EAAE,+BAA+B;IAC9C,aAAa,EAAE,+BAA+B;IAC9C,cAAc,EAAE,IAAI;IACpB,iBAAiB,EAAE,IAAI;CACd,CAAC;AAEX,MAAM,gBAAgB,GAAG;IACxB,eAAe,EAAE,qBAAqB;CAC7B,CAAC;AAEX,SAAS,wBAAwB,CAAC,IAAY;IAC7C,OAAO,IAAI,IAAI,oBAAoB,CAAC;AACrC,CAAC;AAED,SAAS,oBAAoB,CAAC,IAAY;IACzC,OAAO,IAAI,IAAI,gBAAgB,CAAC;AACjC,CAAC;AAED,MAAM,CAAC,MAAM,iCAAiC,GAAG,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AC;gBACJ,CAAC;YACF,CAAC;SACD,CAAC;IACH,CAAC;CACD,CAAC,CAAC;AAEH,SAAS,qBAAqB,CAAC,YAAoB;IAClD,QAAQ,YAAY,EAAE,CAAC;QACtB,KAAK,SAAS;YACb,OAAO,yDAAyD,CAAC;QAClE,KAAK,2BAA2B,CAAC;QACjC,KAAK,eAAe,CAAC;QACrB,KAAK,eAAe;YACnB,OAAO,mFAAmF,CAAC;QAC5F,KAAK,gBAAgB;YACpB,OAAO,8DAA8D,CAAC;QACvE,KAAK,mBAAmB;YACvB,OAAO,wEAAwE,CAAC;QACjF;YACC,OAAO,oDAAoD,CAAC;IAC9D,CAAC;AACF,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Flags `this.helpers.httpRequest()` in functions that also call `this.getCredentials()`.
|
|
3
|
+
* Those functions should use `this.helpers.httpRequestWithAuthentication()` instead.
|
|
4
|
+
*
|
|
5
|
+
* Uses a function-scope stack: if both `getCredentials` and `httpRequest` appear in
|
|
6
|
+
* the same function body, every `httpRequest` call is reported. Nested functions are
|
|
7
|
+
* checked independently.
|
|
8
|
+
*
|
|
9
|
+
* Alternatives considered:
|
|
10
|
+
* - Checking for credential variables in `httpRequest` arguments — misses the common
|
|
11
|
+
* pattern where options are built in a separate variable first.
|
|
12
|
+
* - Matching auth header names (`Authorization`, etc.) — brittle and requires deep
|
|
13
|
+
* AST traversal with no guarantee of coverage.
|
|
14
|
+
*
|
|
15
|
+
* Known false positive: a function that fetches credentials for a non-HTTP purpose
|
|
16
|
+
* and also makes an unauthenticated request. Use eslint-disable to suppress.
|
|
17
|
+
*/
|
|
18
|
+
export declare const NoHttpRequestWithManualAuthRule: import("@typescript-eslint/utils/ts-eslint").RuleModule<"useHttpRequestWithAuthentication", [], unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
|
|
19
|
+
//# sourceMappingURL=no-http-request-with-manual-auth.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"no-http-request-with-manual-auth.d.ts","sourceRoot":"","sources":["../../src/rules/no-http-request-with-manual-auth.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAWH,eAAO,MAAM,+BAA+B,qKAkD1C,CAAC"}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Flags `this.helpers.httpRequest()` in functions that also call `this.getCredentials()`.
|
|
3
|
+
* Those functions should use `this.helpers.httpRequestWithAuthentication()` instead.
|
|
4
|
+
*
|
|
5
|
+
* Uses a function-scope stack: if both `getCredentials` and `httpRequest` appear in
|
|
6
|
+
* the same function body, every `httpRequest` call is reported. Nested functions are
|
|
7
|
+
* checked independently.
|
|
8
|
+
*
|
|
9
|
+
* Alternatives considered:
|
|
10
|
+
* - Checking for credential variables in `httpRequest` arguments — misses the common
|
|
11
|
+
* pattern where options are built in a separate variable first.
|
|
12
|
+
* - Matching auth header names (`Authorization`, etc.) — brittle and requires deep
|
|
13
|
+
* AST traversal with no guarantee of coverage.
|
|
14
|
+
*
|
|
15
|
+
* Known false positive: a function that fetches credentials for a non-HTTP purpose
|
|
16
|
+
* and also makes an unauthenticated request. Use eslint-disable to suppress.
|
|
17
|
+
*/
|
|
18
|
+
import { createRule, isThisHelpersMethodCall, isThisMethodCall } from '../utils/index.js';
|
|
19
|
+
export const NoHttpRequestWithManualAuthRule = createRule({
|
|
20
|
+
name: 'no-http-request-with-manual-auth',
|
|
21
|
+
meta: {
|
|
22
|
+
type: 'suggestion',
|
|
23
|
+
docs: {
|
|
24
|
+
description: 'Disallow this.helpers.httpRequest() in functions that call this.getCredentials(). Use this.helpers.httpRequestWithAuthentication() instead.',
|
|
25
|
+
},
|
|
26
|
+
messages: {
|
|
27
|
+
useHttpRequestWithAuthentication: "Avoid calling 'this.helpers.httpRequest()' in a function that retrieves credentials via 'this.getCredentials()'. Use 'this.helpers.httpRequestWithAuthentication()' instead — it handles authentication internally and benefits from future n8n improvements like token refresh and audit logging.",
|
|
28
|
+
},
|
|
29
|
+
schema: [],
|
|
30
|
+
hasSuggestions: false,
|
|
31
|
+
},
|
|
32
|
+
defaultOptions: [],
|
|
33
|
+
create(context) {
|
|
34
|
+
const scopeStack = [];
|
|
35
|
+
const pushScope = () => scopeStack.push({ getCredentialsCall: null, httpRequestCalls: [] });
|
|
36
|
+
const popScope = () => {
|
|
37
|
+
const scope = scopeStack.pop();
|
|
38
|
+
if (scope?.getCredentialsCall && scope.httpRequestCalls.length > 0) {
|
|
39
|
+
for (const call of scope.httpRequestCalls) {
|
|
40
|
+
context.report({ node: call, messageId: 'useHttpRequestWithAuthentication' });
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
return {
|
|
45
|
+
FunctionDeclaration: pushScope,
|
|
46
|
+
FunctionExpression: pushScope,
|
|
47
|
+
ArrowFunctionExpression: pushScope,
|
|
48
|
+
'FunctionDeclaration:exit': popScope,
|
|
49
|
+
'FunctionExpression:exit': popScope,
|
|
50
|
+
'ArrowFunctionExpression:exit': popScope,
|
|
51
|
+
CallExpression(node) {
|
|
52
|
+
const scope = scopeStack[scopeStack.length - 1];
|
|
53
|
+
if (!scope)
|
|
54
|
+
return;
|
|
55
|
+
if (isThisMethodCall(node, 'getCredentials')) {
|
|
56
|
+
scope.getCredentialsCall = node;
|
|
57
|
+
}
|
|
58
|
+
if (isThisHelpersMethodCall(node, 'httpRequest')) {
|
|
59
|
+
scope.httpRequestCalls.push(node);
|
|
60
|
+
}
|
|
61
|
+
},
|
|
62
|
+
};
|
|
63
|
+
},
|
|
64
|
+
});
|
|
65
|
+
//# sourceMappingURL=no-http-request-with-manual-auth.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"no-http-request-with-manual-auth.js","sourceRoot":"","sources":["../../src/rules/no-http-request-with-manual-auth.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAIH,OAAO,EAAE,UAAU,EAAE,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I,CAAC,KAAK;oBAAE,OAAO;gBACnB,IAAI,gBAAgB,CAAC,IAAI,EAAE,gBAAgB,CAAC,EAAE,CAAC;oBAC9C,KAAK,CAAC,kBAAkB,GAAG,IAAI,CAAC;gBACjC,CAAC;gBACD,IAAI,uBAAuB,CAAC,IAAI,EAAE,aAAa,CAAC,EAAE,CAAC;oBAClD,KAAK,CAAC,gBAAgB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;gBACnC,CAAC;YACF,CAAC;SACD,CAAC;IACH,CAAC;CACD,CAAC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"no-restricted-imports.d.ts","sourceRoot":"","sources":["../../src/rules/no-restricted-imports.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"no-restricted-imports.d.ts","sourceRoot":"","sources":["../../src/rules/no-restricted-imports.ts"],"names":[],"mappings":"AA8BA,eAAO,MAAM,uBAAuB,uMA8DlC,CAAC"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { getModulePath, isDirectRequireCall, isRequireMemberCall, createRule, } from '../utils/index.js';
|
|
2
2
|
const allowedModules = [
|
|
3
3
|
'n8n-workflow',
|
|
4
|
+
'ai-node-sdk',
|
|
4
5
|
'lodash',
|
|
5
6
|
'moment',
|
|
6
7
|
'p-limit',
|
|
@@ -8,6 +9,7 @@ const allowedModules = [
|
|
|
8
9
|
'zod',
|
|
9
10
|
'crypto',
|
|
10
11
|
'node:crypto',
|
|
12
|
+
'@n8n/ai-node-sdk',
|
|
11
13
|
];
|
|
12
14
|
const isModuleAllowed = (modulePath) => {
|
|
13
15
|
if (modulePath.startsWith('./') || modulePath.startsWith('../'))
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"no-restricted-imports.js","sourceRoot":"","sources":["../../src/rules/no-restricted-imports.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,aAAa,EACb,mBAAmB,EACnB,mBAAmB,EACnB,UAAU,GACV,MAAM,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AC;CACD,CAAC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"node-usable-as-tool.d.ts","sourceRoot":"","sources":["../../src/rules/node-usable-as-tool.ts"],"names":[],"mappings":"AASA,eAAO,MAAM,oBAAoB,
|
|
1
|
+
{"version":3,"file":"node-usable-as-tool.d.ts","sourceRoot":"","sources":["../../src/rules/node-usable-as-tool.ts"],"names":[],"mappings":"AASA,eAAO,MAAM,oBAAoB,wJAoF/B,CAAC"}
|
|
@@ -29,6 +29,24 @@ export const NodeUsableAsToolRule = createRule({
|
|
|
29
29
|
return;
|
|
30
30
|
}
|
|
31
31
|
const usableAsToolProperty = findObjectProperty(descriptionValue, 'usableAsTool');
|
|
32
|
+
const outputsProperty = findObjectProperty(descriptionValue, 'outputs');
|
|
33
|
+
const inputsProperty = findObjectProperty(descriptionValue, 'inputs');
|
|
34
|
+
if (outputsProperty?.value?.type === TSESTree.AST_NODE_TYPES.ArrayExpression &&
|
|
35
|
+
inputsProperty?.value?.type === TSESTree.AST_NODE_TYPES.ArrayExpression) {
|
|
36
|
+
const isAiOutput = outputsProperty?.value?.elements?.some((element) => {
|
|
37
|
+
const isAiOutputEnum = element?.type === TSESTree.AST_NODE_TYPES.MemberExpression &&
|
|
38
|
+
element?.object?.type === TSESTree.AST_NODE_TYPES.Identifier &&
|
|
39
|
+
element?.object?.name === 'NodeConnectionTypes' &&
|
|
40
|
+
element?.property?.type === TSESTree.AST_NODE_TYPES.Identifier &&
|
|
41
|
+
element?.property?.name !== 'Main';
|
|
42
|
+
const isAiOutputLiteral = element?.type === TSESTree.AST_NODE_TYPES.Literal && element?.value !== 'main';
|
|
43
|
+
return isAiOutputEnum || isAiOutputLiteral;
|
|
44
|
+
});
|
|
45
|
+
const isEmptyInputs = inputsProperty?.value?.elements?.length === 0;
|
|
46
|
+
if (isAiOutput && isEmptyInputs) {
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
32
50
|
if (!usableAsToolProperty) {
|
|
33
51
|
context.report({
|
|
34
52
|
node,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"node-usable-as-tool.js","sourceRoot":"","sources":["../../src/rules/node-usable-as-tool.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAEpD,OAAO,EACN,eAAe,EACf,iBAAiB,EACjB,kBAAkB,EAClB,UAAU,GACV,MAAM,mBAAmB,CAAC;AAE3B,MAAM,CAAC,MAAM,oBAAoB,GAAG,UAAU,CAAC;IAC9C,IAAI,EAAE,qBAAqB;IAC3B,IAAI,EAAE;QACL,IAAI,EAAE,SAAS;QACf,IAAI,EAAE;YACL,WAAW,EAAE,gDAAgD;SAC7D;QACD,QAAQ,EAAE;YACT,mBAAmB,EAClB,8EAA8E;SAC/E;QACD,OAAO,EAAE,MAAM;QACf,MAAM,EAAE,EAAE;KACV;IACD,cAAc,EAAE,EAAE;IAClB,MAAM,CAAC,OAAO;QACb,OAAO;YACN,gBAAgB,CAAC,IAAI;gBACpB,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,EAAE,CAAC;oBAC5B,OAAO;gBACR,CAAC;gBAED,MAAM,mBAAmB,GAAG,iBAAiB,CAAC,IAAI,EAAE,aAAa,CAAC,CAAC;gBACnE,IAAI,CAAC,mBAAmB,EAAE,CAAC;oBAC1B,OAAO;gBACR,CAAC;gBAED,MAAM,gBAAgB,GAAG,mBAAmB,CAAC,KAAK,CAAC;gBACnD,IAAI,gBAAgB,EAAE,IAAI,KAAK,QAAQ,CAAC,cAAc,CAAC,gBAAgB,EAAE,CAAC;oBACzE,OAAO;gBACR,CAAC;gBAED,MAAM,oBAAoB,GAAG,kBAAkB,CAAC,gBAAgB,EAAE,cAAc,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"node-usable-as-tool.js","sourceRoot":"","sources":["../../src/rules/node-usable-as-tool.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,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K,CAAC,oBAAoB,CAChC,CAAC,SAAS,EAAE,SAAS,CAAC,EACtB,2BAA2B,CAC3B,CAAC;gCACH,CAAC;qCAAM,CAAC;oCACP,MAAM,YAAY,GAAG,UAAU,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;oCACvC,IAAI,YAAY,EAAE,CAAC;wCAClB,OAAO,KAAK,CAAC,eAAe,CAAC,YAAY,EAAE,2BAA2B,CAAC,CAAC;oCACzE,CAAC;gCACF,CAAC;4BACF,CAAC;4BAED,OAAO,IAAI,CAAC;wBACb,CAAC;qBACD,CAAC,CAAC;gBACJ,CAAC;YACF,CAAC;SACD,CAAC;IACH,CAAC;CACD,CAAC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"package-name-convention.d.ts","sourceRoot":"","sources":["../../src/rules/package-name-convention.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,yBAAyB,
|
|
1
|
+
{"version":3,"file":"package-name-convention.d.ts","sourceRoot":"","sources":["../../src/rules/package-name-convention.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,yBAAyB,oKAqEpC,CAAC"}
|