@n8n/eslint-plugin-community-nodes 0.24.0 → 0.25.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.
Files changed (106) hide show
  1. package/.turbo/turbo-build.log +1 -1
  2. package/README.md +39 -52
  3. package/dist/plugin.d.ts +0 -78
  4. package/dist/plugin.d.ts.map +1 -1
  5. package/dist/plugin.js +0 -26
  6. package/dist/plugin.js.map +1 -1
  7. package/dist/rules/index.d.ts +0 -13
  8. package/dist/rules/index.d.ts.map +1 -1
  9. package/dist/rules/index.js +0 -26
  10. package/dist/rules/index.js.map +1 -1
  11. package/dist/typecheck.tsbuildinfo +1 -1
  12. package/docs/rules/no-forbidden-lifecycle-scripts.md +1 -1
  13. package/package.json +4 -4
  14. package/src/plugin.ts +0 -26
  15. package/src/rules/index.ts +0 -26
  16. package/dist/rules/cred-class-name-field-conventions.d.ts +0 -2
  17. package/dist/rules/cred-class-name-field-conventions.d.ts.map +0 -1
  18. package/dist/rules/cred-class-name-field-conventions.js +0 -89
  19. package/dist/rules/cred-class-name-field-conventions.js.map +0 -1
  20. package/dist/rules/cred-class-name-suffix.d.ts +0 -2
  21. package/dist/rules/cred-class-name-suffix.d.ts.map +0 -1
  22. package/dist/rules/cred-class-name-suffix.js +0 -53
  23. package/dist/rules/cred-class-name-suffix.js.map +0 -1
  24. package/dist/rules/cred-filename-against-convention.d.ts +0 -2
  25. package/dist/rules/cred-filename-against-convention.d.ts.map +0 -1
  26. package/dist/rules/cred-filename-against-convention.js +0 -42
  27. package/dist/rules/cred-filename-against-convention.js.map +0 -1
  28. package/dist/rules/no-asterisk-in-option-names.d.ts +0 -2
  29. package/dist/rules/no-asterisk-in-option-names.d.ts.map +0 -1
  30. package/dist/rules/no-asterisk-in-option-names.js +0 -90
  31. package/dist/rules/no-asterisk-in-option-names.js.map +0 -1
  32. package/dist/rules/no-duplicate-param-options.d.ts +0 -2
  33. package/dist/rules/no-duplicate-param-options.d.ts.map +0 -1
  34. package/dist/rules/no-duplicate-param-options.js +0 -97
  35. package/dist/rules/no-duplicate-param-options.js.map +0 -1
  36. package/dist/rules/node-class-description-name-camelcase.d.ts +0 -2
  37. package/dist/rules/node-class-description-name-camelcase.d.ts.map +0 -1
  38. package/dist/rules/node-class-description-name-camelcase.js +0 -92
  39. package/dist/rules/node-class-description-name-camelcase.js.map +0 -1
  40. package/dist/rules/node-filename-against-convention.d.ts +0 -2
  41. package/dist/rules/node-filename-against-convention.d.ts.map +0 -1
  42. package/dist/rules/node-filename-against-convention.js +0 -61
  43. package/dist/rules/node-filename-against-convention.js.map +0 -1
  44. package/dist/rules/node-operation-error-itemindex.d.ts +0 -12
  45. package/dist/rules/node-operation-error-itemindex.d.ts.map +0 -1
  46. package/dist/rules/node-operation-error-itemindex.js +0 -184
  47. package/dist/rules/node-operation-error-itemindex.js.map +0 -1
  48. package/dist/rules/options-sorted-alphabetically.d.ts +0 -2
  49. package/dist/rules/options-sorted-alphabetically.d.ts.map +0 -1
  50. package/dist/rules/options-sorted-alphabetically.js +0 -95
  51. package/dist/rules/options-sorted-alphabetically.js.map +0 -1
  52. package/dist/rules/require-community-node-keyword.d.ts +0 -2
  53. package/dist/rules/require-community-node-keyword.d.ts.map +0 -1
  54. package/dist/rules/require-community-node-keyword.js +0 -65
  55. package/dist/rules/require-community-node-keyword.js.map +0 -1
  56. package/dist/rules/require-continue-on-fail.d.ts +0 -2
  57. package/dist/rules/require-continue-on-fail.d.ts.map +0 -1
  58. package/dist/rules/require-continue-on-fail.js +0 -76
  59. package/dist/rules/require-continue-on-fail.js.map +0 -1
  60. package/dist/rules/require-mit-license.d.ts +0 -2
  61. package/dist/rules/require-mit-license.d.ts.map +0 -1
  62. package/dist/rules/require-mit-license.js +0 -57
  63. package/dist/rules/require-mit-license.js.map +0 -1
  64. package/dist/rules/require-param-default.d.ts +0 -15
  65. package/dist/rules/require-param-default.d.ts.map +0 -1
  66. package/dist/rules/require-param-default.js +0 -75
  67. package/dist/rules/require-param-default.js.map +0 -1
  68. package/docs/rules/cred-class-name-field-conventions.md +0 -38
  69. package/docs/rules/cred-class-name-suffix.md +0 -46
  70. package/docs/rules/cred-filename-against-convention.md +0 -42
  71. package/docs/rules/no-asterisk-in-option-names.md +0 -61
  72. package/docs/rules/no-duplicate-param-options.md +0 -46
  73. package/docs/rules/node-class-description-name-camelcase.md +0 -41
  74. package/docs/rules/node-filename-against-convention.md +0 -50
  75. package/docs/rules/node-operation-error-itemindex.md +0 -81
  76. package/docs/rules/options-sorted-alphabetically.md +0 -63
  77. package/docs/rules/require-community-node-keyword.md +0 -45
  78. package/docs/rules/require-continue-on-fail.md +0 -56
  79. package/docs/rules/require-mit-license.md +0 -38
  80. package/docs/rules/require-param-default.md +0 -60
  81. package/src/rules/cred-class-name-field-conventions.test.ts +0 -121
  82. package/src/rules/cred-class-name-field-conventions.ts +0 -102
  83. package/src/rules/cred-class-name-suffix.test.ts +0 -74
  84. package/src/rules/cred-class-name-suffix.ts +0 -57
  85. package/src/rules/cred-filename-against-convention.test.ts +0 -72
  86. package/src/rules/cred-filename-against-convention.ts +0 -48
  87. package/src/rules/no-asterisk-in-option-names.test.ts +0 -185
  88. package/src/rules/no-asterisk-in-option-names.ts +0 -111
  89. package/src/rules/no-duplicate-param-options.test.ts +0 -125
  90. package/src/rules/no-duplicate-param-options.ts +0 -125
  91. package/src/rules/node-class-description-name-camelcase.test.ts +0 -121
  92. package/src/rules/node-class-description-name-camelcase.ts +0 -114
  93. package/src/rules/node-filename-against-convention.test.ts +0 -115
  94. package/src/rules/node-filename-against-convention.ts +0 -76
  95. package/src/rules/node-operation-error-itemindex.test.ts +0 -280
  96. package/src/rules/node-operation-error-itemindex.ts +0 -223
  97. package/src/rules/options-sorted-alphabetically.test.ts +0 -468
  98. package/src/rules/options-sorted-alphabetically.ts +0 -129
  99. package/src/rules/require-community-node-keyword.test.ts +0 -82
  100. package/src/rules/require-community-node-keyword.ts +0 -78
  101. package/src/rules/require-continue-on-fail.test.ts +0 -129
  102. package/src/rules/require-continue-on-fail.ts +0 -88
  103. package/src/rules/require-mit-license.test.ts +0 -67
  104. package/src/rules/require-mit-license.ts +0 -65
  105. package/src/rules/require-param-default.test.ts +0 -227
  106. package/src/rules/require-param-default.ts +0 -89
@@ -40,7 +40,7 @@ n8n community nodes are distributed as pre-built npm packages. Unlike regular np
40
40
  "name": "n8n-nodes-example",
41
41
  "scripts": {
42
42
  "build": "tsc",
43
- "test": "jest"
43
+ "test": "vitest run"
44
44
  }
45
45
  }
46
46
  ```
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@n8n/eslint-plugin-community-nodes",
3
3
  "type": "module",
4
- "version": "0.24.0",
4
+ "version": "0.25.0",
5
5
  "main": "./dist/plugin.js",
6
6
  "types": "./dist/plugin.d.ts",
7
7
  "exports": {
@@ -24,9 +24,9 @@
24
24
  "typescript": "6.0.2",
25
25
  "vite": "^8.0.2",
26
26
  "vitest": "^4.1.9",
27
- "@n8n/typescript-config": "1.8.0",
28
- "@n8n/vitest-config": "1.17.0",
29
- "n8n-workflow": "2.30.0"
27
+ "@n8n/typescript-config": "1.9.0",
28
+ "n8n-workflow": "2.31.0",
29
+ "@n8n/vitest-config": "1.18.0"
30
30
  },
31
31
  "peerDependencies": {
32
32
  "eslint": "9.29.0",
package/src/plugin.ts CHANGED
@@ -27,8 +27,6 @@ const configs = {
27
27
  '@n8n/community-nodes/n8n-object-validation': 'error',
28
28
  '@n8n/community-nodes/no-deprecated-workflow-functions': 'error',
29
29
  '@n8n/community-nodes/no-emoji-in-options': 'error',
30
- '@n8n/community-nodes/no-asterisk-in-option-names': 'warn',
31
- '@n8n/community-nodes/no-duplicate-param-options': 'warn',
32
30
  '@n8n/community-nodes/node-usable-as-tool': 'error',
33
31
  '@n8n/community-nodes/package-name-convention': 'error',
34
32
  '@n8n/community-nodes/credential-test-required': 'error',
@@ -41,28 +39,17 @@ const configs = {
41
39
  '@n8n/community-nodes/no-template-placeholders': 'error',
42
40
  '@n8n/community-nodes/icon-validation': 'error',
43
41
  '@n8n/community-nodes/icon-prefer-themed-variants': 'warn',
44
- '@n8n/community-nodes/options-sorted-alphabetically': 'warn',
45
42
  '@n8n/community-nodes/resource-operation-pattern': 'warn',
46
43
  '@n8n/community-nodes/trigger-node-conventions': 'error',
47
44
  '@n8n/community-nodes/credential-documentation-url': 'error',
48
45
  '@n8n/community-nodes/cred-class-field-icon-missing': 'error',
49
- '@n8n/community-nodes/cred-class-name-field-conventions': 'error',
50
- '@n8n/community-nodes/cred-class-name-suffix': 'error',
51
46
  '@n8n/community-nodes/cred-class-oauth2-naming': 'error',
52
- '@n8n/community-nodes/cred-filename-against-convention': 'error',
53
47
  '@n8n/community-nodes/node-connection-type-literal': 'error',
54
- '@n8n/community-nodes/node-class-description-name-camelcase': 'error',
55
- '@n8n/community-nodes/node-filename-against-convention': 'error',
56
48
  '@n8n/community-nodes/missing-paired-item': 'error',
57
49
  '@n8n/community-nodes/no-builder-hint-leakage': 'error',
58
- '@n8n/community-nodes/node-operation-error-itemindex': 'error',
59
50
  '@n8n/community-nodes/node-registration-complete': 'warn',
60
- '@n8n/community-nodes/require-community-node-keyword': 'warn',
61
- '@n8n/community-nodes/require-continue-on-fail': 'error',
62
- '@n8n/community-nodes/require-mit-license': 'error',
63
51
  '@n8n/community-nodes/require-node-api-error': 'error',
64
52
  '@n8n/community-nodes/require-node-description-fields': 'error',
65
- '@n8n/community-nodes/require-param-default': 'error',
66
53
  '@n8n/community-nodes/require-version': 'error',
67
54
  '@n8n/community-nodes/valid-author': 'error',
68
55
  '@n8n/community-nodes/valid-credential-references': 'error',
@@ -82,8 +69,6 @@ const configs = {
82
69
  '@n8n/community-nodes/n8n-object-validation': 'error',
83
70
  '@n8n/community-nodes/no-deprecated-workflow-functions': 'error',
84
71
  '@n8n/community-nodes/no-emoji-in-options': 'error',
85
- '@n8n/community-nodes/no-asterisk-in-option-names': 'warn',
86
- '@n8n/community-nodes/no-duplicate-param-options': 'warn',
87
72
  '@n8n/community-nodes/node-usable-as-tool': 'error',
88
73
  '@n8n/community-nodes/package-name-convention': 'error',
89
74
  '@n8n/community-nodes/credential-test-required': 'error',
@@ -96,28 +81,17 @@ const configs = {
96
81
  '@n8n/community-nodes/no-template-placeholders': 'error',
97
82
  '@n8n/community-nodes/icon-validation': 'error',
98
83
  '@n8n/community-nodes/icon-prefer-themed-variants': 'warn',
99
- '@n8n/community-nodes/options-sorted-alphabetically': 'warn',
100
84
  '@n8n/community-nodes/credential-documentation-url': 'error',
101
85
  '@n8n/community-nodes/resource-operation-pattern': 'warn',
102
86
  '@n8n/community-nodes/trigger-node-conventions': 'error',
103
87
  '@n8n/community-nodes/cred-class-field-icon-missing': 'error',
104
- '@n8n/community-nodes/cred-class-name-field-conventions': 'error',
105
- '@n8n/community-nodes/cred-class-name-suffix': 'error',
106
88
  '@n8n/community-nodes/cred-class-oauth2-naming': 'error',
107
- '@n8n/community-nodes/cred-filename-against-convention': 'error',
108
89
  '@n8n/community-nodes/node-connection-type-literal': 'error',
109
- '@n8n/community-nodes/node-class-description-name-camelcase': 'error',
110
- '@n8n/community-nodes/node-filename-against-convention': 'error',
111
90
  '@n8n/community-nodes/missing-paired-item': 'error',
112
91
  '@n8n/community-nodes/no-builder-hint-leakage': 'error',
113
- '@n8n/community-nodes/node-operation-error-itemindex': 'error',
114
92
  '@n8n/community-nodes/node-registration-complete': 'warn',
115
- '@n8n/community-nodes/require-community-node-keyword': 'warn',
116
- '@n8n/community-nodes/require-continue-on-fail': 'error',
117
- '@n8n/community-nodes/require-mit-license': 'error',
118
93
  '@n8n/community-nodes/require-node-api-error': 'error',
119
94
  '@n8n/community-nodes/require-node-description-fields': 'error',
120
- '@n8n/community-nodes/require-param-default': 'error',
121
95
  '@n8n/community-nodes/require-version': 'error',
122
96
  '@n8n/community-nodes/valid-author': 'error',
123
97
  '@n8n/community-nodes/valid-credential-references': 'error',
@@ -2,10 +2,7 @@ import type { AnyRuleModule } from '@typescript-eslint/utils/ts-eslint';
2
2
 
3
3
  import { AiNodePackageJsonRule } from './ai-node-package-json.js';
4
4
  import { CredClassFieldIconMissingRule } from './cred-class-field-icon-missing.js';
5
- import { CredClassNameFieldConventionsRule } from './cred-class-name-field-conventions.js';
6
- import { CredClassNameSuffixRule } from './cred-class-name-suffix.js';
7
5
  import { CredClassOAuth2NamingRule } from './cred-class-oauth2-naming.js';
8
- import { CredFilenameAgainstConventionRule } from './cred-filename-against-convention.js';
9
6
  import { CredentialDocumentationUrlRule } from './credential-documentation-url.js';
10
7
  import { CredentialPasswordFieldRule } from './credential-password-field.js';
11
8
  import { CredentialTestRequiredRule } from './credential-test-required.js';
@@ -13,12 +10,10 @@ import { IconPreferThemedVariantsRule } from './icon-prefer-themed-variants.js';
13
10
  import { IconValidationRule } from './icon-validation.js';
14
11
  import { MissingPairedItemRule } from './missing-paired-item.js';
15
12
  import { N8nObjectValidationRule } from './n8n-object-validation.js';
16
- import { NoAsteriskInOptionNamesRule } from './no-asterisk-in-option-names.js';
17
13
  import { NoBuilderHintLeakageRule } from './no-builder-hint-leakage.js';
18
14
  import { NoCredentialReuseRule } from './no-credential-reuse.js';
19
15
  import { NoDangerousFunctionsRule } from './no-dangerous-functions.js';
20
16
  import { NoDeprecatedWorkflowFunctionsRule } from './no-deprecated-workflow-functions.js';
21
- import { NoDuplicateParamOptionsRule } from './no-duplicate-param-options.js';
22
17
  import { NoEmojiInOptionsRule } from './no-emoji-in-options.js';
23
18
  import { NoForbiddenLifecycleScriptsRule } from './no-forbidden-lifecycle-scripts.js';
24
19
  import { NoHttpRequestWithManualAuthRule } from './no-http-request-with-manual-auth.js';
@@ -28,20 +23,12 @@ import { NoRestrictedImportsRule } from './no-restricted-imports.js';
28
23
  import { NoRuntimeDependenciesRule } from './no-runtime-dependencies.js';
29
24
  import { NoTemplatePlaceholdersRule } from './no-template-placeholders.js';
30
25
  import { NodeClassDescriptionIconMissingRule } from './node-class-description-icon-missing.js';
31
- import { NodeClassDescriptionNameCamelCaseRule } from './node-class-description-name-camelcase.js';
32
26
  import { NodeConnectionTypeLiteralRule } from './node-connection-type-literal.js';
33
- import { NodeFilenameAgainstConventionRule } from './node-filename-against-convention.js';
34
- import { NodeOperationErrorItemIndexRule } from './node-operation-error-itemindex.js';
35
27
  import { NodeRegistrationCompleteRule } from './node-registration-complete.js';
36
28
  import { NodeUsableAsToolRule } from './node-usable-as-tool.js';
37
- import { OptionsSortedAlphabeticallyRule } from './options-sorted-alphabetically.js';
38
29
  import { PackageNameConventionRule } from './package-name-convention.js';
39
- import { RequireCommunityNodeKeywordRule } from './require-community-node-keyword.js';
40
- import { RequireContinueOnFailRule } from './require-continue-on-fail.js';
41
- import { RequireMitLicenseRule } from './require-mit-license.js';
42
30
  import { RequireNodeApiErrorRule } from './require-node-api-error.js';
43
31
  import { RequireNodeDescriptionFieldsRule } from './require-node-description-fields.js';
44
- import { RequireParamDefaultRule } from './require-param-default.js';
45
32
  import { RequireVersionRule } from './require-version.js';
46
33
  import { ResourceOperationPatternRule } from './resource-operation-pattern.js';
47
34
  import { TriggerNodeConventionsRule } from './trigger-node-conventions.js';
@@ -58,10 +45,7 @@ export const rules = {
58
45
  'credential-password-field': CredentialPasswordFieldRule,
59
46
  'no-deprecated-workflow-functions': NoDeprecatedWorkflowFunctionsRule,
60
47
  'no-emoji-in-options': NoEmojiInOptionsRule,
61
- 'no-asterisk-in-option-names': NoAsteriskInOptionNamesRule,
62
- 'no-duplicate-param-options': NoDuplicateParamOptionsRule,
63
48
  'node-usable-as-tool': NodeUsableAsToolRule,
64
- 'options-sorted-alphabetically': OptionsSortedAlphabeticallyRule,
65
49
  'package-name-convention': PackageNameConventionRule,
66
50
  'credential-test-required': CredentialTestRequiredRule,
67
51
  'no-credential-reuse': NoCredentialReuseRule,
@@ -77,25 +61,15 @@ export const rules = {
77
61
  'trigger-node-conventions': TriggerNodeConventionsRule,
78
62
  'credential-documentation-url': CredentialDocumentationUrlRule,
79
63
  'node-class-description-icon-missing': NodeClassDescriptionIconMissingRule,
80
- 'node-class-description-name-camelcase': NodeClassDescriptionNameCamelCaseRule,
81
64
  'cred-class-field-icon-missing': CredClassFieldIconMissingRule,
82
- 'cred-class-name-field-conventions': CredClassNameFieldConventionsRule,
83
- 'cred-class-name-suffix': CredClassNameSuffixRule,
84
65
  'cred-class-oauth2-naming': CredClassOAuth2NamingRule,
85
- 'cred-filename-against-convention': CredFilenameAgainstConventionRule,
86
66
  'node-connection-type-literal': NodeConnectionTypeLiteralRule,
87
- 'node-filename-against-convention': NodeFilenameAgainstConventionRule,
88
- 'node-operation-error-itemindex': NodeOperationErrorItemIndexRule,
89
67
  'node-registration-complete': NodeRegistrationCompleteRule,
90
68
  'missing-paired-item': MissingPairedItemRule,
91
69
  'no-builder-hint-leakage': NoBuilderHintLeakageRule,
92
70
  'n8n-object-validation': N8nObjectValidationRule,
93
- 'require-community-node-keyword': RequireCommunityNodeKeywordRule,
94
- 'require-continue-on-fail': RequireContinueOnFailRule,
95
- 'require-mit-license': RequireMitLicenseRule,
96
71
  'require-node-api-error': RequireNodeApiErrorRule,
97
72
  'require-node-description-fields': RequireNodeDescriptionFieldsRule,
98
- 'require-param-default': RequireParamDefaultRule,
99
73
  'require-version': RequireVersionRule,
100
74
  'valid-author': ValidAuthorRule,
101
75
  'valid-credential-references': ValidCredentialReferencesRule,
@@ -1,2 +0,0 @@
1
- export declare const CredClassNameFieldConventionsRule: import("@typescript-eslint/utils/ts-eslint").RuleModule<"missingSuffix" | "uppercaseFirstChar", [], unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
2
- //# sourceMappingURL=cred-class-name-field-conventions.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"cred-class-name-field-conventions.d.ts","sourceRoot":"","sources":["../../src/rules/cred-class-name-field-conventions.ts"],"names":[],"mappings":"AAgCA,eAAO,MAAM,iCAAiC,yKAqE5C,CAAC"}
@@ -1,89 +0,0 @@
1
- import { createRule, findClassProperty, getStringLiteralValue, isCredentialTypeClass, isFileType, } from '../utils/index.js';
2
- function lowercaseFirstChar(name) {
3
- return name.charAt(0).toLowerCase() + name.slice(1);
4
- }
5
- function addApiSuffix(name) {
6
- if (name.endsWith('Api'))
7
- return name;
8
- if (name.endsWith('Ap'))
9
- return `${name}i`;
10
- if (name.endsWith('A'))
11
- return `${name}pi`;
12
- return `${name}Api`;
13
- }
14
- // Serialize a value as a string literal using the original quote character,
15
- // escaping any characters that would otherwise break the literal so the
16
- // autofix never emits invalid code (e.g. names containing quotes).
17
- function toStringLiteral(value, quote) {
18
- const escaped = value
19
- .replace(/\\/g, '\\\\')
20
- .replace(/\n/g, '\\n')
21
- .replace(/\r/g, '\\r')
22
- .split(quote)
23
- .join(`\\${quote}`);
24
- return `${quote}${escaped}${quote}`;
25
- }
26
- export const CredClassNameFieldConventionsRule = createRule({
27
- name: 'cred-class-name-field-conventions',
28
- meta: {
29
- type: 'problem',
30
- docs: {
31
- description: 'Credential `name` field must end with `Api` and start with a lowercase letter',
32
- },
33
- messages: {
34
- missingSuffix: "Credential `name` field '{{value}}' must end with 'Api'",
35
- uppercaseFirstChar: "Credential `name` field '{{value}}' must start with a lowercase letter",
36
- },
37
- fixable: 'code',
38
- schema: [],
39
- },
40
- defaultOptions: [],
41
- create(context) {
42
- if (!isFileType(context.filename, '.credentials.ts')) {
43
- return {};
44
- }
45
- return {
46
- ClassDeclaration(node) {
47
- if (!isCredentialTypeClass(node)) {
48
- return;
49
- }
50
- const nameProperty = findClassProperty(node, 'name');
51
- if (!nameProperty?.value) {
52
- return;
53
- }
54
- const nameValue = getStringLiteralValue(nameProperty.value);
55
- if (nameValue === null) {
56
- return;
57
- }
58
- const startsLowercase = !/^[A-Z]/.test(nameValue);
59
- const endsWithApi = nameValue.endsWith('Api');
60
- if (startsLowercase && endsWithApi) {
61
- return;
62
- }
63
- // Compute the fully-corrected value once so each fix yields the
64
- // same result in a single pass, regardless of which one applies.
65
- const fixedValue = addApiSuffix(lowercaseFirstChar(nameValue));
66
- const valueNode = nameProperty.value;
67
- const quote = context.sourceCode.getText(valueNode).charAt(0);
68
- const replacement = toStringLiteral(fixedValue, quote);
69
- if (!startsLowercase) {
70
- context.report({
71
- node: valueNode,
72
- messageId: 'uppercaseFirstChar',
73
- data: { value: nameValue },
74
- fix: (fixer) => fixer.replaceText(valueNode, replacement),
75
- });
76
- }
77
- if (!endsWithApi) {
78
- context.report({
79
- node: valueNode,
80
- messageId: 'missingSuffix',
81
- data: { value: nameValue },
82
- fix: (fixer) => fixer.replaceText(valueNode, replacement),
83
- });
84
- }
85
- },
86
- };
87
- },
88
- });
89
- //# sourceMappingURL=cred-class-name-field-conventions.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"cred-class-name-field-conventions.js","sourceRoot":"","sources":["../../src/rules/cred-class-name-field-conventions.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,UAAU,EACV,iBAAiB,EACjB,qBAAqB,EACrB,qBAAqB,EACrB,UAAU,GACV,MAAM,mBAAmB,CAAC;AAE3B,SAAS,kBAAkB,CAAC,IAAY;IACvC,OAAO,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;AACrD,CAAC;AAED,SAAS,YAAY,CAAC,IAAY;IACjC,IAAI,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC;QAAE,OAAO,IAAI,CAAC;IACtC,IAAI,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC;QAAE,OAAO,GAAG,IAAI,GAAG,CAAC;IAC3C,IAAI,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC;QAAE,OAAO,GAAG,IAAI,IAAI,CAAC;IAC3C,OAAO,GAAG,IAAI,KAAK,CAAC;AACrB,CAAC;AAED,4EAA4E;AAC5E,wEAAwE;AACxE,mEAAmE;AACnE,SAAS,eAAe,CAAC,KAAa,EAAE,KAAa;IACpD,MAAM,OAAO,GAAG,KAAK;SACnB,OAAO,CAAC,KAAK,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CAAC,KAAK,CAAC,CAAC;gBAC9C,IAAI,eAAe,IAAI,WAAW,EAAE,CAAC;oBACpC,OAAO;gBACR,CAAC;gBAED,gEAAgE;gBAChE,iEAAiE;gBACjE,MAAM,UAAU,GAAG,YAAY,CAAC,kBAAkB,CAAC,SAAS,CAAC,CAAC,CAAC;gBAC/D,MAAM,SAAS,GAAG,YAAY,CAAC,KAAK,CAAC;gBACrC,MAAM,KAAK,GAAG,OAAO,CAAC,UAAU,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;gBAC9D,MAAM,WAAW,GAAG,eAAe,CAAC,UAAU,EAAE,KAAK,CAAC,CAAC;gBAEvD,IAAI,CAAC,eAAe,EAAE,CAAC;oBACtB,OAAO,CAAC,MAAM,CAAC;wBACd,IAAI,EAAE,SAAS;wBACf,SAAS,EAAE,oBAAoB;wBAC/B,IAAI,EAAE,EAAE,KAAK,EAAE,SAAS,EAAE;wBAC1B,GAAG,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,WAAW,CAAC,SAAS,EAAE,WAAW,CAAC;qBACzD,CAAC,CAAC;gBACJ,CAAC;gBAED,IAAI,CAAC,WAAW,EAAE,CAAC;oBAClB,OAAO,CAAC,MAAM,CAAC;wBACd,IAAI,EAAE,SAAS;wBACf,SAAS,EAAE,eAAe;wBAC1B,IAAI,EAAE,EAAE,KAAK,EAAE,SAAS,EAAE;wBAC1B,GAAG,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,WAAW,CAAC,SAAS,EAAE,WAAW,CAAC;qBACzD,CAAC,CAAC;gBACJ,CAAC;YACF,CAAC;SACD,CAAC;IACH,CAAC;CACD,CAAC,CAAC"}
@@ -1,2 +0,0 @@
1
- export declare const CredClassNameSuffixRule: import("@typescript-eslint/utils/ts-eslint").RuleModule<"missingSuffix", [], unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
2
- //# sourceMappingURL=cred-class-name-suffix.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"cred-class-name-suffix.d.ts","sourceRoot":"","sources":["../../src/rules/cred-class-name-suffix.ts"],"names":[],"mappings":"AAQA,eAAO,MAAM,uBAAuB,kJAgDlC,CAAC"}
@@ -1,53 +0,0 @@
1
- import { isCredentialTypeClass, isFileType, createRule } from '../utils/index.js';
2
- function addApiSuffix(name) {
3
- if (name.endsWith('Ap'))
4
- return `${name}i`;
5
- if (name.endsWith('A'))
6
- return `${name}pi`;
7
- return `${name}Api`;
8
- }
9
- export const CredClassNameSuffixRule = createRule({
10
- name: 'cred-class-name-suffix',
11
- meta: {
12
- type: 'problem',
13
- docs: {
14
- description: 'Credential class names must be suffixed with `Api`',
15
- },
16
- messages: {
17
- missingSuffix: "Credential class name '{{name}}' must end with 'Api'",
18
- },
19
- fixable: 'code',
20
- schema: [],
21
- },
22
- defaultOptions: [],
23
- create(context) {
24
- if (!isFileType(context.filename, '.credentials.ts')) {
25
- return {};
26
- }
27
- return {
28
- ClassDeclaration(node) {
29
- if (!isCredentialTypeClass(node)) {
30
- return;
31
- }
32
- const classNameNode = node.id;
33
- if (!classNameNode) {
34
- return;
35
- }
36
- const className = classNameNode.name;
37
- if (className.endsWith('Api')) {
38
- return;
39
- }
40
- const fixedName = addApiSuffix(className);
41
- context.report({
42
- node: classNameNode,
43
- messageId: 'missingSuffix',
44
- data: { name: className },
45
- fix(fixer) {
46
- return fixer.replaceText(classNameNode, fixedName);
47
- },
48
- });
49
- },
50
- };
51
- },
52
- });
53
- //# sourceMappingURL=cred-class-name-suffix.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"cred-class-name-suffix.js","sourceRoot":"","sources":["../../src/rules/cred-class-name-suffix.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAElF,SAAS,YAAY,CAAC,IAAY;IACjC,IAAI,IAAI,CAAC,QAAQ,CAAC,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a,EAAE,SAAS,CAAC,CAAC;oBACpD,CAAC;iBACD,CAAC,CAAC;YACJ,CAAC;SACD,CAAC;IACH,CAAC;CACD,CAAC,CAAC"}
@@ -1,2 +0,0 @@
1
- export declare const CredFilenameAgainstConventionRule: import("@typescript-eslint/utils/ts-eslint").RuleModule<"renameFile", [], unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
2
- //# sourceMappingURL=cred-filename-against-convention.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"cred-filename-against-convention.d.ts","sourceRoot":"","sources":["../../src/rules/cred-filename-against-convention.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,iCAAiC,+IA2C5C,CAAC"}
@@ -1,42 +0,0 @@
1
- import * as path from 'node:path';
2
- import { isCredentialTypeClass, isFileType, createRule } from '../utils/index.js';
3
- export const CredFilenameAgainstConventionRule = createRule({
4
- name: 'cred-filename-against-convention',
5
- meta: {
6
- type: 'problem',
7
- docs: {
8
- description: 'Credential filename must match the credential class name',
9
- },
10
- messages: {
11
- renameFile: 'Credential filename must match the class name "{{className}}". Rename file to "{{expected}}".',
12
- },
13
- schema: [],
14
- },
15
- defaultOptions: [],
16
- create(context) {
17
- if (!isFileType(context.filename, '.credentials.ts')) {
18
- return {};
19
- }
20
- return {
21
- ClassDeclaration(node) {
22
- if (!isCredentialTypeClass(node)) {
23
- return;
24
- }
25
- const classNameNode = node.id;
26
- if (!classNameNode) {
27
- return;
28
- }
29
- const className = classNameNode.name;
30
- const actualBaseName = path.basename(context.filename, '.credentials.ts');
31
- if (actualBaseName !== className) {
32
- context.report({
33
- node: classNameNode,
34
- messageId: 'renameFile',
35
- data: { className, expected: `${className}.credentials.ts` },
36
- });
37
- }
38
- },
39
- };
40
- },
41
- });
42
- //# sourceMappingURL=cred-filename-against-convention.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"cred-filename-against-convention.js","sourceRoot":"","sources":["../../src/rules/cred-filename-against-convention.ts"],"names":[],"mappings":"AAAA,OAA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ript-eslint/utils/ts-eslint").RuleModule<"asteriskInOptionName" | "replaceAsterisk", [], unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
2
- //# sourceMappingURL=no-asterisk-in-option-names.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"no-asterisk-in-option-names.d.ts","sourceRoot":"","sources":["../../src/rules/no-asterisk-in-option-names.ts"],"names":[],"mappings":"AAYA,eAAO,MAAM,2BAA2B,6KAkGtC,CAAC"}
@@ -1,90 +0,0 @@
1
- import { AST_NODE_TYPES } from '@typescript-eslint/utils';
2
- import { isNodeTypeClass, findClassProperty, findObjectProperty, getStringLiteralValue, isFileType, createRule, } from '../utils/index.js';
3
- export const NoAsteriskInOptionNamesRule = createRule({
4
- name: 'no-asterisk-in-option-names',
5
- meta: {
6
- type: 'suggestion',
7
- docs: {
8
- description: 'Disallow asterisk characters in node option name values',
9
- },
10
- hasSuggestions: true,
11
- messages: {
12
- asteriskInOptionName: 'Option name "{{ name }}" contains "*", which renders ambiguously in the n8n UI. Use bracketed notation like "[All]" instead.',
13
- replaceAsterisk: 'Replace "*" with "[All]".',
14
- },
15
- schema: [],
16
- },
17
- defaultOptions: [],
18
- create(context) {
19
- if (!isFileType(context.filename, '.node.ts')) {
20
- return {};
21
- }
22
- // Check every object that is a direct element of an `options` array.
23
- const checkOptionsArray = (optionsArray) => {
24
- for (const option of optionsArray.elements) {
25
- if (!option || option.type !== AST_NODE_TYPES.ObjectExpression) {
26
- continue;
27
- }
28
- const valueNode = findObjectProperty(option, 'name')?.value;
29
- if (!valueNode) {
30
- continue;
31
- }
32
- const name = getStringLiteralValue(valueNode);
33
- if (!name?.includes('*')) {
34
- continue;
35
- }
36
- context.report({
37
- node: valueNode,
38
- messageId: 'asteriskInOptionName',
39
- data: { name },
40
- suggest: [
41
- {
42
- messageId: 'replaceAsterisk',
43
- fix(fixer) {
44
- const quote = context.sourceCode.getText(valueNode).at(0) ?? "'";
45
- return fixer.replaceText(valueNode, `${quote}${name.replaceAll('*', '[All]')}${quote}`);
46
- },
47
- },
48
- ],
49
- });
50
- }
51
- };
52
- const traverse = (node) => {
53
- if (node.type === AST_NODE_TYPES.ObjectExpression) {
54
- const optionsProperty = findObjectProperty(node, 'options');
55
- if (optionsProperty?.value.type === AST_NODE_TYPES.ArrayExpression) {
56
- checkOptionsArray(optionsProperty.value);
57
- }
58
- }
59
- for (const key in node) {
60
- if (key === 'parent') {
61
- continue;
62
- }
63
- const child = node[key];
64
- if (Array.isArray(child)) {
65
- for (const item of child) {
66
- if (item && typeof item === 'object' && 'type' in item) {
67
- traverse(item);
68
- }
69
- }
70
- }
71
- else if (child && typeof child === 'object' && 'type' in child) {
72
- traverse(child);
73
- }
74
- }
75
- };
76
- return {
77
- ClassDeclaration(node) {
78
- if (!isNodeTypeClass(node)) {
79
- return;
80
- }
81
- const descriptionProperty = findClassProperty(node, 'description');
82
- if (!descriptionProperty?.value) {
83
- return;
84
- }
85
- traverse(descriptionProperty.value);
86
- },
87
- };
88
- },
89
- });
90
- //# sourceMappingURL=no-asterisk-in-option-names.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"no-asterisk-in-option-names.js","sourceRoot":"","sources":["../../src/rules/no-asterisk-in-option-names.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAE1D,OAAO,EACN,eAAe,EACf,iBAAiB,EACjB,kBAAkB,EAClB,qBAAqB,EACrB,UAAU,EACV,UAAU,GACV,MAAM,mBAAmB,CAAC;AAE3B,MAAM,CAAC,MAAM,2BAA2B,GAAG,UAAU,CAAC;IACrD,IAAI,EAAE,6BAA6B;IACnC,IAAI,EAAE;QACL,IAAI,EAAE,YAAY;QAClB,IAAI,EAAE;YACL,WAAW,EAAE,yDAAyD;SACtE;QACD,cAAc,EAAE,IAAI;QACpB,QAAQ,EAAE;YACT,oBAAoB,EACnB,8HAA8H;YAC/H,eAAe,EAAE,2BAA2B;SAC5C;QACD,MAAM,EAAE,EAAE;K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AAC;gBAED,QAAQ,CAAC,mBAAmB,CAAC,KAAK,CAAC,CAAC;YACrC,CAAC;SACD,CAAC;IACH,CAAC;CACD,CAAC,CAAC"}
@@ -1,2 +0,0 @@
1
- export declare const NoDuplicateParamOptionsRule: import("@typescript-eslint/utils/ts-eslint").RuleModule<"duplicateName" | "duplicateValue", [], unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
2
- //# sourceMappingURL=no-duplicate-param-options.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"no-duplicate-param-options.d.ts","sourceRoot":"","sources":["../../src/rules/no-duplicate-param-options.ts"],"names":[],"mappings":"AAaA,eAAO,MAAM,2BAA2B,qKA+GtC,CAAC"}
@@ -1,97 +0,0 @@
1
- import { AST_NODE_TYPES } from '@typescript-eslint/utils';
2
- import { isNodeTypeClass, findClassProperty, findObjectProperty, getStringLiteralValue, getLiteralValue, isFileType, createRule, } from '../utils/index.js';
3
- export const NoDuplicateParamOptionsRule = createRule({
4
- name: 'no-duplicate-param-options',
5
- meta: {
6
- type: 'problem',
7
- docs: {
8
- description: 'Disallow duplicate option names or values within a single node parameter',
9
- },
10
- messages: {
11
- duplicateName: 'Duplicate option name "{{ value }}" in parameter "{{ displayName }}".',
12
- duplicateValue: 'Duplicate option value "{{ value }}" in parameter "{{ displayName }}".',
13
- },
14
- schema: [],
15
- },
16
- defaultOptions: [],
17
- create(context) {
18
- if (!isFileType(context.filename, '.node.ts')) {
19
- return {};
20
- }
21
- const checkProperty = (property) => {
22
- const typeProperty = findObjectProperty(property, 'type');
23
- const type = typeProperty ? getStringLiteralValue(typeProperty.value) : null;
24
- if (type !== 'options' && type !== 'multiOptions') {
25
- return;
26
- }
27
- const optionsProperty = findObjectProperty(property, 'options');
28
- if (!optionsProperty?.value ||
29
- optionsProperty.value.type !== AST_NODE_TYPES.ArrayExpression) {
30
- return;
31
- }
32
- const displayNameProperty = findObjectProperty(property, 'displayName');
33
- const displayName = (displayNameProperty ? getStringLiteralValue(displayNameProperty.value) : null) ??
34
- 'unknown';
35
- const seenNames = new Set();
36
- const seenValues = new Set();
37
- for (const option of optionsProperty.value.elements) {
38
- if (!option || option.type !== AST_NODE_TYPES.ObjectExpression) {
39
- continue;
40
- }
41
- const nameProperty = findObjectProperty(option, 'name');
42
- const name = nameProperty ? getStringLiteralValue(nameProperty.value) : null;
43
- if (name !== null) {
44
- if (seenNames.has(name)) {
45
- context.report({
46
- node: nameProperty.value,
47
- messageId: 'duplicateName',
48
- data: { value: name, displayName },
49
- });
50
- }
51
- seenNames.add(name);
52
- }
53
- const valueProperty = findObjectProperty(option, 'value');
54
- const value = valueProperty ? getLiteralValue(valueProperty.value) : null;
55
- if (value !== null) {
56
- if (seenValues.has(value)) {
57
- context.report({
58
- node: valueProperty.value,
59
- messageId: 'duplicateValue',
60
- data: { value: String(value), displayName },
61
- });
62
- }
63
- seenValues.add(value);
64
- }
65
- }
66
- };
67
- const analyzeNodeDescription = (descriptionValue) => {
68
- if (!descriptionValue || descriptionValue.type !== AST_NODE_TYPES.ObjectExpression) {
69
- return;
70
- }
71
- const propertiesProperty = findObjectProperty(descriptionValue, 'properties');
72
- if (!propertiesProperty?.value ||
73
- propertiesProperty.value.type !== AST_NODE_TYPES.ArrayExpression) {
74
- return;
75
- }
76
- for (const property of propertiesProperty.value.elements) {
77
- if (!property || property.type !== AST_NODE_TYPES.ObjectExpression) {
78
- continue;
79
- }
80
- checkProperty(property);
81
- }
82
- };
83
- return {
84
- ClassDeclaration(node) {
85
- if (!isNodeTypeClass(node)) {
86
- return;
87
- }
88
- const descriptionProperty = findClassProperty(node, 'description');
89
- if (!descriptionProperty) {
90
- return;
91
- }
92
- analyzeNodeDescription(descriptionProperty.value);
93
- },
94
- };
95
- },
96
- });
97
- //# sourceMappingURL=no-duplicate-param-options.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"no-duplicate-param-options.js","sourceRoot":"","sources":["../../src/rules/no-duplicate-param-options.ts"],"names":[],"mappings":"AACA,OAAO,E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