Testing a lint config with fixtures

A lint config with tests, which is unusual and is the only way to know a rule change did what was intended.

// fixtures/no-floating-money.invalid.ts
const total: number = order.totalMinorUnits / 100

// tests/rules.test.ts
test('rejects a float money conversion', async () => {
  const results = await lint('fixtures/no-floating-money.invalid.ts')

  expect(results[0].messages).toContainEqual(
    expect.objectContaining({ ruleId: 'kbox/no-floating-money' }),
  )
})

A config change with no test is a change whose effect is discovered by four consumers on their next install, which is the worst possible feedback loop. Fixture files with expected violations are the same idea as a snapshot test and are more precise, because the assertion names the rule rather than the whole output.