@n8n/eslint-plugin-community-nodes 0.20.0 → 0.22.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 (101) hide show
  1. package/.turbo/turbo-build$colon$unchecked.log +1 -1
  2. package/README.md +47 -38
  3. package/dist/plugin.d.ts +54 -0
  4. package/dist/plugin.d.ts.map +1 -1
  5. package/dist/plugin.js +18 -0
  6. package/dist/plugin.js.map +1 -1
  7. package/dist/rules/ai-node-package-json.d.ts.map +1 -1
  8. package/dist/rules/ai-node-package-json.js +4 -3
  9. package/dist/rules/ai-node-package-json.js.map +1 -1
  10. package/dist/rules/cred-filename-against-convention.d.ts +2 -0
  11. package/dist/rules/cred-filename-against-convention.d.ts.map +1 -0
  12. package/dist/rules/cred-filename-against-convention.js +42 -0
  13. package/dist/rules/cred-filename-against-convention.js.map +1 -0
  14. package/dist/rules/icon-prefer-themed-variants.d.ts +2 -0
  15. package/dist/rules/icon-prefer-themed-variants.d.ts.map +1 -0
  16. package/dist/rules/icon-prefer-themed-variants.js +53 -0
  17. package/dist/rules/icon-prefer-themed-variants.js.map +1 -0
  18. package/dist/rules/icon-validation.d.ts +1 -1
  19. package/dist/rules/icon-validation.d.ts.map +1 -1
  20. package/dist/rules/icon-validation.js +4 -25
  21. package/dist/rules/icon-validation.js.map +1 -1
  22. package/dist/rules/index.d.ts +10 -1
  23. package/dist/rules/index.d.ts.map +1 -1
  24. package/dist/rules/index.js +18 -0
  25. package/dist/rules/index.js.map +1 -1
  26. package/dist/rules/no-dangerous-functions.d.ts +2 -0
  27. package/dist/rules/no-dangerous-functions.d.ts.map +1 -0
  28. package/dist/rules/no-dangerous-functions.js +121 -0
  29. package/dist/rules/no-dangerous-functions.js.map +1 -0
  30. package/dist/rules/no-emoji-in-options.d.ts +2 -0
  31. package/dist/rules/no-emoji-in-options.d.ts.map +1 -0
  32. package/dist/rules/no-emoji-in-options.js +86 -0
  33. package/dist/rules/no-emoji-in-options.js.map +1 -0
  34. package/dist/rules/node-class-description-name-camelcase.d.ts +2 -0
  35. package/dist/rules/node-class-description-name-camelcase.d.ts.map +1 -0
  36. package/dist/rules/node-class-description-name-camelcase.js +92 -0
  37. package/dist/rules/node-class-description-name-camelcase.js.map +1 -0
  38. package/dist/rules/node-filename-against-convention.d.ts +2 -0
  39. package/dist/rules/node-filename-against-convention.d.ts.map +1 -0
  40. package/dist/rules/node-filename-against-convention.js +61 -0
  41. package/dist/rules/node-filename-against-convention.js.map +1 -0
  42. package/dist/rules/node-registration-complete.d.ts +2 -0
  43. package/dist/rules/node-registration-complete.d.ts.map +1 -0
  44. package/dist/rules/node-registration-complete.js +60 -0
  45. package/dist/rules/node-registration-complete.js.map +1 -0
  46. package/dist/rules/require-version.d.ts +2 -0
  47. package/dist/rules/require-version.d.ts.map +1 -0
  48. package/dist/rules/require-version.js +50 -0
  49. package/dist/rules/require-version.js.map +1 -0
  50. package/dist/rules/valid-author.d.ts +2 -0
  51. package/dist/rules/valid-author.d.ts.map +1 -0
  52. package/dist/rules/valid-author.js +89 -0
  53. package/dist/rules/valid-author.js.map +1 -0
  54. package/dist/rules/valid-peer-dependencies.d.ts.map +1 -1
  55. package/dist/rules/valid-peer-dependencies.js +5 -3
  56. package/dist/rules/valid-peer-dependencies.js.map +1 -1
  57. package/dist/typecheck.tsbuildinfo +1 -0
  58. package/dist/utils/file-utils.d.ts +7 -2
  59. package/dist/utils/file-utils.d.ts.map +1 -1
  60. package/dist/utils/file-utils.js +47 -10
  61. package/dist/utils/file-utils.js.map +1 -1
  62. package/docs/rules/cred-filename-against-convention.md +42 -0
  63. package/docs/rules/icon-prefer-themed-variants.md +71 -0
  64. package/docs/rules/icon-validation.md +5 -3
  65. package/docs/rules/no-dangerous-functions.md +41 -0
  66. package/docs/rules/no-emoji-in-options.md +60 -0
  67. package/docs/rules/node-class-description-name-camelcase.md +41 -0
  68. package/docs/rules/node-filename-against-convention.md +50 -0
  69. package/docs/rules/node-registration-complete.md +46 -0
  70. package/docs/rules/require-version.md +51 -0
  71. package/docs/rules/valid-author.md +60 -0
  72. package/docs/rules/valid-peer-dependencies.md +1 -1
  73. package/package.json +4 -4
  74. package/src/plugin.ts +18 -0
  75. package/src/rules/ai-node-package-json.test.ts +5 -0
  76. package/src/rules/ai-node-package-json.ts +4 -3
  77. package/src/rules/cred-filename-against-convention.test.ts +72 -0
  78. package/src/rules/cred-filename-against-convention.ts +48 -0
  79. package/src/rules/icon-prefer-themed-variants.test.ts +128 -0
  80. package/src/rules/icon-prefer-themed-variants.ts +70 -0
  81. package/src/rules/icon-validation.test.ts +10 -0
  82. package/src/rules/icon-validation.ts +4 -28
  83. package/src/rules/index.ts +18 -0
  84. package/src/rules/no-dangerous-functions.test.ts +83 -0
  85. package/src/rules/no-dangerous-functions.ts +155 -0
  86. package/src/rules/no-emoji-in-options.test.ts +157 -0
  87. package/src/rules/no-emoji-in-options.ts +105 -0
  88. package/src/rules/node-class-description-name-camelcase.test.ts +121 -0
  89. package/src/rules/node-class-description-name-camelcase.ts +114 -0
  90. package/src/rules/node-filename-against-convention.test.ts +115 -0
  91. package/src/rules/node-filename-against-convention.ts +76 -0
  92. package/src/rules/node-registration-complete.test.ts +87 -0
  93. package/src/rules/node-registration-complete.ts +79 -0
  94. package/src/rules/require-version.test.ts +90 -0
  95. package/src/rules/require-version.ts +62 -0
  96. package/src/rules/valid-author.test.ts +108 -0
  97. package/src/rules/valid-author.ts +100 -0
  98. package/src/rules/valid-peer-dependencies.test.ts +5 -0
  99. package/src/rules/valid-peer-dependencies.ts +5 -3
  100. package/src/utils/file-utils.ts +58 -11
  101. package/tsconfig.build.tsbuildinfo +0 -1
