@n8n/eslint-plugin-community-nodes 0.8.0 → 0.10.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 +17 -13
- package/dist/plugin.d.ts +18 -0
- package/dist/plugin.d.ts.map +1 -1
- package/dist/plugin.js +6 -0
- package/dist/plugin.js.map +1 -1
- package/dist/rules/cred-class-field-icon-missing.d.ts +2 -0
- package/dist/rules/cred-class-field-icon-missing.d.ts.map +1 -0
- package/dist/rules/cred-class-field-icon-missing.js +51 -0
- package/dist/rules/cred-class-field-icon-missing.js.map +1 -0
- package/dist/rules/icon-validation.d.ts +1 -1
- package/dist/rules/index.d.ts +4 -1
- package/dist/rules/index.d.ts.map +1 -1
- package/dist/rules/index.js +6 -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/node-class-description-icon-missing.d.ts +2 -0
- package/dist/rules/node-class-description-icon-missing.d.ts.map +1 -0
- package/dist/rules/node-class-description-icon-missing.js +57 -0
- package/dist/rules/node-class-description-icon-missing.js.map +1 -0
- package/dist/utils/ast-utils.d.ts +6 -0
- package/dist/utils/ast-utils.d.ts.map +1 -1
- package/dist/utils/ast-utils.js +21 -0
- package/dist/utils/ast-utils.js.map +1 -1
- package/docs/rules/ai-node-package-json.md +62 -0
- package/docs/rules/cred-class-field-icon-missing.md +47 -0
- package/docs/rules/credential-documentation-url.md +5 -3
- package/docs/rules/no-http-request-with-manual-auth.md +57 -0
- package/docs/rules/node-class-description-icon-missing.md +52 -0
- package/package.json +1 -1
- package/src/plugin.ts +6 -0
- package/src/rules/cred-class-field-icon-missing.test.ts +96 -0
- package/src/rules/cred-class-field-icon-missing.ts +59 -0
- package/src/rules/index.ts +6 -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/node-class-description-icon-missing.test.ts +113 -0
- package/src/rules/node-class-description-icon-missing.ts +71 -0
- package/src/utils/ast-utils.ts +30 -0
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.10.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,22 @@ 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
|
-
| [
|
|
50
|
-
| [credential-
|
|
51
|
-
| [
|
|
52
|
-
| [
|
|
53
|
-
| [
|
|
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
|
+
| [cred-class-field-icon-missing](docs/rules/cred-class-field-icon-missing.md) | Credential class must have an `icon` property defined | ✅ ☑️ | | | 💡 |
|
|
50
|
+
| [credential-documentation-url](docs/rules/credential-documentation-url.md) | Enforce valid credential documentationUrl format (URL or lowercase alphanumeric slug) | ✅ ☑️ | | 🔧 | |
|
|
51
|
+
| [credential-password-field](docs/rules/credential-password-field.md) | Ensure credential fields with sensitive names have typeOptions.password = true | ✅ ☑️ | | 🔧 | |
|
|
52
|
+
| [credential-test-required](docs/rules/credential-test-required.md) | Ensure credentials have a credential test | ✅ ☑️ | | | 💡 |
|
|
53
|
+
| [icon-validation](docs/rules/icon-validation.md) | Validate node and credential icon files exist, are SVG format, and light/dark icons are different | ✅ ☑️ | | | 💡 |
|
|
54
|
+
| [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 | ✅ ☑️ | | | 💡 |
|
|
55
|
+
| [no-deprecated-workflow-functions](docs/rules/no-deprecated-workflow-functions.md) | Disallow usage of deprecated functions and types from n8n-workflow package | ✅ ☑️ | | | 💡 |
|
|
56
|
+
| [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. | ✅ ☑️ | | | |
|
|
57
|
+
| [no-restricted-globals](docs/rules/no-restricted-globals.md) | Disallow usage of restricted global variables in community nodes. | ✅ | | | |
|
|
58
|
+
| [no-restricted-imports](docs/rules/no-restricted-imports.md) | Disallow usage of restricted imports in community nodes. | ✅ | | | |
|
|
59
|
+
| [node-class-description-icon-missing](docs/rules/node-class-description-icon-missing.md) | Node class description must have an `icon` property defined | ✅ ☑️ | | | 💡 |
|
|
60
|
+
| [node-usable-as-tool](docs/rules/node-usable-as-tool.md) | Ensure node classes have usableAsTool property | ✅ ☑️ | | 🔧 | |
|
|
61
|
+
| [package-name-convention](docs/rules/package-name-convention.md) | Enforce correct package naming convention for n8n community nodes | ✅ ☑️ | | | 💡 |
|
|
62
|
+
| [resource-operation-pattern](docs/rules/resource-operation-pattern.md) | Enforce proper resource/operation pattern for better UX in n8n nodes | | ✅ ☑️ | | |
|
|
59
63
|
|
|
60
64
|
<!-- end auto-generated rules list -->
|
package/dist/plugin.d.ts
CHANGED
|
@@ -23,9 +23,12 @@ declare const configs: {
|
|
|
23
23
|
'@n8n/community-nodes/package-name-convention': "error";
|
|
24
24
|
'@n8n/community-nodes/credential-test-required': "error";
|
|
25
25
|
'@n8n/community-nodes/no-credential-reuse': "error";
|
|
26
|
+
'@n8n/community-nodes/no-http-request-with-manual-auth': "error";
|
|
26
27
|
'@n8n/community-nodes/icon-validation': "error";
|
|
27
28
|
'@n8n/community-nodes/resource-operation-pattern': "warn";
|
|
28
29
|
'@n8n/community-nodes/credential-documentation-url': "error";
|
|
30
|
+
'@n8n/community-nodes/node-class-description-icon-missing': "error";
|
|
31
|
+
'@n8n/community-nodes/cred-class-field-icon-missing': "error";
|
|
29
32
|
};
|
|
30
33
|
};
|
|
31
34
|
recommendedWithoutN8nCloudSupport: {
|
|
@@ -48,9 +51,12 @@ declare const configs: {
|
|
|
48
51
|
'@n8n/community-nodes/package-name-convention': "error";
|
|
49
52
|
'@n8n/community-nodes/credential-test-required': "error";
|
|
50
53
|
'@n8n/community-nodes/no-credential-reuse': "error";
|
|
54
|
+
'@n8n/community-nodes/no-http-request-with-manual-auth': "error";
|
|
51
55
|
'@n8n/community-nodes/icon-validation': "error";
|
|
52
56
|
'@n8n/community-nodes/credential-documentation-url': "error";
|
|
53
57
|
'@n8n/community-nodes/resource-operation-pattern': "warn";
|
|
58
|
+
'@n8n/community-nodes/node-class-description-icon-missing': "error";
|
|
59
|
+
'@n8n/community-nodes/cred-class-field-icon-missing': "error";
|
|
54
60
|
};
|
|
55
61
|
};
|
|
56
62
|
};
|
|
@@ -78,9 +84,12 @@ declare const pluginWithConfigs: {
|
|
|
78
84
|
'@n8n/community-nodes/package-name-convention': "error";
|
|
79
85
|
'@n8n/community-nodes/credential-test-required': "error";
|
|
80
86
|
'@n8n/community-nodes/no-credential-reuse': "error";
|
|
87
|
+
'@n8n/community-nodes/no-http-request-with-manual-auth': "error";
|
|
81
88
|
'@n8n/community-nodes/icon-validation': "error";
|
|
82
89
|
'@n8n/community-nodes/resource-operation-pattern': "warn";
|
|
83
90
|
'@n8n/community-nodes/credential-documentation-url': "error";
|
|
91
|
+
'@n8n/community-nodes/node-class-description-icon-missing': "error";
|
|
92
|
+
'@n8n/community-nodes/cred-class-field-icon-missing': "error";
|
|
84
93
|
};
|
|
85
94
|
};
|
|
86
95
|
recommendedWithoutN8nCloudSupport: {
|
|
@@ -103,9 +112,12 @@ declare const pluginWithConfigs: {
|
|
|
103
112
|
'@n8n/community-nodes/package-name-convention': "error";
|
|
104
113
|
'@n8n/community-nodes/credential-test-required': "error";
|
|
105
114
|
'@n8n/community-nodes/no-credential-reuse': "error";
|
|
115
|
+
'@n8n/community-nodes/no-http-request-with-manual-auth': "error";
|
|
106
116
|
'@n8n/community-nodes/icon-validation': "error";
|
|
107
117
|
'@n8n/community-nodes/credential-documentation-url': "error";
|
|
108
118
|
'@n8n/community-nodes/resource-operation-pattern': "warn";
|
|
119
|
+
'@n8n/community-nodes/node-class-description-icon-missing': "error";
|
|
120
|
+
'@n8n/community-nodes/cred-class-field-icon-missing': "error";
|
|
109
121
|
};
|
|
110
122
|
};
|
|
111
123
|
};
|
|
@@ -140,9 +152,12 @@ declare const n8nCommunityNodesPlugin: {
|
|
|
140
152
|
'@n8n/community-nodes/package-name-convention': "error";
|
|
141
153
|
'@n8n/community-nodes/credential-test-required': "error";
|
|
142
154
|
'@n8n/community-nodes/no-credential-reuse': "error";
|
|
155
|
+
'@n8n/community-nodes/no-http-request-with-manual-auth': "error";
|
|
143
156
|
'@n8n/community-nodes/icon-validation': "error";
|
|
144
157
|
'@n8n/community-nodes/resource-operation-pattern': "warn";
|
|
145
158
|
'@n8n/community-nodes/credential-documentation-url': "error";
|
|
159
|
+
'@n8n/community-nodes/node-class-description-icon-missing': "error";
|
|
160
|
+
'@n8n/community-nodes/cred-class-field-icon-missing': "error";
|
|
146
161
|
};
|
|
147
162
|
};
|
|
148
163
|
recommendedWithoutN8nCloudSupport: {
|
|
@@ -165,9 +180,12 @@ declare const n8nCommunityNodesPlugin: {
|
|
|
165
180
|
'@n8n/community-nodes/package-name-convention': "error";
|
|
166
181
|
'@n8n/community-nodes/credential-test-required': "error";
|
|
167
182
|
'@n8n/community-nodes/no-credential-reuse': "error";
|
|
183
|
+
'@n8n/community-nodes/no-http-request-with-manual-auth': "error";
|
|
168
184
|
'@n8n/community-nodes/icon-validation': "error";
|
|
169
185
|
'@n8n/community-nodes/credential-documentation-url': "error";
|
|
170
186
|
'@n8n/community-nodes/resource-operation-pattern': "warn";
|
|
187
|
+
'@n8n/community-nodes/node-class-description-icon-missing': "error";
|
|
188
|
+
'@n8n/community-nodes/cred-class-field-icon-missing': "error";
|
|
171
189
|
};
|
|
172
190
|
};
|
|
173
191
|
};
|
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;;;;;;;;;;;;;;;;;;;CAgDE,CAAC;AAE1C,QAAA,MAAM,iBAAiB;;;;;;;;;;;2BAlDN,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2BAAtB,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;WAAtB,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC;CAkDiC,CAAC;AAEzE,QAAA,MAAM,uBAAuB;;;;;;;;;;;2BApDZ,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2BAAtB,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;WAAtB,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC;CAoDU,CAAC;AAClD,eAAe,iBAAiB,CAAC;AACjC,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,uBAAuB,EAAE,CAAC"}
|
package/dist/plugin.js
CHANGED
|
@@ -25,9 +25,12 @@ const configs = {
|
|
|
25
25
|
'@n8n/community-nodes/package-name-convention': 'error',
|
|
26
26
|
'@n8n/community-nodes/credential-test-required': 'error',
|
|
27
27
|
'@n8n/community-nodes/no-credential-reuse': 'error',
|
|
28
|
+
'@n8n/community-nodes/no-http-request-with-manual-auth': 'error',
|
|
28
29
|
'@n8n/community-nodes/icon-validation': 'error',
|
|
29
30
|
'@n8n/community-nodes/resource-operation-pattern': 'warn',
|
|
30
31
|
'@n8n/community-nodes/credential-documentation-url': 'error',
|
|
32
|
+
'@n8n/community-nodes/node-class-description-icon-missing': 'error',
|
|
33
|
+
'@n8n/community-nodes/cred-class-field-icon-missing': 'error',
|
|
31
34
|
},
|
|
32
35
|
},
|
|
33
36
|
recommendedWithoutN8nCloudSupport: {
|
|
@@ -43,9 +46,12 @@ const configs = {
|
|
|
43
46
|
'@n8n/community-nodes/package-name-convention': 'error',
|
|
44
47
|
'@n8n/community-nodes/credential-test-required': 'error',
|
|
45
48
|
'@n8n/community-nodes/no-credential-reuse': 'error',
|
|
49
|
+
'@n8n/community-nodes/no-http-request-with-manual-auth': 'error',
|
|
46
50
|
'@n8n/community-nodes/icon-validation': 'error',
|
|
47
51
|
'@n8n/community-nodes/credential-documentation-url': 'error',
|
|
48
52
|
'@n8n/community-nodes/resource-operation-pattern': 'warn',
|
|
53
|
+
'@n8n/community-nodes/node-class-description-icon-missing': 'error',
|
|
54
|
+
'@n8n/community-nodes/cred-class-field-icon-missing': 'error',
|
|
49
55
|
},
|
|
50
56
|
},
|
|
51
57
|
};
|
package/dist/plugin.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.js","sourceRoot":"","sources":["../src/plugin.ts"],"names":[],"mappings":"AAEA,OAAO,GAAG,MAAM,iBAAiB,CAAC,OAAO,IAAI,EAAE,MAAM,EAAE,CAAC;AACxD,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAEzC,MAAM,MAAM,GAAG;IACd,IAAI,EAAE;QACL,IAAI,EAAE,GAAG,CAAC,IAAI;QACd,OAAO,EAAE,GAAG,CAAC,OAAO;QACpB,SAAS,EAAE,sBAAsB;KACjC;IACD,8EAA8E;IAC9E,KAAK,EAAE,KAA+B;CACd,CAAC;AAE1B,MAAM,OAAO,GAAG;IACf,WAAW,EAAE;QACZ,OAAO,EAAE,CAAC,+BAA+B,CAAC;QAC1C,OAAO,EAAE;YACR,sBAAsB,EAAE,MAAM;SAC9B;QACD,KAAK,EAAE;YACN,2CAA2C,EAAE,OAAO;YACpD,4CAA4C,EAAE,OAAO;YACrD,4CAA4C,EAAE,OAAO;YACrD,gDAAgD,EAAE,OAAO;YACzD,uDAAuD,EAAE,OAAO;YAChE,0CAA0C,EAAE,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D,KAAK,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;YACzD,0DAA0D,EAAE,OAAO;YACnE,oDAAoD,EAAE,OAAO;SAC7D;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 @@
|
|
|
1
|
+
{"version":3,"file":"cred-class-field-icon-missing.d.ts","sourceRoot":"","sources":["../../src/rules/cred-class-field-icon-missing.ts"],"names":[],"mappings":"AAOA,eAAO,MAAM,6BAA6B,mKAmDxC,CAAC"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { isCredentialTypeClass, findClassProperty, isFileType, createRule, } from '../utils/index.js';
|
|
2
|
+
export const CredClassFieldIconMissingRule = createRule({
|
|
3
|
+
name: 'cred-class-field-icon-missing',
|
|
4
|
+
meta: {
|
|
5
|
+
type: 'problem',
|
|
6
|
+
docs: {
|
|
7
|
+
description: 'Credential class must have an `icon` property defined',
|
|
8
|
+
},
|
|
9
|
+
messages: {
|
|
10
|
+
missingIcon: 'Credential class is missing required `icon` property',
|
|
11
|
+
addPlaceholder: 'Add icon property with placeholder',
|
|
12
|
+
},
|
|
13
|
+
schema: [],
|
|
14
|
+
hasSuggestions: true,
|
|
15
|
+
},
|
|
16
|
+
defaultOptions: [],
|
|
17
|
+
create(context) {
|
|
18
|
+
if (!isFileType(context.filename, '.credentials.ts')) {
|
|
19
|
+
return {};
|
|
20
|
+
}
|
|
21
|
+
return {
|
|
22
|
+
ClassDeclaration(node) {
|
|
23
|
+
if (!isCredentialTypeClass(node)) {
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
const iconProperty = findClassProperty(node, 'icon');
|
|
27
|
+
if (iconProperty?.value) {
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
context.report({
|
|
31
|
+
node,
|
|
32
|
+
messageId: 'missingIcon',
|
|
33
|
+
suggest: [
|
|
34
|
+
{
|
|
35
|
+
messageId: 'addPlaceholder',
|
|
36
|
+
fix(fixer) {
|
|
37
|
+
const classBody = node.body.body;
|
|
38
|
+
const lastProperty = classBody[classBody.length - 1];
|
|
39
|
+
if (lastProperty) {
|
|
40
|
+
return fixer.insertTextAfter(lastProperty, '\n\n\ticon = "file:./icon.svg";');
|
|
41
|
+
}
|
|
42
|
+
return null;
|
|
43
|
+
},
|
|
44
|
+
},
|
|
45
|
+
],
|
|
46
|
+
});
|
|
47
|
+
},
|
|
48
|
+
};
|
|
49
|
+
},
|
|
50
|
+
});
|
|
51
|
+
//# sourceMappingURL=cred-class-field-icon-missing.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cred-class-field-icon-missing.js","sourceRoot":"","sources":["../../src/rules/cred-class-field-icon-missing.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,qBAAqB,EACrB,iBAAiB,EACjB,UAAU,EACV,UAAU,GACV,MAAM,mBAAmB,CAAC;AAE3B,MAAM,CAAC,MAAM,6BAA6B,GAAG,UAAU,CAAC;IACvD,IAAI,EAAE,+BAA+B;IACrC,IAAI,EAAE;QACL,IAAI,EAAE,SAAS;QACf,IAAI,EAAE;YACL,WAAW,EAAE,uDAAuD;SACpE;QACD,QAAQ,EAAE;YACT,WAAW,EAAE,sDAAsD;YACnE,cAAc,EAAE,oCAAoC;SACpD;QACD,MAAM,EAAE,EAAE;QACV,cAAc,EAAE,IAAI;KACpB;IACD,cAAc,EAAE,EAAE;IAClB,MAAM,CAAC,OAAO;QACb,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,QAAQ,EAAE,iBAAiB,CAAC,EAAE,CAAC;YACtD,OAAO,EAAE,CAAC;QACX,CAAC;QAED,OAAO;YACN,gBAAgB,CAAC,IAAI;gBACpB,IAAI,CAAC,qBAAqB,CAAC,IAAI,CAAC,EAAE,CAAC;oBAClC,OAAO;gBACR,CAAC;gBAED,MAAM,YAAY,GAAG,iBAAiB,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;gBACrD,IAAI,YAAY,EAAE,KAAK,EAAE,CAAC;oBACzB,OAAO;gBACR,CAAC;gBAED,OAAO,CAAC,MAAM,CAAC;oBACd,IAAI;oBACJ,SAAS,EAAE,aAAa;oBACxB,OAAO,EAAE;wBACR;4BACC,SAAS,EAAE,gBAAgB;4BAC3B,GAAG,CAAC,KAAK;gCACR,MAAM,SAAS,GAAG,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC;gCACjC,MAAM,YAAY,GAAG,SAAS,CAAC,SAAS,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;gCACrD,IAAI,YAAY,EAAE,CAAC;oCAClB,OAAO,KAAK,CAAC,eAAe,CAAC,YAAY,EAAE,iCAAiC,CAAC,CAAC;gCAC/E,CAAC;gCACD,OAAO,IAAI,CAAC;4BACb,CAAC;yBACD;qBACD;iBACD,CAAC,CAAC;YACJ,CAAC;SACD,CAAC;IACH,CAAC;CACD,CAAC,CAAC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const IconValidationRule: import("@typescript-eslint/utils/ts-eslint").RuleModule<"
|
|
1
|
+
export declare const IconValidationRule: import("@typescript-eslint/utils/ts-eslint").RuleModule<"missingIcon" | "addPlaceholder" | "iconFileNotFound" | "iconNotSvg" | "lightDarkSame" | "invalidIconPath" | "addFileProtocol" | "changeExtension" | "similarIcon", [], unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
|
|
2
2
|
//# sourceMappingURL=icon-validation.d.ts.map
|
package/dist/rules/index.d.ts
CHANGED
|
@@ -8,11 +8,14 @@ export declare const rules: {
|
|
|
8
8
|
'package-name-convention': import("@typescript-eslint/utils/ts-eslint").RuleModule<"renameTo" | "invalidPackageName", [], unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
|
|
9
9
|
'credential-test-required': import("@typescript-eslint/utils/ts-eslint").RuleModule<"addTemplate" | "missingCredentialTest", [], unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
|
|
10
10
|
'no-credential-reuse': import("@typescript-eslint/utils/ts-eslint").RuleModule<"didYouMean" | "useAvailable" | "credentialNotInPackage", [], unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
|
|
11
|
-
'
|
|
11
|
+
'no-http-request-with-manual-auth': import("@typescript-eslint/utils/ts-eslint").RuleModule<"useHttpRequestWithAuthentication", [], unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
|
|
12
|
+
'icon-validation': import("@typescript-eslint/utils/ts-eslint").RuleModule<"missingIcon" | "addPlaceholder" | "iconFileNotFound" | "iconNotSvg" | "lightDarkSame" | "invalidIconPath" | "addFileProtocol" | "changeExtension" | "similarIcon", [], unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
|
|
12
13
|
'resource-operation-pattern': import("@typescript-eslint/utils/ts-eslint").RuleModule<"tooManyOperationsWithoutResources", [], unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
|
|
13
14
|
'credential-documentation-url': import("@typescript-eslint/utils/ts-eslint").RuleModule<"invalidDocumentationUrl", [{
|
|
14
15
|
allowUrls?: boolean;
|
|
15
16
|
allowSlugs?: boolean;
|
|
16
17
|
}], unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
|
|
18
|
+
'node-class-description-icon-missing': import("@typescript-eslint/utils/ts-eslint").RuleModule<"missingIcon" | "addPlaceholder", [], unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
|
|
19
|
+
'cred-class-field-icon-missing': import("@typescript-eslint/utils/ts-eslint").RuleModule<"missingIcon" | "addPlaceholder", [], unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
|
|
17
20
|
};
|
|
18
21
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -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":"AAkBA,eAAO,MAAM,KAAK;;;;;;;;;;;;;;;;;;;CAgBuB,CAAC"}
|
package/dist/rules/index.js
CHANGED
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
import { AiNodePackageJsonRule } from './ai-node-package-json.js';
|
|
2
|
+
import { CredClassFieldIconMissingRule } from './cred-class-field-icon-missing.js';
|
|
2
3
|
import { CredentialDocumentationUrlRule } from './credential-documentation-url.js';
|
|
3
4
|
import { CredentialPasswordFieldRule } from './credential-password-field.js';
|
|
4
5
|
import { CredentialTestRequiredRule } from './credential-test-required.js';
|
|
5
6
|
import { IconValidationRule } from './icon-validation.js';
|
|
6
7
|
import { NoCredentialReuseRule } from './no-credential-reuse.js';
|
|
7
8
|
import { NoDeprecatedWorkflowFunctionsRule } from './no-deprecated-workflow-functions.js';
|
|
9
|
+
import { NoHttpRequestWithManualAuthRule } from './no-http-request-with-manual-auth.js';
|
|
8
10
|
import { NoRestrictedGlobalsRule } from './no-restricted-globals.js';
|
|
9
11
|
import { NoRestrictedImportsRule } from './no-restricted-imports.js';
|
|
12
|
+
import { NodeClassDescriptionIconMissingRule } from './node-class-description-icon-missing.js';
|
|
10
13
|
import { NodeUsableAsToolRule } from './node-usable-as-tool.js';
|
|
11
14
|
import { PackageNameConventionRule } from './package-name-convention.js';
|
|
12
15
|
import { ResourceOperationPatternRule } from './resource-operation-pattern.js';
|
|
@@ -20,8 +23,11 @@ export const rules = {
|
|
|
20
23
|
'package-name-convention': PackageNameConventionRule,
|
|
21
24
|
'credential-test-required': CredentialTestRequiredRule,
|
|
22
25
|
'no-credential-reuse': NoCredentialReuseRule,
|
|
26
|
+
'no-http-request-with-manual-auth': NoHttpRequestWithManualAuthRule,
|
|
23
27
|
'icon-validation': IconValidationRule,
|
|
24
28
|
'resource-operation-pattern': ResourceOperationPatternRule,
|
|
25
29
|
'credential-documentation-url': CredentialDocumentationUrlRule,
|
|
30
|
+
'node-class-description-icon-missing': NodeClassDescriptionIconMissingRule,
|
|
31
|
+
'cred-class-field-icon-missing': CredClassFieldIconMissingRule,
|
|
26
32
|
};
|
|
27
33
|
//# sourceMappingURL=index.js.map
|
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,qBAAqB,EAAE,MAAM,2BAA2B,CAAC;AAClE,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,uBAAuB,EAAE,MAAM,4BAA4B,CAAC;AACrE,OAAO,EAAE,uBAAuB,EAAE,MAAM,4BAA4B,CAAC;AACrE,OAAO,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AAChE,OAAO,EAAE,yBAAyB,EAAE,MAAM,8BAA8B,CAAC;AACzE,OAAO,EAAE,4BAA4B,EAAE,MAAM,iCAAiC,CA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,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;IAC9D,qCAAqC,EAAE,mCAAmC;IAC1E,+BAA+B,EAAE,6BAA6B;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,UAAU,CAAC;IAC3D,IAAI,EAAE,kCAAkC;IAC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,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,uBAAuB,EAAE,gBAAgB,EAAE,MAAM,mBAAmB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BAAgB,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"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export declare const NodeClassDescriptionIconMissingRule: import("@typescript-eslint/utils/ts-eslint").RuleModule<"missingIcon" | "addPlaceholder", [], unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
|
|
2
|
+
//# sourceMappingURL=node-class-description-icon-missing.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"node-class-description-icon-missing.d.ts","sourceRoot":"","sources":["../../src/rules/node-class-description-icon-missing.ts"],"names":[],"mappings":"AAUA,eAAO,MAAM,mCAAmC,mKA4D9C,CAAC"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { TSESTree } from '@typescript-eslint/utils';
|
|
2
|
+
import { isNodeTypeClass, findClassProperty, findObjectProperty, isFileType, createRule, } from '../utils/index.js';
|
|
3
|
+
export const NodeClassDescriptionIconMissingRule = createRule({
|
|
4
|
+
name: 'node-class-description-icon-missing',
|
|
5
|
+
meta: {
|
|
6
|
+
type: 'problem',
|
|
7
|
+
docs: {
|
|
8
|
+
description: 'Node class description must have an `icon` property defined',
|
|
9
|
+
},
|
|
10
|
+
messages: {
|
|
11
|
+
missingIcon: 'Node class description is missing required `icon` property',
|
|
12
|
+
addPlaceholder: 'Add icon property with placeholder',
|
|
13
|
+
},
|
|
14
|
+
schema: [],
|
|
15
|
+
hasSuggestions: true,
|
|
16
|
+
},
|
|
17
|
+
defaultOptions: [],
|
|
18
|
+
create(context) {
|
|
19
|
+
if (!isFileType(context.filename, '.node.ts')) {
|
|
20
|
+
return {};
|
|
21
|
+
}
|
|
22
|
+
return {
|
|
23
|
+
ClassDeclaration(node) {
|
|
24
|
+
if (!isNodeTypeClass(node)) {
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
const descriptionProperty = findClassProperty(node, 'description');
|
|
28
|
+
if (!descriptionProperty?.value ||
|
|
29
|
+
descriptionProperty.value.type !== TSESTree.AST_NODE_TYPES.ObjectExpression) {
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
const descriptionValue = descriptionProperty.value;
|
|
33
|
+
const iconProperty = findObjectProperty(descriptionValue, 'icon');
|
|
34
|
+
if (iconProperty) {
|
|
35
|
+
return;
|
|
36
|
+
}
|
|
37
|
+
context.report({
|
|
38
|
+
node,
|
|
39
|
+
messageId: 'missingIcon',
|
|
40
|
+
suggest: [
|
|
41
|
+
{
|
|
42
|
+
messageId: 'addPlaceholder',
|
|
43
|
+
fix(fixer) {
|
|
44
|
+
const lastProperty = descriptionValue.properties[descriptionValue.properties.length - 1];
|
|
45
|
+
if (lastProperty) {
|
|
46
|
+
return fixer.insertTextAfter(lastProperty, ',\n\t\ticon: "file:./icon.svg"');
|
|
47
|
+
}
|
|
48
|
+
return null;
|
|
49
|
+
},
|
|
50
|
+
},
|
|
51
|
+
],
|
|
52
|
+
});
|
|
53
|
+
},
|
|
54
|
+
};
|
|
55
|
+
},
|
|
56
|
+
});
|
|
57
|
+
//# sourceMappingURL=node-class-description-icon-missing.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"node-class-description-icon-missing.js","sourceRoot":"","sources":["../../src/rules/node-class-description-icon-missing.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAEpD,OAAO,EACN,eAAe,EACf,iBAAiB,EACjB,kBAAkB,EAClB,UAAU,EACV,UAAU,GACV,MAAM,mBAAmB,CAAC;AAE3B,MAAM,CAAC,MAAM,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,EAAE,CAAC;oCAClB,OAAO,KAAK,CAAC,eAAe,CAAC,YAAY,EAAE,gCAAgC,CAAC,CAAC;gCAC9E,CAAC;gCACD,OAAO,IAAI,CAAC;4BACb,CAAC;yBACD;qBACD;iBACD,CAAC,CAAC;YACJ,CAAC;SACD,CAAC;IACH,CAAC;CACD,CAAC,CAAC"}
|
|
@@ -23,5 +23,11 @@ export declare function extractCredentialNameFromArray(element: TSESTree.ArrayEx
|
|
|
23
23
|
name: string;
|
|
24
24
|
node: TSESTree.Node;
|
|
25
25
|
} | null;
|
|
26
|
+
/** Matches the `this.helpers` MemberExpression (the object part of `this.helpers.foo`). */
|
|
27
|
+
export declare function isThisHelpersAccess(node: TSESTree.MemberExpression): boolean;
|
|
28
|
+
/** Matches a call expression of the form `this.methodName(...)`. */
|
|
29
|
+
export declare function isThisMethodCall(node: TSESTree.CallExpression, method: string): boolean;
|
|
30
|
+
/** Matches a call expression of the form `this.helpers.methodName(...)`. */
|
|
31
|
+
export declare function isThisHelpersMethodCall(node: TSESTree.CallExpression, method: string): boolean;
|
|
26
32
|
export declare function findSimilarStrings(target: string, candidates: Set<string>, maxDistance?: number, maxResults?: number): string[];
|
|
27
33
|
//# sourceMappingURL=ast-utils.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ast-utils.d.ts","sourceRoot":"","sources":["../../src/utils/ast-utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAezD,wBAAgB,eAAe,CAAC,IAAI,EAAE,QAAQ,CAAC,gBAAgB,GAAG,OAAO,CAUxE;AAED,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,QAAQ,CAAC,gBAAgB,GAAG,OAAO,CAE9E;AAED,wBAAgB,iBAAiB,CAChC,IAAI,EAAE,QAAQ,CAAC,gBAAgB,EAC/B,YAAY,EAAE,MAAM,GAClB,QAAQ,CAAC,kBAAkB,GAAG,IAAI,CAQpC;AA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C,GACnD;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,QAAQ,CAAC,IAAI,CAAA;CAAE,GAAG,IAAI,CA6BjE;AAED,wBAAgB,8BAA8B,CAC7C,OAAO,EAAE,QAAQ,CAAC,eAAe,CAAC,UAAU,CAAC,CAAC,MAAM,CAAC,GACnD;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,QAAQ,CAAC,IAAI,CAAA;CAAE,GAAG,IAAI,CAG9C;AAED,2FAA2F;AAC3F,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,QAAQ,CAAC,gBAAgB,GAAG,OAAO,CAO5E;AAED,oEAAoE;AACpE,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,QAAQ,CAAC,cAAc,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAOvF;AAED,4EAA4E;AAC5E,wBAAgB,uBAAuB,CAAC,IAAI,EAAE,QAAQ,CAAC,cAAc,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAO9F;AAED,wBAAgB,kBAAkB,CACjC,MAAM,EAAE,MAAM,EACd,UAAU,EAAE,GAAG,CAAC,MAAM,CAAC,EACvB,WAAW,GAAE,MAAU,EACvB,UAAU,GAAE,MAAU,GACpB,MAAM,EAAE,CAeV"}
|
package/dist/utils/ast-utils.js
CHANGED
|
@@ -125,6 +125,27 @@ export function extractCredentialNameFromArray(element) {
|
|
|
125
125
|
const info = extractCredentialInfoFromArray(element);
|
|
126
126
|
return info ? { name: info.name, node: info.node } : null;
|
|
127
127
|
}
|
|
128
|
+
/** Matches the `this.helpers` MemberExpression (the object part of `this.helpers.foo`). */
|
|
129
|
+
export function isThisHelpersAccess(node) {
|
|
130
|
+
return (node.object?.type === AST_NODE_TYPES.MemberExpression &&
|
|
131
|
+
node.object.object?.type === AST_NODE_TYPES.ThisExpression &&
|
|
132
|
+
node.object.property?.type === AST_NODE_TYPES.Identifier &&
|
|
133
|
+
node.object.property.name === 'helpers');
|
|
134
|
+
}
|
|
135
|
+
/** Matches a call expression of the form `this.methodName(...)`. */
|
|
136
|
+
export function isThisMethodCall(node, method) {
|
|
137
|
+
return (node.callee.type === AST_NODE_TYPES.MemberExpression &&
|
|
138
|
+
node.callee.object.type === AST_NODE_TYPES.ThisExpression &&
|
|
139
|
+
node.callee.property.type === AST_NODE_TYPES.Identifier &&
|
|
140
|
+
node.callee.property.name === method);
|
|
141
|
+
}
|
|
142
|
+
/** Matches a call expression of the form `this.helpers.methodName(...)`. */
|
|
143
|
+
export function isThisHelpersMethodCall(node, method) {
|
|
144
|
+
return (node.callee.type === AST_NODE_TYPES.MemberExpression &&
|
|
145
|
+
node.callee.property.type === AST_NODE_TYPES.Identifier &&
|
|
146
|
+
node.callee.property.name === method &&
|
|
147
|
+
isThisHelpersAccess(node.callee));
|
|
148
|
+
}
|
|
128
149
|
export function findSimilarStrings(target, candidates, maxDistance = 3, maxResults = 3) {
|
|
129
150
|
const matches = [];
|
|
130
151
|
for (const candidate of candidates) {
|