mirror of
https://github.com/n8n-io/n8n.git
synced 2025-01-13 05:47:31 -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>
|
* $input.item -> <removed>
|
||||||
*/
|
*/
|
||||||
|
@ -141,13 +141,15 @@ export const linterExtension = (Vue as CodeNodeEditorMixin).extend({
|
||||||
if (this.mode === 'runOnceForAllItems') {
|
if (this.mode === 'runOnceForAllItems') {
|
||||||
type TargetNode = RangeNode & { property: RangeNode };
|
type TargetNode = RangeNode & { property: RangeNode };
|
||||||
|
|
||||||
const isUnavailableItemAccess = (node: Node) =>
|
const isUnavailableInputItemAccess = (node: Node) =>
|
||||||
node.type === 'MemberExpression' &&
|
node.type === 'MemberExpression' &&
|
||||||
node.computed === false &&
|
node.computed === false &&
|
||||||
|
node.object.type === 'Identifier' &&
|
||||||
|
node.object.name === '$input' &&
|
||||||
node.property.type === 'Identifier' &&
|
node.property.type === 'Identifier' &&
|
||||||
node.property.name === 'item';
|
node.property.name === 'item';
|
||||||
|
|
||||||
walk<TargetNode>(ast, isUnavailableItemAccess).forEach((node) => {
|
walk<TargetNode>(ast, isUnavailableInputItemAccess).forEach((node) => {
|
||||||
const [start, end] = this.getRange(node.property);
|
const [start, end] = this.getRange(node.property);
|
||||||
|
|
||||||
lintings.push({
|
lintings.push({
|
||||||
|
|
Loading…
Reference in a new issue