@@ -0,0 +1,2 @@
1
+ export declare const NodeClassDescriptionNameCamelCaseRule: import("@typescript-eslint/utils/ts-eslint").RuleModule<"notCamelCase", [], unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
2
+ //# sourceMappingURL=node-class-description-name-camelcase.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"node-class-description-name-camelcase.d.ts","sourceRoot":"","sources":["../../src/rules/node-class-description-name-camelcase.ts"],"names":[],"mappings":"AAiDA,eAAO,MAAM,qCAAqC,iJAgEhD,CAAC"}
@@ -0,0 +1,92 @@
1
+ import { TSESTree } from '@typescript-eslint/utils';
2
+ import { isNodeTypeClass, findClassProperty, findObjectProperty, getStringLiteralValue, isFileType, createRule, } from '../utils/index.js';
3
+ // `description.name` must be camelCase: a lowercase letter followed by
4
+ // letters/digits, with no separators.
5
+ const CAMEL_CASE_PATTERN = /^[a-z][a-zA-Z0-9]*$/;
6
+ /**
7
+ * Converts an arbitrary node name to camelCase by splitting on any
8
+ * non-alphanumeric separators, upper-casing the first character of each
9
+ * subsequent segment, and lower-casing the very first character.
10
+ * Examples: `My Node` -> `myNode`, `my-node` -> `myNode`, `GitHub` -> `gitHub`.
11
+ */
12
+ function toCamelCase(value) {
13
+ const segments = value.split(/[^a-zA-Z0-9]+/).filter(Boolean);
14
+ if (segments.length === 0) {
15
+ return value;
16
+ }
17
+ const joined = segments
18
+ .map((segment, index) => index === 0 ? segment : segment.charAt(0).toUpperCase() + segment.slice(1))
19
+ .join('');
20
+ return joined.charAt(0).toLowerCase() + joined.slice(1);
21
+ }
22
+ // Serialize a value as a string literal using the original quote character,
23
+ // escaping any characters that would otherwise break the literal so the
24
+ // autofix never emits invalid code.
25
+ function toStringLiteral(value, quote) {
26
+ const escaped = value
27
+ .replace(/\\/g, '\\\\')
28
+ .replace(/\n/g, '\\n')
29
+ .replace(/\r/g, '\\r')
30
+ .split(quote)
31
+ .join(`\\${quote}`);
32
+ return `${quote}${escaped}${quote}`;
33
+ }
34
+ export const NodeClassDescriptionNameCamelCaseRule = createRule({
35
+ name: 'node-class-description-name-camelcase',
36
+ meta: {
37
+ type: 'problem',
38
+ docs: {
39
+ description: 'Node class `description.name` must be camelCase',
40
+ },
41
+ messages: {
42
+ notCamelCase: "Node `description.name` '{{value}}' must be camelCase",
43
+ },
44
+ fixable: 'code',
45
+ schema: [],
46
+ },
47
+ defaultOptions: [],
48
+ create(context) {
49
+ if (!isFileType(context.filename, '.node.ts')) {
50
+ return {};
51
+ }
52
+ return {
53
+ ClassDeclaration(node) {
54
+ if (!isNodeTypeClass(node)) {
55
+ return;
56
+ }
57
+ const descriptionProperty = findClassProperty(node, 'description');
58
+ if (descriptionProperty?.value?.type !== TSESTree.AST_NODE_TYPES.ObjectExpression) {
59
+ return;
60
+ }
61
+ const nameProperty = findObjectProperty(descriptionProperty.value, 'name');
62
+ if (!nameProperty) {
63
+ return;
64
+ }
65
+ const nameValue = getStringLiteralValue(nameProperty.value);
66
+ if (nameValue === null) {
67
+ return;
68
+ }
69
+ if (CAMEL_CASE_PATTERN.test(nameValue)) {
70
+ return;
71
+ }
72
+ const valueNode = nameProperty.value;
73
+ const fixedValue = toCamelCase(nameValue);
74
+ // Only offer an autofix when it actually yields a valid camelCase
75
+ // value (e.g. names starting with a digit cannot be repaired).
76
+ const canFix = fixedValue !== nameValue && CAMEL_CASE_PATTERN.test(fixedValue);
77
+ context.report({
78
+ node: valueNode,
79
+ messageId: 'notCamelCase',
80
+ data: { value: nameValue },
81
+ fix: canFix
82
+ ? (fixer) => {
83
+ const quote = context.sourceCode.getText(valueNode).charAt(0);
84
+ return fixer.replaceText(valueNode, toStringLiteral(fixedValue, quote));
85
+ }
86
+ : undefined,
87
+ });
88
+ },
89
+ };
90
+ },
91
+ });
92
+ //# sourceMappingURL=node-class-description-name-camelcase.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"node-class-description-name-camelcase.js","sourceRoot":"","sources":["../../src/rules/node-class-description-name-camelcase.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAEpD,OAAO,EACN,eAAe,EACf,iBAAiB,EACjB,kBAAkB,EAClB,qBAAqB,EACrB,UAAU,EACV,UAAU,GACV,MAAM,mBAAmB,CAAC;AAE3B,uEAAuE;AACvE,sCAAsC;AACtC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IAAI,EAAE,SAAS;oBACf,SAAS,EAAE,cAAc;oBACzB,IAAI,EAAE,EAAE,KAAK,EAAE,SAAS,EAAE;oBAC1B,GAAG,EAAE,MAAM;wBACV,CAAC,CAAC,CAAC,KAAK,EAAE,EAAE;4BACV,MAAM,KAAK,GAAG,OAAO,CAAC,UAAU,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;4BAC9D,OAAO,KAAK,CAAC,WAAW,CAAC,SAAS,EAAE,eAAe,CAAC,UAAU,EAAE,KAAK,CAAC,CAAC,CAAC;wBACzE,CAAC;wBACF,CAAC,CAAC,SAAS;iBACZ,CAAC,CAAC;YACJ,CAAC;SACD,CAAC;IACH,CAAC;CACD,CAAC,CAAC"}
@@ -0,0 +1,2 @@
1
+ export declare const NodeFilenameAgainstConventionRule: import("@typescript-eslint/utils/ts-eslint").RuleModule<"renameFile", [], unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
2
+ //# sourceMappingURL=node-filename-against-convention.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"node-filename-against-convention.d.ts","sourceRoot":"","sources":["../../src/rules/node-filename-against-convention.ts"],"names":[],"mappings":"AAqBA,eAAO,MAAM,iCAAiC,+IAsD5C,CAAC"}
@@ -0,0 +1,61 @@
1
+ import { TSESTree } from '@typescript-eslint/utils';
2
+ import * as path from 'node:path';
3
+ import { isNodeTypeClass, findClassProperty, findObjectProperty, getStringLiteralValue, isFileType, createRule, } from '../utils/index.js';
4
+ /**
5
+ * Converts a `description.name` to the expected node file basename by
6
+ * upper-casing the first character. The source of truth is `description.name`,
7
+ * not the class name. Example: `github` -> `Github`.
8
+ */
9
+ function toExpectedBaseName(name) {
10
+ return name.charAt(0).toUpperCase() + name.slice(1);
11
+ }
12
+ export const NodeFilenameAgainstConventionRule = createRule({
13
+ name: 'node-filename-against-convention',
14
+ meta: {
15
+ type: 'problem',
16
+ docs: {
17
+ description: 'Node filename must match the node `description.name`',
18
+ },
19
+ messages: {
20
+ renameFile: 'Node filename must match `description.name`. Rename file to "{{expected}}".',
21
+ },
22
+ schema: [],
23
+ },
24
+ defaultOptions: [],
25
+ create(context) {
26
+ if (!isFileType(context.filename, '.node.ts')) {
27
+ return {};
28
+ }
29
+ return {
30
+ ClassDeclaration(node) {
31
+ if (!isNodeTypeClass(node)) {
32
+ return;
33
+ }
34
+ const descriptionProperty = findClassProperty(node, 'description');
35
+ if (descriptionProperty?.value?.type !== TSESTree.AST_NODE_TYPES.ObjectExpression) {
36
+ return;
37
+ }
38
+ const nameProperty = findObjectProperty(descriptionProperty.value, 'name');
39
+ if (!nameProperty) {
40
+ return;
41
+ }
42
+ const name = getStringLiteralValue(nameProperty.value);
43
+ if (!name) {
44
+ return;
45
+ }
46
+ const expectedBaseName = toExpectedBaseName(name);
47
+ // Strip the `.node.ts` extension and any trailing `V<digits>` version
48
+ // suffix so versioned files (e.g. `GithubV2.node.ts`) are accepted.
49
+ const actualBaseName = path.basename(context.filename, '.node.ts').replace(/V\d+$/, '');
50
+ if (actualBaseName !== expectedBaseName) {
51
+ context.report({
52
+ node: nameProperty.value,
53
+ messageId: 'renameFile',
54
+ data: { expected: `${expectedBaseName}.node.ts` },
55
+ });
56
+ }
57
+ },
58
+ };
59
+ },
60
+ });
61
+ //# sourceMappingURL=node-filename-against-convention.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"node-filename-against-convention.js","sourceRoot":"","sources":["../../src/rules/node-filename-against-convention.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AACpD,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAElC,OAAO,EACN,eAAe,EACf,iBAAiB,EACjB,kBAAkB,EAClB,qBAAqB,EACrB,UAAU,EACV,UAAU,GACV,MAAM,mBAAmB,CAAC;AAE3B;;;;GAIG;AACH,SAAS,kBAAkB,CAAC,IAAY;IACvC,OAAO,IAAI,CAAC,MAAM,CAAC,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AC,QAAQ,EAAE,UAAU,CAAC,CAAC,OAAO,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC;gBAExF,IAAI,cAAc,KAAK,gBAAgB,EAAE,CAAC;oBACzC,OAAO,CAAC,MAAM,CAAC;wBACd,IAAI,EAAE,YAAY,CAAC,KAAK;wBACxB,SAAS,EAAE,YAAY;wBACvB,IAAI,EAAE,EAAE,QAAQ,EAAE,GAAG,gBAAgB,UAAU,EAAE;qBACjD,CAAC,CAAC;gBACJ,CAAC;YACF,CAAC;SACD,CAAC;IACH,CAAC;CACD,CAAC,CAAC"}
@@ -0,0 +1,2 @@
1
+ export declare const NodeRegistrationCompleteRule: import("@typescript-eslint/utils/ts-eslint").RuleModule<"nodeNotRegistered", [], unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
2
+ //# sourceMappingURL=node-registration-complete.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"node-registration-complete.d.ts","sourceRoot":"","sources":["../../src/rules/node-registration-complete.ts"],"names":[],"mappings":"AAWA,eAAO,MAAM,4BAA4B,sJAqDvC,CAAC"}
@@ -0,0 +1,60 @@
1
+ import { AST_NODE_TYPES } from '@typescript-eslint/utils';
2
+ import * as path from 'node:path';
3
+ import { createRule, findJsonProperty, findNodeSourceFilesOnDisk, readPackageJsonNodes, } from '../utils/index.js';
4
+ export const NodeRegistrationCompleteRule = createRule({
5
+ name: 'node-registration-complete',
6
+ meta: {
7
+ type: 'problem',
8
+ docs: {
9
+ description: 'Ensure every `.node.ts` file in the `nodes/` directory is registered in the "n8n.nodes" array of package.json',
10
+ },
11
+ messages: {
12
+ nodeNotRegistered: 'The node file "{{ nodeFile }}" is not registered in the "n8n.nodes" array of package.json. Add it so n8n can discover the node.',
13
+ },
14
+ schema: [],
15
+ },
16
+ defaultOptions: [],
17
+ create(context) {
18
+ if (!context.filename.endsWith('package.json')) {
19
+ return {};
20
+ }
21
+ return {
22
+ ObjectExpression(node) {
23
+ // Only inspect the root object of the package.json file.
24
+ if (node.parent?.type !== AST_NODE_TYPES.ExpressionStatement) {
25
+ return;
26
+ }
27
+ const nodeFilesOnDisk = findNodeSourceFilesOnDisk(context.filename);
28
+ if (nodeFilesOnDisk.length === 0) {
29
+ return;
30
+ }
31
+ const registered = new Set(readPackageJsonNodes(context.filename).map((filePath) => path.resolve(filePath)));
32
+ const packageDir = path.dirname(context.filename);
33
+ const reportTarget = resolveReportTarget(node);
34
+ for (const nodeFile of nodeFilesOnDisk) {
35
+ if (registered.has(path.resolve(nodeFile))) {
36
+ continue;
37
+ }
38
+ context.report({
39
+ node: reportTarget,
40
+ messageId: 'nodeNotRegistered',
41
+ data: { nodeFile: path.relative(packageDir, nodeFile) },
42
+ });
43
+ }
44
+ },
45
+ };
46
+ },
47
+ });
48
+ /**
49
+ * Reports against the most specific available node: the `n8n.nodes` array, the
50
+ * `n8n` object, or the package.json root object as a fallback.
51
+ */
52
+ function resolveReportTarget(root) {
53
+ const n8nProperty = findJsonProperty(root, 'n8n');
54
+ if (n8nProperty?.value.type !== AST_NODE_TYPES.ObjectExpression) {
55
+ return n8nProperty ?? root;
56
+ }
57
+ const nodesProperty = findJsonProperty(n8nProperty.value, 'nodes');
58
+ return nodesProperty ?? n8nProperty;
59
+ }
60
+ //# sourceMappingURL=node-registration-complete.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"node-registration-complete.js","sourceRoot":"","sources":["../../src/rules/node-registration-complete.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAC1D,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAElC,OAAO,EACN,UAAU,EACV,gBAAgB,EAChB,yBAAyB,EACzB,oBAAoB,GACpB,MAAM,mBAAmB,CAAC;AAE3B,MAAM,CAAC,MAAM,4BAA4B,GAAG,UAAU,CAAC;IACtD,IAAI,EAAE,4BAA4B;IAClC,IAAI,EAAE;QACL,IAAI,EAAE,SAAS;QACf,IAAI,EAAE;YACL,WAAW,E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,CAAC,EAAE;qBACvD,CAAC,CAAC;gBACJ,CAAC;YACF,CAAC;SACD,CAAC;IACH,CAAC;CACD,CAAC,CAAC;AAEH;;;GAGG;AACH,SAAS,mBAAmB,CAAC,IAA+B;IAC3D,MAAM,WAAW,GAAG,gBAAgB,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;IAClD,IAAI,WAAW,EAAE,KAAK,CAAC,IAAI,KAAK,cAAc,CAAC,gBAAgB,EAAE,CAAC;QACjE,OAAO,WAAW,IAAI,IAAI,CAAC;IAC5B,CAAC;IAED,MAAM,aAAa,GAAG,gBAAgB,CAAC,WAAW,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;IACnE,OAAO,aAAa,IAAI,WAAW,CAAC;AACrC,CAAC"}
@@ -0,0 +1,2 @@
1
+ export declare const RequireVersionRule: import("@typescript-eslint/utils/ts-eslint").RuleModule<"missingVersion" | "invalidVersion", [], unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
2
+ //# sourceMappingURL=require-version.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"require-version.d.ts","sourceRoot":"","sources":["../../src/rules/require-version.ts"],"names":[],"mappings":"AASA,eAAO,MAAM,kBAAkB,sKAoD7B,CAAC"}
@@ -0,0 +1,50 @@
1
+ import { AST_NODE_TYPES } from '@typescript-eslint/utils';
2
+ import { createRule, findJsonProperty } from '../utils/index.js';
3
+ // Official SemVer 2.0.0 regex (https://semver.org/), anchored.
4
+ const SEMVER_REGEX = /^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$/;
5
+ export const RequireVersionRule = createRule({
6
+ name: 'require-version',
7
+ meta: {
8
+ type: 'problem',
9
+ docs: {
10
+ description: 'Require a valid "version" field in community node package.json',
11
+ },
12
+ messages: {
13
+ missingVersion: 'The package.json must have a "version" field. npm requires a valid semantic version (e.g. "1.0.0") to publish the package.',
14
+ invalidVersion: 'The "version" field must be a valid semantic version string (e.g. "1.0.0"), got {{ value }}.',
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
+ if (node.parent?.type !== AST_NODE_TYPES.ExpressionStatement) {
26
+ return;
27
+ }
28
+ const versionProp = findJsonProperty(node, 'version');
29
+ if (!versionProp) {
30
+ context.report({
31
+ node,
32
+ messageId: 'missingVersion',
33
+ });
34
+ return;
35
+ }
36
+ const valueNode = versionProp.value;
37
+ const value = valueNode.type === AST_NODE_TYPES.Literal ? valueNode.value : null;
38
+ if (typeof value !== 'string' || !SEMVER_REGEX.test(value)) {
39
+ const rawValue = valueNode.type === AST_NODE_TYPES.Literal ? String(valueNode.raw) : 'non-literal';
40
+ context.report({
41
+ node: versionProp,
42
+ messageId: 'invalidVersion',
43
+ data: { value: rawValue },
44
+ });
45
+ }
46
+ },
47
+ };
48
+ },
49
+ });
50
+ //# sourceMappingURL=require-version.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"require-version.js","sourceRoot":"","sources":["../../src/rules/require-version.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAE1D,OAAO,EAAE,UAAU,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAEjE,+DAA+D;AAC/D,MAAM,YAAY,GACjB,qLAAqL,CAAC;AAEvL,MAAM,CAAC,MAAM,kBAAkB,GAAG,UAAU,CAAC;IAC5C,IAAI,EAAE,iBAAiB;IACvB,IAAI,EAAE;QACL,IAAI,EAAE,SAAS;QACf,IAAI,EAAE;YACL,WAAW,EAAE,gEAAgE;SAC7E;QACD,QAAQ,EAAE;YACT,cAA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ACH,CAAC;CACD,CAAC,CAAC"}
@@ -0,0 +1,2 @@
1
+ export declare const ValidAuthorRule: import("@typescript-eslint/utils/ts-eslint").RuleModule<"authorMissing" | "authorNameMissing" | "authorEmailMissing", [], unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
2
+ //# sourceMappingURL=valid-author.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"valid-author.d.ts","sourceRoot":"","sources":["../../src/rules/valid-author.ts"],"names":[],"mappings":"AA+BA,eAAO,MAAM,eAAe,+LAoE1B,CAAC"}
@@ -0,0 +1,89 @@
1
+ import { AST_NODE_TYPES } from '@typescript-eslint/utils';
2
+ import { createRule, findJsonProperty, getTopLevelObjectInJson } from '../utils/index.js';
3
+ /**
4
+ * Parses an npm "person" shorthand string of the form
5
+ * `Name <email> (url)` into its name and email parts. Any part may be absent.
6
+ */
7
+ function parsePersonString(value) {
8
+ const emailMatch = /<([^>]*)>/.exec(value);
9
+ const email = (emailMatch?.[1] ?? '').trim();
10
+ const ltIndex = value.indexOf('<');
11
+ const parenIndex = value.indexOf('(');
12
+ let nameEnd = value.length;
13
+ if (ltIndex !== -1)
14
+ nameEnd = Math.min(nameEnd, ltIndex);
15
+ if (parenIndex !== -1)
16
+ nameEnd = Math.min(nameEnd, parenIndex);
17
+ const name = value.slice(0, nameEnd).trim();
18
+ return { name, email };
19
+ }
20
+ function isNonEmptyStringLiteral(node) {
21
+ if (!node || node.value.type !== AST_NODE_TYPES.Literal) {
22
+ return false;
23
+ }
24
+ const { value } = node.value;
25
+ return typeof value === 'string' && value.trim().length > 0;
26
+ }
27
+ export const ValidAuthorRule = createRule({
28
+ name: 'valid-author',
29
+ meta: {
30
+ type: 'problem',
31
+ docs: {
32
+ description: 'Require a non-empty author name and email in package.json',
33
+ },
34
+ messages: {
35
+ authorMissing: 'package.json must have an "author" field with a non-empty name and email.',
36
+ authorNameMissing: 'The "author" field must include a non-empty name.',
37
+ authorEmailMissing: 'The "author" field must include a non-empty email.',
38
+ },
39
+ schema: [],
40
+ },
41
+ defaultOptions: [],
42
+ create(context) {
43
+ if (!context.filename.endsWith('package.json')) {
44
+ return {};
45
+ }
46
+ return {
47
+ ObjectExpression(node) {
48
+ const root = getTopLevelObjectInJson(node);
49
+ if (!root) {
50
+ return;
51
+ }
52
+ const authorProp = findJsonProperty(root, 'author');
53
+ if (!authorProp) {
54
+ context.report({ node: root, messageId: 'authorMissing' });
55
+ return;
56
+ }
57
+ const authorValue = authorProp.value;
58
+ // Shorthand string form: "Name <email> (url)"
59
+ if (authorValue.type === AST_NODE_TYPES.Literal) {
60
+ if (typeof authorValue.value !== 'string') {
61
+ context.report({ node: authorProp, messageId: 'authorMissing' });
62
+ return;
63
+ }
64
+ const { name, email } = parsePersonString(authorValue.value);
65
+ if (name.length === 0) {
66
+ context.report({ node: authorProp, messageId: 'authorNameMissing' });
67
+ }
68
+ if (email.length === 0) {
69
+ context.report({ node: authorProp, messageId: 'authorEmailMissing' });
70
+ }
71
+ return;
72
+ }
73
+ // Object form: { "name": "...", "email": "..." }
74
+ if (authorValue.type === AST_NODE_TYPES.ObjectExpression) {
75
+ if (!isNonEmptyStringLiteral(findJsonProperty(authorValue, 'name'))) {
76
+ context.report({ node: authorProp, messageId: 'authorNameMissing' });
77
+ }
78
+ if (!isNonEmptyStringLiteral(findJsonProperty(authorValue, 'email'))) {
79
+ context.report({ node: authorProp, messageId: 'authorEmailMissing' });
80
+ }
81
+ return;
82
+ }
83
+ // Any other shape (e.g. array, null) cannot carry a name and email.
84
+ context.report({ node: authorProp, messageId: 'authorMissing' });
85
+ },
86
+ };
87
+ },
88
+ });
89
+ //# sourceMappingURL=valid-author.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"valid-author.js","sourceRoot":"","sources":["../../src/rules/valid-author.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAE1D,OAAO,EAAE,UAAU,EAAE,gBAAgB,EAAE,uBAAuB,EAA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AC,MAAM,CAAC,EAAE,IAAI,EAAE,UAAU,EAAE,SAAS,EAAE,mBAAmB,EAAE,CAAC,CAAC;oBACtE,CAAC;oBACD,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;wBACxB,OAAO,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,UAAU,EAAE,SAAS,EAAE,oBAAoB,EAAE,CAAC,CAAC;oBACvE,CAAC;oBACD,OAAO;gBACR,CAAC;gBAED,iDAAiD;gBACjD,IAAI,WAAW,CAAC,IAAI,KAAK,cAAc,CAAC,gBAAgB,EAAE,CAAC;oBAC1D,IAAI,CAAC,uBAAuB,CAAC,gBAAgB,CAAC,WAAW,EAAE,MAAM,CAAC,CAAC,EAAE,CAAC;wBACrE,OAAO,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,UAAU,EAAE,SAAS,EAAE,mBAAmB,EAAE,CAAC,CAAC;oBACtE,CAAC;oBACD,IAAI,CAAC,uBAAuB,CAAC,gBAAgB,CAAC,WAAW,EAAE,OAAO,CAAC,CAAC,EAAE,CAAC;wBACtE,OAAO,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,UAAU,EAAE,SAAS,EAAE,oBAAoB,EAAE,CAAC,CAAC;oBACvE,CAAC;oBACD,OAAO;gBACR,CAAC;gBAED,oEAAoE;gBACpE,OAAO,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,UAAU,EAAE,SAAS,EAAE,eAAe,EAAE,CAAC,CAAC;YAClE,CAAC;SACD,CAAC;IACH,CAAC;CACD,CAAC,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"valid-peer-dependencies.d.ts","sourceRoot":"","sources":["../../src/rules/valid-peer-dependencies.ts"],"names":[],"mappings":"AASA,eAAO,MAAM,yBAAyB,qQA0GpC,CAAC"}
1
+ {"version":3,"file":"valid-peer-dependencies.d.ts","sourceRoot":"","sources":["../../src/rules/valid-peer-dependencies.ts"],"names":[],"mappings":"AAWA,eAAO,MAAM,yBAAyB,qQA0GpC,CAAC"}
@@ -2,13 +2,15 @@ import { AST_NODE_TYPES } from '@typescript-eslint/utils';
2
2
  import { createRule, findJsonProperty } from '../utils/index.js';
