* refactor(lint): extract custom oxlint rules into separate files
Split `tools/lint/rules.js` into one file per rule under
`tools/lint/rules/`. Also simplify `test-root-describe` with
early-exit guard clauses.
* feat(lint): add `enforce-ts-extension` oxlint rule
Add a custom JS-based oxlint rule that enforces `.ts` extensions on
local imports. The rule catches two problems:
- `.js` extension used instead of `.ts` (auto-fixable)
- missing file extension entirely (report only)
Checked locations:
- static import/export declarations
- dynamic `import()` expressions
- vitest module APIs: `vi.mock`, `vi.doMock`, `vi.unmock`,
`vi.doUnmock`, `vi.importActual`, `vi.importMock`
Both relative paths (`./`, `../`) and path aliases (`~test/`)
are treated as local. Package imports are ignored.
Also fixes 26 pre-existing violations across 18 spec files.
* Update tools/lint/rules/enforce-ts-extension.js
Co-authored-by: Anne Stellingwerf <1637358+astellingwerf@users.noreply.github.com>
---------
Co-authored-by: Anne Stellingwerf <1637358+astellingwerf@users.noreply.github.com>
* feat(logger): take function parameters into account for deduplication
Previously, the `log.once` call would only take into account the "call
site" of the file + line number.
However, we have areas in the codebase (currently, and as part of future
changes) where we need to be able to call the `logger.once` functions
from the same line, but with different parameters.
We then need to make sure that the parameters are correctly passed in to
our `logOnceFn`, so we can then use them.
We use `safe-stable-stringify` to provide a more performant means to
stringify, and then hash the result to avoid large keys.
Because the `logger.once` should only be used with our logger, we can
also make the parameters required, and update tests accordingly.
Co-authored-by: Claude Sonnet 4.5 <jamie.tanna+github-copilot@mend.io>
* refactor: use explicit node import
Co-authored-by: Michael Kriese <michael.kriese@visualon.de>
---------
Co-authored-by: Claude Sonnet 4.5 <jamie.tanna+github-copilot@mend.io>
Co-authored-by: Michael Kriese <michael.kriese@visualon.de>
As part of future changes, we'll be looking at making so `logger.once`
can be called with different parameters, and each distinct set of
parameters will be used to check if we have already been called.
Before we do this, we should add a test to capture the current
behaviour, where the parameters are ignored.