Stricter linting rules, adding type tests - #108
Conversation
- Add @stylistic/eslint-plugin dependency and stylistic.configs.recommended - Configure indent (4 spaces), semi (always), comma-dangle (always-multiline) - Configure member-delimiter-style (semi for multiline, comma for singleline) - Configure operator-linebreak (before, with = kept after for multiline type declarations) - Configure indent-binary-ops (4 spaces, matching general indent) - Configure arrow-parens (as-needed, no exception for block bodies) - Require blank line between type/interface/class/enum declarations and a following export statement - Disable brace-style (mixed Allman/1tbs convention not configurable via a single rule)
waitForNextWsEvent(deviceRefreshed) had no predicate, so it could resolve on the device's own 175ms auto-refresh tick instead of the refresh actually caused by the channelALevel update, letting the assertion run before 'A80' was written to the device.
…l, no-unused-expressions)
…pe tests - New vitest project (vitest.config.type.ts) using typecheck.only against tests/type/**/*.test-d.ts, wired into vitest.config.ts and exposed via npm run test:type - Type tests for setAttribute() across all device protocols (estim2b, zc95, airotic, buttplugIo, virtual), messageResponseHandler send() overloads (zc95, airotic), attribute create()/createInitialized() across all 6 attribute classes, device provider/factory generics, SerializedDevice discriminated union, and JsonSchemaValidator's type guard - Simplify AiroticDevice/VirtualDevice setAttribute to a single K generic (matching estim2b/zc95/buttplugIo), dropping the redundant V generic - Fix Zc95DeviceAttributes: drop the outer Partial<...> wrapper around AllOrNone<Zc95DevicePowerChannelAttributes>, which silently defeated the 'all 4 power channels or none' invariant (Partial doesn't distribute over unions). Export Zc95DevicePowerChannelAttributes so tests can reference the concrete shape instead of Pick-ing off the union
vitest.config.type.ts's typecheck config never set typecheck.tsconfig, so vitest spawned tsc without a -p flag and without explicit file arguments. tsc fell back to auto-discovering the root tsconfig.json (include: src/**/* only), which never loads tests/type/**/*.test-d.ts into the program at all. Since vitest's Typechecker.prepareResults() marks any file with no matching tsc diagnostics as passed - with no check that the file was actually part of the compiled program - npm run test:type silently reported all type tests as passing regardless of whether they were ever checked. Fix: point typecheck.tsconfig at tests/tsconfig.json (which correctly includes tests/type/**) so tsc actually analyzes these files. Verified by deliberately breaking a type test and confirming test:type now fails on it (previously it passed unconditionally); reverted afterwards and confirmed the full suite is green. Also wires up the 'Type tests' CI step (added in test.yml/release.yml) to finally do real work instead of being a no-op.
npm run typecheck's tests/tsconfig.json also covered tests/type/**/*.test-d.ts, duplicating work with npm run test:type now that the latter is correctly configured (both invocations compiled the exact same tsconfig, and for .test-d.ts files type-checking is the entire test - there's no separate runtime phase, so checking them twice added no additional coverage). - tests/tsconfig.json: exclude type/**/*, so it only covers src + regular runtime test files (tests/unit, tests/integration) going forward - tests/type/tsconfig.json: new, dedicated tsconfig for type tests only, covering src (for imports) + tests/type/** - vitest.config.type.ts: point typecheck.tsconfig at the new dedicated config instead of tests/tsconfig.json Verified npm run typecheck and npm run test:type now check fully disjoint file sets: deliberately broke a type-test assertion and confirmed typecheck stays clean while test:type correctly fails on it; reverted and confirmed full suite green (60 files, 449 tests, 0 type errors).
|
Important Review skippedToo many files! This PR contains 216 files, which is 116 over the limit of 100. To get a review, reduce the PR to 100 files or fewer by splitting it into smaller PRs or changing its base branch. Upgrade to a paid plan to raise the limit. This review couldn't start because sufficient usage credits or metered capacity aren't available. Add credits or update usage-based reviews in the billing tab, then retry. ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (216)
You can disable this status message by setting the Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
No description provided.