3
3
  const REQUIRED_DEP = 'n8n-workflow';
4
4
  const REQUIRED_VERSION = '*';
5
- const ALLOWED_DEPS = new Set([REQUIRED_DEP, 'ai-node-sdk']);
5
+ // The published SDK is scoped (@n8n/ai-node-sdk); the unscoped name is kept for
6
+ // backwards compatibility, mirroring no-restricted-imports.
7
+ const ALLOWED_DEPS = new Set([REQUIRED_DEP, '@n8n/ai-node-sdk', 'ai-node-sdk']);
6
8
  export const ValidPeerDependenciesRule = createRule({
7
9
  name: 'valid-peer-dependencies',
8
10
  meta: {
9
11
  type: 'problem',
10
12
  docs: {
11
- description: 'Require community node package.json peerDependencies to contain only "n8n-workflow": "*" (and optionally "ai-node-sdk")',
13
+ description: 'Require community node package.json peerDependencies to contain only "n8n-workflow": "*" (and optionally "@n8n/ai-node-sdk")',
12
14
  },
13
15
  fixable: 'code',
14
16
  messages: {
@@ -16,7 +18,7 @@ export const ValidPeerDependenciesRule = createRule({
16
18
  invalidPeerDependenciesType: `"peerDependencies" must be an object mapping package names to version ranges (containing "${REQUIRED_DEP}": "${REQUIRED_VERSION}").`,
17
19
  missingN8nWorkflow: `"peerDependencies" must include "${REQUIRED_DEP}": "${REQUIRED_VERSION}".`,
18
20
  pinnedN8nWorkflow: `"peerDependencies.${REQUIRED_DEP}" must be "${REQUIRED_VERSION}", got {{ value }}.`,
19
- forbiddenPeerDependency: '"{{ name }}" is not allowed in "peerDependencies". Only "n8n-workflow" and "ai-node-sdk" are permitted.',
21
+ forbiddenPeerDependency: '"{{ name }}" is not allowed in "peerDependencies". Only "n8n-workflow" and "@n8n/ai-node-sdk" are permitted.',
20
22
  },
21
23
  schema: [],
22
24
  },
@@ -1 +1 @@
1
- {"version":3,"file":"valid-peer-dependencies.js","sourceRoot":"","sources":["../../src/rules/valid-peer-dependencies.ts"],"names":[],"mappings":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