mirror of
https://github.com/n8n-io/n8n.git
synced 2025-02-02 07:01:30 -08:00
fix(editor): remove wrong linting from Code node editor (#4384)
🔥 Remove wrong linting from Code node
This commit is contained in:
parent
50c18a789a
commit
77d041ba78
|
@ -263,34 +263,6 @@ export const linterExtension = (Vue as CodeNodeEditorMixin).extend({
|
|||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Lint for `.all()` called with argument in `runOnceForAllItems` mode
|
||||
*
|
||||
* $input.itemMatching()
|
||||
*/
|
||||
|
||||
if (this.mode === 'runOnceForAllItems') {
|
||||
type TargetNode = RangeNode & { callee: RangeNode & { property: RangeNode } };
|
||||
|
||||
const isItemMatchingCallWithoutArg = (node: Node) =>
|
||||
node.type === 'CallExpression' &&
|
||||
node.callee.type === 'MemberExpression' &&
|
||||
node.callee.property.type === 'Identifier' &&
|
||||
node.callee.property.name === 'all' &&
|
||||
node.arguments.length !== 0;
|
||||
|
||||
walk<TargetNode>(ast, isItemMatchingCallWithoutArg).forEach((node) => {
|
||||
const [start, end] = this.getRange(node.callee.property);
|
||||
|
||||
lintings.push({
|
||||
from: start,
|
||||
to: end + '()'.length,
|
||||
severity: DEFAULT_LINTER_SEVERITY,
|
||||
message: this.$locale.baseText('codeNodeEditor.linter.allItems.allCalledWithArg'),
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Lint for `.first()` or `.last()` called with argument in `runOnceForAllItems` mode
|
||||
*
|
||||
|
|
|
@ -219,7 +219,6 @@
|
|||
"codeNodeEditor.completer.selector.last": "@:_reusableBaseText.codeNodeEditor.completer.last",
|
||||
"codeNodeEditor.completer.selector.params": "The parameters of the node",
|
||||
"codeNodeEditor.linter.allItems.firstOrLastCalledWithArg": "expects no argument.",
|
||||
"codeNodeEditor.linter.allItems.allCalledWithArg": "`.all()` expects no argument. To access a specific item, use bracket notation: `.all()[index]`.",
|
||||
"codeNodeEditor.linter.allItems.emptyReturn": "Code doesn't return items properly. Please return an array of objects, one for each item you would like to output.",
|
||||
"codeNodeEditor.linter.allItems.itemCall": "`item` is a property to access, not a method to call. Did you mean `.item` without brackets?",
|
||||
"codeNodeEditor.linter.allItems.itemMatchingNoArg": "`.itemMatching()` expects an item index to be passed in as its argument.",
|
||||
|
|
Loading…
Reference in a new issue