@n8n/eslint-plugin-community-nodes 0.27.0 → 0.28.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/dist/rules/index.d.ts +1 -1
- package/dist/rules/no-restricted-globals.d.ts +1 -1
- package/dist/rules/no-restricted-globals.d.ts.map +1 -1
- package/dist/rules/no-restricted-globals.js +18 -5
- package/dist/rules/no-restricted-globals.js.map +1 -1
- package/dist/typecheck.tsbuildinfo +1 -1
- package/docs/rules/no-restricted-globals.md +14 -0
- package/package.json +2 -2
- package/src/rules/no-restricted-globals.test.ts +26 -2
- package/src/rules/no-restricted-globals.ts +22 -5
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.28.0 build /home/runner/work/n8n/n8n/packages/@n8n/eslint-plugin-community-nodes
|
|
3
3
|
> tsc --project tsconfig.build.json
|
|
4
4
|
|
package/dist/rules/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export declare const rules: {
|
|
2
2
|
'ai-node-package-json': import("@typescript-eslint/utils/ts-eslint").RuleModule<"invalidSdkVersion" | "missingPeerDep" | "missingSdkVersion" | "wrongLocation", [], unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
|
|
3
|
-
'no-restricted-globals': import("@typescript-eslint/utils/ts-eslint").RuleModule<"restrictedGlobal", [], unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
|
|
3
|
+
'no-restricted-globals': import("@typescript-eslint/utils/ts-eslint").RuleModule<"restrictedGlobal" | "restrictedGlobalWithHint", [], unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
|
|
4
4
|
'no-restricted-imports': import("@typescript-eslint/utils/ts-eslint").RuleModule<"restrictedDynamicImport" | "restrictedImport" | "restrictedRequire", [], unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
|
|
5
5
|
'credential-password-field': import("@typescript-eslint/utils/ts-eslint").RuleModule<"missingPasswordOption", [], unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
|
|
6
6
|
'no-deprecated-workflow-functions': import("@typescript-eslint/utils/ts-eslint").RuleModule<"deprecatedFunction" | "deprecatedRequestFunction" | "deprecatedType" | "deprecatedWithoutReplacement" | "suggestReplaceFunction" | "suggestReplaceType", [], unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { TSESLint } from '@typescript-eslint/utils';
|
|
2
|
-
export declare const NoRestrictedGlobalsRule: TSESLint.RuleModule<"restrictedGlobal", [], unknown, TSESLint.RuleListener>;
|
|
2
|
+
export declare const NoRestrictedGlobalsRule: TSESLint.RuleModule<"restrictedGlobal" | "restrictedGlobalWithHint", [], unknown, TSESLint.RuleListener>;
|
|
3
3
|
//# sourceMappingURL=no-restricted-globals.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"no-restricted-globals.d.ts","sourceRoot":"","sources":["../../src/rules/no-restricted-globals.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;
|
|
1
|
+
{"version":3,"file":"no-restricted-globals.d.ts","sourceRoot":"","sources":["../../src/rules/no-restricted-globals.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAwBzD,eAAO,MAAM,uBAAuB,0GAiElC,CAAC"}
|
|
@@ -13,6 +13,11 @@ const restrictedGlobals = [
|
|
|
13
13
|
'__dirname',
|
|
14
14
|
'__filename',
|
|
15
15
|
];
|
|
16
|
+
// Nudge toward the n8n-workflow alternatives that work under n8n Cloud's restrictions
|
|
17
|
+
const restrictedGlobalHints = {
|
|
18
|
+
setTimeout: "Use the 'sleep' helper from 'n8n-workflow' instead.",
|
|
19
|
+
clearTimeout: "Use 'sleepWithAbort' from 'n8n-workflow' with an AbortSignal instead.",
|
|
20
|
+
};
|
|
16
21
|
export const NoRestrictedGlobalsRule = createRule({
|
|
17
22
|
name: 'no-restricted-globals',
|
|
18
23
|
meta: {
|
|
@@ -22,6 +27,7 @@ export const NoRestrictedGlobalsRule = createRule({
|
|
|
22
27
|
},
|
|
23
28
|
messages: {
|
|
24
29
|
restrictedGlobal: "Use of restricted global '{{ name }}' is not allowed",
|
|
30
|
+
restrictedGlobalWithHint: "Use of restricted global '{{ name }}' is not allowed. {{ hint }}",
|
|
25
31
|
},
|
|
26
32
|
schema: [],
|
|
27
33
|
},
|
|
@@ -35,11 +41,18 @@ export const NoRestrictedGlobalsRule = createRule({
|
|
|
35
41
|
!parent.computed) {
|
|
36
42
|
return;
|
|
37
43
|
}
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
44
|
+
const hint = restrictedGlobalHints[name];
|
|
45
|
+
context.report(hint
|
|
46
|
+
? {
|
|
47
|
+
node: ref.identifier,
|
|
48
|
+
messageId: 'restrictedGlobalWithHint',
|
|
49
|
+
data: { name, hint },
|
|
50
|
+
}
|
|
51
|
+
: {
|
|
52
|
+
node: ref.identifier,
|
|
53
|
+
messageId: 'restrictedGlobal',
|
|
54
|
+
data: { name },
|
|
55
|
+
});
|
|
43
56
|
}
|
|
44
57
|
return {
|
|
45
58
|
Program() {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"no-restricted-globals.js","sourceRoot":"","sources":["../../src/rules/no-restricted-globals.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAGpD,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAE/C,MAAM,iBAAiB,GAAG;IACzB,eAAe;IACf,cAAc;IACd,QAAQ;IACR,YAAY;IACZ,SAAS;IACT,aAAa;IACb,YAAY;IACZ,cAAc;IACd,gBAAgB;IAChB,WAAW;IACX,YAAY;CACZ,CAAC;AAEF,MAAM,CAAC,MAAM,uBAAuB,GAAG,UAAU,CAAC;IACjD,IAAI,EAAE,uBAAuB;IAC7B,IAAI,EAAE;QACL,IAAI,EAAE,SAAS;QACf,IAAI,EAAE;YACL,WAAW,EAAE,mEAAmE;SAChF;QACD,QAAQ,EAAE;YACT,gBAAgB,EAAE,sDAAsD;
|
|
1
|
+
{"version":3,"file":"no-restricted-globals.js","sourceRoot":"","sources":["../../src/rules/no-restricted-globals.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAGpD,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAE/C,MAAM,iBAAiB,GAAG;IACzB,eAAe;IACf,cAAc;IACd,QAAQ;IACR,YAAY;IACZ,SAAS;IACT,aAAa;IACb,YAAY;IACZ,cAAc;IACd,gBAAgB;IAChB,WAAW;IACX,YAAY;CACZ,CAAC;AAEF,sFAAsF;AACtF,MAAM,qBAAqB,GAA2B;IACrD,UAAU,EAAE,qDAAqD;IACjE,YAAY,EAAE,uEAAuE;CACrF,CAAC;AAEF,MAAM,CAAC,MAAM,uBAAuB,GAAG,UAAU,CAAC;IACjD,IAAI,EAAE,uBAAuB;IAC7B,IAAI,EAAE;QACL,IAAI,EAAE,SAAS;QACf,IAAI,EAAE;YACL,WAAW,EAAE,mEAAmE;SAChF;QACD,QAAQ,EAAE;YACT,gBAAgB,EAAE,sDAAsD;YACxE,wBAAwB,EAAE,kEAAkE;SAC5F;QACD,MAAM,EAAE,EAAE;KACV;IACD,cAAc,EAAE,EAAE;IAClB,MAAM,CAAC,OAAO;QACb,SAAS,cAAc,CAAC,GAA6B,EAAE,IAAY;YAClE,MAAM,EAAE,MAAM,EAAE,GAAG,GAAG,CAAC,UAAU,CAAC;YAElC,yFAAyF;YACzF,IACC,MAAM,EAAE,IAAI,KAAK,QAAQ,CA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