Skip to content

Stricter linting rules, adding type tests - #108

Merged
heavyrubberslave merged 19 commits into
mainfrom
chore/simplify-set-attribute-generics
Aug 9, 2026
Merged

Stricter linting rules, adding type tests#108
heavyrubberslave merged 19 commits into
mainfrom
chore/simplify-set-attribute-generics

Conversation

@heavyrubberslave

Copy link
Copy Markdown
Member

No description provided.

- 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.
…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).
@coderabbitai

coderabbitai Bot commented Aug 9, 2026

Copy link
Copy Markdown

Important

Review skipped

Too 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 configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 0f09df1e-b733-47ab-9b2b-fe4ecb8f1581

📥 Commits

Reviewing files that changed from the base of the PR and between 907c6ca and 2a0802c.

⛔ Files ignored due to path filters (1)
  • package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (216)
  • .babelrc
  • .github/workflows/release.yml
  • .github/workflows/test.yml
  • eslint.config.ts
  • knip.json
  • package.json
  • resources/schemas/settings.schema.json
  • src/app.ts
  • src/automation/scriptRuntime.ts
  • src/automation/scriptVm.ts
  • src/automation/scriptVmFactory.ts
  • src/controller/automation/createScriptController.ts
  • src/controller/automation/deleteScriptController.ts
  • src/controller/automation/getLogController.ts
  • src/controller/automation/getScriptController.ts
  • src/controller/automation/getScriptsController.ts
  • src/controller/automation/runScriptController.ts
  • src/controller/automation/statusScriptController.ts
  • src/controller/automation/stopScriptController.ts
  • src/controller/controllerInterface.ts
  • src/controller/getDeviceController.ts
  • src/controller/getDevicesController.ts
  • src/controller/healthController.ts
  • src/controller/patchDeviceController.ts
  • src/controller/settings/getSettingsController.ts
  • src/controller/settings/putSettingsController.ts
  • src/controller/versionController.ts
  • src/device/attribute/boolDeviceAttribute.ts
  • src/device/attribute/deviceAttribute.ts
  • src/device/attribute/floatDeviceAttribute.ts
  • src/device/attribute/intDeviceAttribute.ts
  • src/device/attribute/intRangeDeviceAttribute.ts
  • src/device/attribute/listDeviceAttribute.ts
  • src/device/attribute/numberDeviceAttribute.ts
  • src/device/attribute/strDeviceAttribute.ts
  • src/device/bleDevice.ts
  • src/device/detectedDeviceOfferQueue.ts
  • src/device/device.ts
  • src/device/deviceConfig.ts
  • src/device/deviceId.ts
  • src/device/deviceManager.ts
  • src/device/deviceNameGenerator.ts
  • src/device/genericDeviceUpdater.ts
  • src/device/knownDeviceRegistry.ts
  • src/device/peripheralDevice.ts
  • src/device/protocol/airotic/airoticDevice.ts
  • src/device/protocol/airotic/airoticDeviceFactory.ts
  • src/device/protocol/airotic/airoticDeviceProvider.ts
  • src/device/protocol/airotic/airoticProtocol.ts
  • src/device/protocol/buttplugIo/buttplugIoDevice.ts
  • src/device/protocol/buttplugIo/buttplugIoDeviceFactory.ts
  • src/device/protocol/buttplugIo/buttplugIoWebsocketDeviceProvider.ts
  • src/device/protocol/buttplugIo/buttplugIoWebsocketDeviceProviderFactory.ts
  • src/device/protocol/buttplugIo/slvCtrlPlusButtplugWebsocketClientConnector.ts
  • src/device/protocol/deviceProtocol.ts
  • src/device/protocol/estim2b/estim2bDevice.ts
  • src/device/protocol/estim2b/estim2bDeviceFactory.ts
  • src/device/protocol/estim2b/estim2bProtocol.ts
  • src/device/protocol/estim2b/estim2bSerialDeviceProvider.ts
  • src/device/protocol/messageResponseHandler.ts
  • src/device/protocol/slvCtrlPlus/genericSlvCtrlPlusDevice.ts
  • src/device/protocol/slvCtrlPlus/slvCtrlPlusDevice.ts
  • src/device/protocol/slvCtrlPlus/slvCtrlPlusDeviceFactory.ts
  • src/device/protocol/slvCtrlPlus/slvCtrlPlusSerialDeviceProvider.ts
  • src/device/protocol/slvCtrlPlus/slvCtrlProtocol.ts
  • src/device/protocol/slvCtrlPlus/slvCtrlProtocolLegacy.ts
  • src/device/protocol/slvCtrlPlus/slvCtrlProtocolV1.ts
  • src/device/protocol/virtual/audio/piperVirtualDeviceConfig.ts
  • src/device/protocol/virtual/audio/piperVirtualDeviceLogic.ts
  • src/device/protocol/virtual/audio/ttsVirtualDeviceConfig.ts
  • src/device/protocol/virtual/audio/ttsVirtualDeviceLogic.ts
  • src/device/protocol/virtual/display/displayVirtualDeviceLogic.ts
  • src/device/protocol/virtual/genericVirtualDeviceFactory.ts
  • src/device/protocol/virtual/genericVirtualDeviceLogicFactory.ts
  • src/device/protocol/virtual/randomGenerator/randomGeneratorVirtualDeviceConfig.ts
  • src/device/protocol/virtual/randomGenerator/randomGeneratorVirtualDeviceLogic.ts
  • src/device/protocol/virtual/virtualDevice.ts
  • src/device/protocol/virtual/virtualDeviceFactory.ts
  • src/device/protocol/virtual/virtualDeviceLogic.ts
  • src/device/protocol/virtual/virtualDeviceLogicFactory.ts
  • src/device/protocol/virtual/virtualDeviceProvider.ts
  • src/device/protocol/virtual/virtualDeviceProviderFactory.ts
  • src/device/protocol/zc95/zc95Device.ts
  • src/device/protocol/zc95/zc95DeviceFactory.ts
  • src/device/protocol/zc95/zc95MessageFactory.ts
  • src/device/protocol/zc95/zc95Protocol.ts
  • src/device/protocol/zc95/zc95SerialDeviceProvider.ts
  • src/device/provider/bleDeviceProvider.ts
  • src/device/provider/deviceProvider.ts
  • src/device/provider/deviceProviderEvent.ts
  • src/device/provider/deviceProviderFactory.ts
  • src/device/provider/deviceProviderManager.ts
  • src/device/provider/genericDeviceProviderFactory.ts
  • src/device/provider/serialDeviceProvider.ts
  • src/device/serializedTypes.ts
  • src/device/transport/bleDeviceTransport.ts
  • src/device/transport/bleObserver.ts
  • src/device/transport/deviceBidirectionalTransport.ts
  • src/device/transport/deviceReadableTransport.ts
  • src/device/transport/deviceWritableTransport.ts
  • src/device/transport/serialDeviceTransport.ts
  • src/device/transport/serialDeviceTransportFactory.ts
  • src/device/transport/serialPortObserver.ts
  • src/device/transport/sharedObserver.ts
  • src/device/updater/abstractDeviceUpdater.ts
  • src/device/updater/bufferedDeviceUpdater.ts
  • src/device/updater/deviceUpdaterInterface.ts
  • src/entity/deviceList.ts
  • src/entity/list.ts
  • src/env.ts
  • src/factory/dateFactory.ts
  • src/factory/eventEmitterFactory.ts
  • src/factory/serialPortFactory.ts
  • src/factory/uuidFactory.ts
  • src/health/healthMetricsCollector.ts
  • src/health/serializedTypes.ts
  • src/index.ts
  • src/logging/Logger.ts
  • src/logging/PinoLogger.ts
  • src/middleware/contentTypeMiddleware.ts
  • src/repository/automationScriptRepository.ts
  • src/repository/automationScriptRepositoryInterface.ts
  • src/repository/connectedDeviceRepository.ts
  • src/repository/deviceRepositoryInterface.ts
  • src/schemaValidation/JsonSchemaValidator.ts
  • src/schemaValidation/JsonSchemaValidatorFactory.ts
  • src/schemaValidation/schemaValidationError.ts
  • src/serial/frameParser.ts
  • src/serial/synchronousSerialPort.ts
  • src/serialization/classToPlainSerializer.ts
  • src/serialization/discriminator/genericDeviceAttributeDiscriminator.ts
  • src/serialization/discriminator/objectDiscriminator.ts
  • src/serialization/plainToClassSerializer.ts
  • src/serviceMap.ts
  • src/serviceProvider/automationServiceProvider.ts
  • src/serviceProvider/controllerServiceProvider.ts
  • src/serviceProvider/deviceServiceProvider.ts
  • src/serviceProvider/factoryServiceProvider.ts
  • src/serviceProvider/healthServiceProvider.ts
  • src/serviceProvider/loggerServiceProvider.ts
  • src/serviceProvider/repositoryServiceProvider.ts
  • src/serviceProvider/schemaValidationServiceProvider.ts
  • src/serviceProvider/serializationServiceProvider.ts
  • src/serviceProvider/settingsServiceProvider.ts
  • src/serviceProvider/socketServiceProvider.ts
  • src/settings/deviceSource.ts
  • src/settings/knownDevice.ts
  • src/settings/serializedTypes.ts
  • src/settings/settings.ts
  • src/settings/settingsManager.ts
  • src/socket/deviceUpdateHandler.ts
  • src/socket/types.ts
  • src/types.d.ts
  • src/util/async.ts
  • src/util/color.ts
  • src/util/devNullStream.ts
  • src/util/dictionary.ts
  • src/util/error.ts
  • src/util/expressUtils.ts
  • src/util/json.ts
  • src/util/latestOnlyTaskQueue.ts
  • src/util/numbers.ts
  • src/util/objects.ts
  • src/util/process.ts
  • src/util/typeUtils.ts
  • tests/integration/automationScripts.spec.ts
  • tests/integration/deviceEvents.spec.ts
  • tests/integration/devices/estim2bDevice.spec.ts
  • tests/integration/helpers/airoticDeviceSimulator.ts
  • tests/integration/helpers/appHelper.ts
  • tests/integration/helpers/buttplugIoServerSimulator.ts
  • tests/integration/helpers/estim2bDeviceSimulator.ts
  • tests/integration/helpers/mockSerialPortFactory.ts
  • tests/integration/helpers/zc95DeviceSimulator.ts
  • tests/tsconfig.json
  • tests/type/attribute/boolDeviceAttribute.test-d.ts
  • tests/type/attribute/floatDeviceAttribute.test-d.ts
  • tests/type/attribute/intDeviceAttribute.test-d.ts
  • tests/type/attribute/intRangeDeviceAttribute.test-d.ts
  • tests/type/attribute/listDeviceAttribute.test-d.ts
  • tests/type/attribute/strDeviceAttribute.test-d.ts
  • tests/type/device/airotic.test-d.ts
  • tests/type/device/buttplugIo.test-d.ts
  • tests/type/device/estim2b.test-d.ts
  • tests/type/device/serializedDevice.test-d.ts
  • tests/type/device/virtual/genericVirtualDeviceFactory.test-d.ts
  • tests/type/device/virtual/virtual.test-d.ts
  • tests/type/device/virtual/virtualDeviceLogic.test-d.ts
  • tests/type/device/zc95/zc95.test-d.ts
  • tests/type/device/zc95/zc95Attributes.test-d.ts
  • tests/type/messageResponseHandler/airotic.test-d.ts
  • tests/type/messageResponseHandler/zc95.test-d.ts
  • tests/type/provider/deviceProviderFactory.test-d.ts
  • tests/type/provider/genericDeviceProviderFactory.test-d.ts
  • tests/type/schemaValidation/jsonSchemaValidator.test-d.ts
  • tests/type/tsconfig.json
  • tests/unit/automation/scriptRuntime.spec.ts
  • tests/unit/device/bleDevice.spec.ts
  • tests/unit/device/protocol/airotic/airoticDevice.spec.ts
  • tests/unit/device/protocol/buttplugIo/buttplugIoDevice.spec.ts
  • tests/unit/device/protocol/estim2b/estim2bDevice.spec.ts
  • tests/unit/device/protocol/slvCtrlPlus/genericSlvCtrlPlusDevice.spec.ts
  • tests/unit/device/protocol/slvCtrlPlus/slvCtrlProtocolLegacy.spec.ts
  • tests/unit/device/protocol/slvCtrlPlus/slvCtrlProtocolV1.spec.ts
  • tests/unit/device/protocol/virtual/display/displayVirtualDevice.spec.ts
  • tests/unit/device/protocol/zc95/zc95Device.spec.ts
  • tests/unit/device/protocol/zc95/zc95DeviceFactory.spec.ts
  • tests/unit/device/protocol/zc95/zc95Protocol.spec.ts
  • tests/unit/device/provider/deviceProvider.spec.ts
  • tests/unit/device/testDevice.ts
  • tests/unit/serial/frameParser.spec.ts
  • tsconfig.json
  • tsconfig.tooling.json
  • types/eslint-plugin-sort-class-members.d.ts
  • vitest.config.ts
  • vitest.config.type.ts

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.


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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@heavyrubberslave heavyrubberslave added the patch Creates a new patch/bugfix release if merged label Aug 9, 2026
@heavyrubberslave
heavyrubberslave merged commit dc45da5 into main Aug 9, 2026
7 checks passed
@heavyrubberslave
heavyrubberslave deleted the chore/simplify-set-attribute-generics branch August 9, 2026 10:01
@heavyrubberslave heavyrubberslave mentioned this pull request Aug 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

patch Creates a new patch/bugfix release if merged

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant