mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-21 11:49:59 +00:00
fix(editor): curb item method linting in single-item mode in CodeNodeEditor linter (#4455)
🐛 Curb item method linting
This commit is contained in:
@@ -215,22 +215,25 @@ export const linterExtension = (Vue as CodeNodeEditorMixin).extend({
|
||||
const isUnavailableMethodinEachItem = (node: Node) =>
|
||||
node.type === 'MemberExpression' &&
|
||||
node.computed === false &&
|
||||
node.object.type === 'Identifier' &&
|
||||
node.object.name === '$input' &&
|
||||
node.property.type === 'Identifier' &&
|
||||
['first', 'last', 'all', 'itemMatching'].includes(node.property.name);
|
||||
|
||||
walk<TargetNode>(ast, isUnavailableMethodinEachItem).forEach((node) => {
|
||||
const [start, end] = this.getRange(node.property);
|
||||
|
||||
const message = [
|
||||
`\`.${node.property.name}()\``,
|
||||
this.$locale.baseText('codeNodeEditor.linter.eachItem.unavailableMethod'),
|
||||
].join(' ');
|
||||
const method = this.getText(node.property);
|
||||
|
||||
if (!method) return;
|
||||
|
||||
lintings.push({
|
||||
from: start,
|
||||
to: end,
|
||||
severity: DEFAULT_LINTER_SEVERITY,
|
||||
message,
|
||||
message: this.$locale.baseText('codeNodeEditor.linter.eachItem.unavailableMethod', {
|
||||
interpolate: { method },
|
||||
}),
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user