Is there a way to get proper linting when developing nodes? I have no type information about the 'RED' variable that is used with the Node-RED functions.
Is there some dev dependency I can add? Or something else I need to configure.
I know my way around javascript the language, but the whole ecosystem is still very unclear to me.
I think that the current info is in the node-red package itself. so you might need to install it as a dev dependency for each node you are developing.
Personally, I don't like to do that so UIBUILDER has its own typedef defined. That includes some basic node-red stull but also all of the extended definitions of my own nodes including runtime and editor.
installed it,
RED still has type: any, and no method signatures.
So that doesn't seem to work or I'm missing something, I did npm install after adding it to my package.json under "devDependencies".
You can always do what I do and add a typedefs.js file in the root of your package. I just use JSDoc definitions in there, VScode is quite happy with that.
Feel free to use the file in the uibuilder package as a starting point.
I have to say - just my personal opinion of course - that the reason I switched to using Node.js from PHP over a decade a go was that I didn't want to spend time learning multiple languages and I already had to know JavaScript for the browser.
So for me, using Typescript would be a serious backwards step. JavaScript with VSCode and decent use of JSDoc definitions seems to do everything I would want from Typescript without having to write double the number of files with significantly more complex grammar (JS is bad enough).
its already too late for not learning multiple languages haha, I have to use matlab, c, zig, rust, python,javascript, bash on a day to day base. Okay zig and rust are not mandatory, I wormed those in but yeah, I really like statically typed languages, I've tried some typescript and so far liking it a lot more than javascript.
Fair enough and if you use C/C++ I suspect that makes TypeScript rather more acceptable.
Nobody doubts that JavaScript is a fairly horrid language. But it is still infinitely nicer to use (in my highly biased opinion ) than C/C++.
To be fair, some of JS's horrors lie not in the language but in the HTML API's some of which are appalling.
But hey, as I say, I can't avoid JS and after so long, I can't be bothered to learn a new language - I'm not a professional developer after all (used to be, a very, very long time ago now).
If I were going to learn (re-learn actually) another server-side language, it would be to learn more Python again. I know just enough C/C++ to be able to do stuff on Microcontrollers if I have to. I use BASH and PowerShell where I need to, thankfully not too often. I do miss FORTH and APL though