mirror of
https://github.com/n8n-io/n8n.git
synced 2024-12-25 12:44:07 -08:00
fix(editor): Curb overeager item access linting (#5865)
⚡ Curb overeager item access linting
This commit is contained in:
parent
e11a30a640
commit
3ae69337ee
|
@ -133,7 +133,7 @@ export const linterExtension = (Vue as CodeNodeEditorMixin).extend({
|
|||
}
|
||||
|
||||
/**
|
||||
* Lint for `.item` unavailable in `runOnceForAllItems` mode
|
||||
* Lint for `.item` unavailable in `$input` in `runOnceForAllItems` mode
|
||||
*
|
||||
* $input.item -> <removed>
|
||||
*/
|
||||
|
@ -141,13 +141,15 @@ export const linterExtension = (Vue as CodeNodeEditorMixin).extend({
|
|||
if (this.mode === 'runOnceForAllItems') {
|
||||
type TargetNode = RangeNode & { property: RangeNode };
|
||||
|
||||
const isUnavailableItemAccess = (node: Node) =>
|
||||
const isUnavailableInputItemAccess = (node: Node) =>
|
||||
node.type === 'MemberExpression' &&
|
||||
node.computed === false &&
|
||||
node.object.type === 'Identifier' &&
|
||||
node.object.name === '$input' &&
|
||||
node.property.type === 'Identifier' &&
|
||||
node.property.name === 'item';
|
||||
|
||||
walk<TargetNode>(ast, isUnavailableItemAccess).forEach((node) => {
|
||||
walk<TargetNode>(ast, isUnavailableInputItemAccess).forEach((node) => {
|
||||
const [start, end] = this.getRange(node.property);
|
||||
|
||||
lintings.push({
|
||||
|
|
Loading…
Reference in a new issue