on
CC-BY-NC-SA-4.0 AGPL-3.0-only
1 mins
π€ This post includes some LLM-derived content π€
Adding type hints to Renovate config.js files

I'm a fan of using Renovate's config.js file format for the global self-hosting configuration.
One thing that's always caught me out, compared to the repo-level configuration, is that I don't get IDE autocomplete by default.
Today, I ended up sitting down to look at how to get it working - and turns out it was ~2 lines of code to add π«£
(This is based on my experience using Neovim 0.11.4, and ts_ls 5.0.1)
Because it is "just" a JavaScript file, we can take advantage of JSDoc annotations on our types.
With help from GPT-4.1 (via GitHub Copilot), I managed to work out the right syntax to get this working:
/**
* @typedef {import('renovate/dist/config/types').AllConfig} AllConfig
*/
/** @type {AllConfig} */
module.exports = {
allowedCommands: ['*'],
allowedEnv: ['*'],
};
This now gives you autocomplete and type hinting when you go to modify module.exports, based on Renovate's inbuilt types.
Note that you may need to npm install renovate in the directory/workspace that you're running from.
You can also see it in action in the following Asciicast: