How to handle non-semver packages when using Renovate with `group:allNonMajor`?

I’m using Renovate to keep dependencies up-to-date. I use the group:allNonMajor preset, which groups all minor and patch-version updates in a single pull request:

// renovate.json
{
  "$schema": "https://docs.renovatebot.com/renovate-schema.json",
  "extends": ["group:allNonMajor"]
}

For packages that follow the semver versioning, this makes sense because these updates are non-breaking.

However, some packages do not follow semver. For example, the typescript package is one such package that breaks APIs even with minor version update.

How can I make Renovate to update minor versions of packages like typescript in separate pull requests?

You can achieve this by appending package rules:

{
  "$schema": "https://docs.renovatebot.com/renovate-schema.json",
  "extends": ["group:allNonMajor"],
  "packageRules": [
    {
      "groupName": "typescript minor/major",
      "matchDatasources": ["npm"],
      "matchPackageNames": ["typescript"],
      "matchUpdateTypes": ["major", "minor"]
    },
    {  // Another example
      "groupName": "another non-semver package minor/major",
      "matchDatasources": ["npm"],
      "matchPackageNames": ["a-package-that-doesnt-follow-semver"],
      "matchUpdateTypes": ["major", "minor"]
    }
  ]
}

By grouping typescript major/minor version updates into its own group, Renovate will stop grouping them together with minor version updates from other dependencies. This is because later package rules override earlier package rules, including the one that groups all minor and patch version updates in group:allNonMajor.