Skip to content

ci: add and use linting rule to check /help URLs

Administrator requested to merge aharvey/eslint-help-links into main

Created by: LawnGnome

The issue here is that we have /help URLs that redirect the user to specific versions of the documentation, but docsite doesn't support redirects on versioned requests, and some of those URLs currently rely on redirects within docsite for the user to not get a 404. For more detail, and an example, please refer to #17931 (closed).

I would like this to never happen again, so let's detect this. The easiest way to me feels like adding a rule to ESLint, which doesn't speak well of the other options I considered.

The linting rule has a couple of quirks:

  1. By default, it won't actually do anything unless a rule configuration or environment variable are provided. This prevents existing workflows from breaking if they're in environments where docsite can't be run.
  2. It's written in JavaScript instead of TypeScript not because I have some distrust of types, but rather because writing ESLint plugins in TypeScript is rather fraught and undocumented, and while I could get the actual plugin to work, I couldn't get the tests to pass because the type definitions for @typescript-eslint/experimental-utils are excessively readonly, and subtly mismatched with eslint, and OH GOD THE PAIN. Someone else is welcome to have a go at that, but I'm giving it up as a bad job for now.

Any other funkiness in the linting code is, I'm sure, the fault of the Yeoman template used to create the plugin and rule, and definitely not something I did.

This fixes #17931 (closed) once and for all.

Merge request reports

Loading