node-red / nrlint

Node-RED Flow Linter
Apache License 2.0
36 stars 15 forks source link

Flatten repository structure #8

Closed knolleary closed 3 years ago

knolleary commented 3 years ago

This PR flattens the repository structure.

  1. @node-red/flow-parser has moved to its own repository - https://github.com/node-red/flow-parser

    • the package.json here points to the git repo until we have a version published to npm
  2. The rules have been included in the core module, including the eslint module.

  3. The cli (bin/nrlint) has been reworked to make it easier to write tests for the core logic of the cli

It also overhauls the UI for the linter:

  1. new sidebar design
  2. new settings dialog to let the user customise their config in the editor
  3. new status widget in the footer of the workspace to show current linting summary

Remaining tasks:

  1. write more rules
  2. write more tests
  3. i18n support
knolleary commented 3 years ago

I have renamed the existing rules to follow eslint naming guidelines - https://eslint.org/docs/developer-guide/working-with-rules#rule-naming-conventions

Added no-overlapping-nodes rule that checks for nodes that physically overlap. Note: this rule is not 100% accurate when run in the CLI - this is because we don't have full node width/height information in the flow file so we have to assume a default width/height. In the editor, I've added an option in the dev branch to the editor code that exports the flow JSON to include the calculated width/height values - allowing the rule to use the correct values there.

I have had to hardcode knowledge of inject/debug node buttons into the rule - there's no easy way to include them in the node dimensions due to the way they work. So 3rd party nodes with buttons won't get handled properly - but that's an edge case we can live with.

knolleary commented 3 years ago

I'm going to merge this in preparation of releasing a beta version with 2.0