Skip to content

Latest commit

 

History

History
45 lines (33 loc) · 1.03 KB

node-execute-block-double-assertion-for-items.md

File metadata and controls

45 lines (33 loc) · 1.03 KB

node-execute-block-double-assertion-for-items

In the execute() method there is no need to double assert the type of items.length.

📋 This rule is part of the plugin:n8n-nodes-base/nodes config.

🔧 Run ESLint with --fix option to autofix the issue flagged by this rule.

Examples

❌ Example of incorrect code:

class TestNode {
    async execute() {
        const items = this.getInputData();
        const length = items.length as unknown as number;
    }
}

class TestNode {
    async execute() {
        const items = this.getInputData();
        const length = (items.length as unknown) as number;
    }
}

✅ Example of correct code:

class TestNode {
	async execute() {
		const items = this.getInputData();
		const length = items.length;
	}
}

Links