Skip to content

refactor: colocate tests and group rules into prefix folders - #134

Merged
howmanysmall merged 27 commits into
mainfrom
refactor/repo-colocate-tests-group-rules
Nov 29, 2026
Merged

howmanysmall merged 27 commits into
mainfrom
refactor/repo-colocate-tests-group-rules

Conversation

@howmanysmall

Copy link
Copy Markdown
Owner

Summary

tests/                        → test/            (renamed, suites colocated)
  ├── fuzz/                   → test/fuzz/
  ├── fixtures/               → test/fixtures/
  └── workflows/              → test/workflows/
documentation/tests/unit/     → colocated next to components and src/data/rule/
src/properties/               ← tests/properties/support (moved under src)
src/rules/{general,react,roblox}/
  ├── directive-*.ts          → directive/
  ├── prefer-*.ts             → prefer/
  └── require-*.ts            → require/
  • Renames the top-level tests/ directory to test/ and colocates each suite beside the code it covers (documentation suites move next to their components and into src/data/rule/; fixtures, fuzz, and workflow tests regroup under test/).
  • Groups rule files into prefix folders (directive/, prefer/, require/) so src/rules/ no longer mixes prefixes at one level.
  • Updates every path consumer: vitest.config.ts test roots, turbo.json inputs, tsconfig/project references, mise.toml coverage sources, CI path filters, and the rule-newness fix for prefix-folder grouping.
  • Enables the new landmines lint rules (warn, with a couple of targeted disables) and adds the @interfere/landmines catalog entry.

Evidence

  • Before: suites lived in mirrored tests/ trees (tests/properties, documentation/tests/unit, tests/workflows), so rule changes and their tests were in disjoint directories and imports used alias paths.
  • After: every suite sits next to its subject (src/rules/general/directive/directive-no-use.test.ts, documentation/src/components/rule-index.test.tsx), imports are relative, and all path references across vitest, turbo, tsconfig, mise, and CI point at test/. documentation/test/browser/rule-counts.fixture.ts added to keep the browser suite deterministic after the move.

CI has not reported on this branch yet — gh run list for it is empty.

Merge Danger

Door: two-way

Every move is a git mv plus path updates; reverting restores the old layout. The only mildly sticky part is pnpm-lock.yaml/skills-lock.json churn, which re-resolves cleanly.

Blast Radius: repo-wide

Touches every package's test paths and CI workflow triggers (ci.yaml push paths, deep-tests.yaml), so a missed path reference would silently skip tests rather than fail loudly — worth a close look at the workflow diffs.

Broaden the CI push path filters to cover all workflows, actions,
vale rules, fallow config, packages, and tools so edits to those
files trigger CI. Simplify the workflow-security change detection
by moving the base and head SHAs into environment variables.

Update the workflow tests to assert that every workspace package
running a CI task has a source file selected by the CI paths, and
trim assertions that no longer match the release workflow.
Add the `@interfere/landmines` oxlint plugin and enable its rules as
errors for non-benchmark test files, covering flaky patterns such as
fixed sleeps, conditional expects, and shared signals. Extract the
repeated non-benchmark test glob filter into a shared `NON_BENCHMARKS`
constant.
Explanatory comments are removed across the test suite, with the intent they
carried moved into descriptive test names, documentation titles, and clearer
variable and helper names. Test cases are also grouped into named case arrays
where that makes the coverage easier to scan.
Remove explanatory comments from workflow and tool tests, fold their
rationale into longer test names where it aids clarity, and rename
helpers and variables to clearer names such as `sourceFile` and
`sharedInstanceTester`.
Apply formatter changes across test files, including Array type syntax,
property ordering, comment wrapping, and import cleanup.
Shorten repeated `@ts-expect-error` explanations in test files to single
lines, inline the casts in `isEffectCall` with a SAFETY note, and collect
changed files at module scope instead of in a `beforeAll` hook.
Apply the formatter across the test suite, adding blank lines between
statements for readability. No test logic or assertions change.
Rename the root `tests/` directory to `test/` and update every
reference to it across configs, workflows, docs, and tooling. Move
the property tests from `tests/properties/` into `src/properties/`
beside the source they exercise, and colocate the documentation unit
tests under `documentation/src/` with browser tests under
`documentation/test/`.
Replace generic `fail` and `pass` documentation ids with descriptive
unique ids across the affected rule tests, so each documented case can
be identified individually. Also move the documented cases in
`prefer-singular-enums` inline ahead of the shared case arrays.
Rule modules moved into prefix directories are now recognised when
parsing git history, so their first commit is used for newness
detection. Paths in a grouping folder that do not start with the
folder name are still ignored.

- update imports in `src/index.ts`, rule tests, and fuzz tests for
  the moved rule files
Signed-off-by: howmanysmall <26746527+howmanysmall@users.noreply.github.com>
Signed-off-by: howmanysmall <26746527+howmanysmall@users.noreply.github.com>
Move `@interfere/landmines` from the root package to
`lint-configurations` and resolve its specifier with
`import.meta.resolve`, matching the other oxlint plugins, so the
plugin is loaded from the package that declares it.
@github-actions

Copy link
Copy Markdown
Contributor

React Doctor found no new issues. 🎉

Reviewed by React Doctor for commit 2a13c4b.

@pkg-pr-new

pkg-pr-new Bot commented Nov 29, 2026

Copy link
Copy Markdown
pnpm add https://pkg.pr.new/@pobammer-ts/small-rules@134
npm i https://pkg.pr.new/@pobammer-ts/small-rules@134

commit: 2a13c4b

@github-actions

Copy link
Copy Markdown
Contributor

Bundle size

Artifact Base Pull request Change
dist/index.js 530.04 kB 530.04 kB 0 B (+0.00%)

Raw, uncompressed bytes from the minified prepublishOnly build. Measured for commit 2a13c4b against base dd43cf9.

@howmanysmall
howmanysmall merged commit 0504644 into main Nov 29, 2026
15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant