Skip to content

Commit

Permalink
fix(editor): remove wrong linting from Code node editor (#4384)
Browse files Browse the repository at this point in the history
🔥 Remove wrong linting from Code node
  • Loading branch information
ivov authored Oct 19, 2022
1 parent 50c18a7 commit 77d041b
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 29 deletions.
28 changes: 0 additions & 28 deletions packages/editor-ui/src/components/CodeNodeEditor/linter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
*
Expand Down
1 change: 0 additions & 1 deletion packages/editor-ui/src/plugins/i18n/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -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.",
Expand Down

0 comments on commit 77d041b

Please sign in to comment.