Skip to content

function-eslint doesn't know about Buffer, util and modules imported in functionExternalModules #37

@pauldeng

Description

@pauldeng

Current Behavior

Similar to issue #22.

The function-eslint rule complains if a function node references Buffer, util and modules imported in functionExternalModules - saying they are not defined.

Expected Behavior

Any built-in object the Function node provides should not cause lint errors.

Modules added to the Setup page of function should not cause lint errors.

Steps To Reproduce

No response

Example flow

[{"id":"c6aa1fb9b985ec0c","type":"inject","z":"2c71e369871e1bf1","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":300,"y":200,"wires":[["f3c126edd67f2eab"]]},{"id":"f3c126edd67f2eab","type":"function","z":"2c71e369871e1bf1","name":"function 1","func":"msg.payload = Buffer.from('010203', 'hex');\n\nmsg.print = sprintfJs.sprintf(\"hello world %d\", 1234);\n\nmsg.hello = util.format('%s:%s', 'foo', 'bar');\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[{"var":"sprintfJs","module":"sprintf-js"}],"x":500,"y":200,"wires":[["f13d7e94ed4589f2"]]},{"id":"f13d7e94ed4589f2","type":"debug","z":"2c71e369871e1bf1","name":"debug 1","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":720,"y":200,"wires":[]}]

Environment

  • nrlint version: 1.1.0
  • Node-RED version: 3.0.2
  • Node.js version: 16.17
  • npm version: 8.15.0
  • Platform/OS: Ubuntu 20.04
  • Browser: Firefox 103.0

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions