Skip to content

Format all files properly - #71

Merged
heavyrubberslave merged 3 commits into
mainfrom
chore/eslint-fixes
Mar 7, 2026
Merged

Format all files properly#71
heavyrubberslave merged 3 commits into
mainfrom
chore/eslint-fixes

Conversation

@heavyrubberslave

@heavyrubberslaveheavyrubberslave commented Mar 7, 2026

Copy link
Copy Markdown
Member

Summary by CodeRabbit

  • Bug Fixes

    • Improved handling and logging when device provider initialization fails.
  • Style

    • Standardized code formatting across the codebase (consistent quote usage and import spacing).
  • Chores

    • Removed some ESLint suppression directives, tightened the quotes lint rule to error, and adjusted TypeScript configuration.

@heavyrubberslaveheavyrubberslave added the patch Creates a new patch/bugfix release if merged label Mar 7, 2026
@coderabbitai

coderabbitaiBot commented Mar 7, 2026

Copy link
Copy Markdown

Warning

Rate limit exceeded

@heavyrubberslave has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 14 minutes and 47 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: a4f66eca-9023-4882-9f6a-fbdc781278bd

📥 Commits

Reviewing files that changed from the base of the PR and between a61e2f0 and b2ac504.

📒 Files selected for processing (78)
  • eslint.config.ts
  • src/automation/automationEventType.ts
  • src/automation/scriptRuntime.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/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/floatDeviceAttribute.ts
  • src/device/attribute/intDeviceAttribute.ts
  • src/device/attribute/intRangeDeviceAttribute.ts
  • src/device/attribute/numberDeviceAttribute.ts
  • src/device/attribute/strDeviceAttribute.ts
  • src/device/deviceManager.ts
  • src/device/deviceManagerEvent.ts
  • src/device/deviceNameGenerator.ts
  • src/device/deviceState.ts
  • src/device/genericDeviceUpdater.ts
  • src/device/protocol/buttplugIo/buttplugIoDevice.ts
  • src/device/protocol/buttplugIo/buttplugIoDeviceFactory.ts
  • src/device/protocol/buttplugIo/buttplugIoWebsocketDeviceProviderFactory.ts
  • src/device/protocol/deviceProtocol.ts
  • src/device/protocol/virtual/audio/piperVirtualDeviceLogic.ts
  • src/device/protocol/zc95/Zc95SerialReader.ts
  • src/device/protocol/zc95/zc95Device.ts
  • src/device/protocol/zc95/zc95MessageFactory.ts
  • src/device/provider/deviceProviderEvent.ts
  • src/device/provider/deviceProviderFactory.ts
  • src/device/provider/deviceProviderLoader.ts
  • src/device/transport/serialPortObserver.ts
  • src/device/updater/abstractDeviceUpdater.ts
  • src/device/updater/bufferedDeviceUpdater.ts
  • src/device/updater/deviceUpdaterInterface.ts
  • src/device/webSocketEvent.ts
  • src/entity/automationScript.ts
  • src/entity/deviceList.ts
  • src/entity/list.ts
  • src/index.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/serialization/classToPlainSerializer.ts
  • src/serialization/discriminator/genericDeviceAttributeDiscriminator.ts
  • src/serialization/discriminator/objectDiscriminator.ts
  • src/serviceMap.ts
  • src/serviceProvider/automationServiceProvider.ts
  • src/serviceProvider/controllerServiceProvider.ts
  • src/serviceProvider/repositoryServiceProvider.ts
  • src/serviceProvider/schemaValidationServiceProvider.ts
  • src/serviceProvider/serializationServiceProvider.ts
  • src/serviceProvider/serverServiceProvider.ts
  • src/serviceProvider/settingsServiceProvider.ts
  • src/serviceProvider/socketServiceProvider.ts
  • src/settings/deviceSource.ts
  • src/settings/knownDevice.ts
  • src/settings/settings.ts
  • src/settings/settingsEventType.ts
  • src/settings/settingsManager.ts
  • src/socket/deviceUpdateHandler.ts
  • src/socket/types.ts
  • src/util/devNullStream.ts
  • src/util/numbers.ts
  • src/util/process.ts
  • tsconfig.json
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch chore/eslint-fixes

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 and usage tips.

@heavyrubberslave

Copy link
Copy Markdown
MemberAuthor

@coderabbitai review

@coderabbitai

Copy link
Copy Markdown
✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@coderabbitaicoderabbitaiBot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
src/controller/patchDeviceController.ts (1)

32-32: ⚠️ Potential issue | 🔴 Critical

Fix incorrect response method chaining in error handler.

Chaining .send() and .sendStatus() is incorrect—both methods send the response, so the second call will fail with "Cannot set headers after they are sent to the client."

🐛 Proposed fix
- res.send((err as Error).message).sendStatus(500);+ res.status(500).send((err as Error).message);
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@src/controller/patchDeviceController.ts` at line 32, The error handler in
patchDeviceController.ts currently chains res.send(...).sendStatus(500), which
sends the response twice and breaks header handling; change it to set the status
first using res.status(500) and then send the error message (or send a JSON
error) in a single response call instead of chaining send and sendStatus on
res.send(...).sendStatus(500).
🧹 Nitpick comments (3)
src/util/devNullStream.ts (1)

2-2: Remove unused EventEmitter import and events property.

The events property on line 7 is instantiated but never used. The class correctly uses this.emit('idle') on line 27, which leverages the inherited emit method from Writable (which extends EventEmitter). The separate events instance is redundant and creates unnecessary memory overhead.

♻️ Proposed fix to remove unused code
-import { Writable } from 'stream';-import EventEmitter from 'events';+import { Writable } from 'stream';
export default class DevNullStream extends Writable {
private readonly timeoutMs: number;
private timer?: NodeJS.Timeout;
- private readonly events = new EventEmitter();

Also applies to: 7-7

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@src/util/devNullStream.ts` at line 2, Remove the redundant EventEmitter
import and the unused events property in the DevNullStream class: delete the
"import EventEmitter" line and remove the class property named "events" (the
instantiated EventEmitter) and any related references, leaving the existing
this.emit('idle') calls intact since Writable already provides emit; ensure no
other code relies on the removed events instance (check for "events" property
usages) and run tests.
src/controller/automation/deleteScriptController.ts (1)

20-21: Using text/plain content-type would prevent reflected input from being interpreted as HTML.

While Express defaults res.send(string) to Content-Type: text/html, the isValidAutomationScriptFileName() whitelist regex only allows [a-z\d._-]+\.js, which excludes all HTML special characters. Reflection is not an XSS risk here. Setting text/plain is still good practice for defense-in-depth clarity, but not critical given the validation.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@src/controller/automation/deleteScriptController.ts` around lines 20 - 21,
Update the error response to explicitly use a text/plain content type for the
invalid filename path: when the filename fails
isValidAutomationScriptFileName(...) in deleteScriptController (the branch that
currently calls res.status(400).send(...)), set the response content type to
text/plain (for example via res.type('text/plain') or
res.set('Content-Type','text/plain')) before sending the message so reflected
input is returned as plain text.
src/device/protocol/buttplugIo/buttplugIoDevice.ts (1)

86-91: Consider removing the extra blank lines.

The blank lines between each property in this small object literal seem excessive and reduce readability. If this wasn't intentional formatting from a linter rule, consider condensing:

♻️ Suggested format
 return await this.buttplugClientDevice.scalar({
-
'ActuatorType': command,
-
'Scalar': value,
-
'Index': index
});
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@src/device/protocol/buttplugIo/buttplugIoDevice.ts` around lines 86 - 91, The
object literal containing 'ActuatorType', 'Scalar', and 'Index' in
buttplugIoDevice.ts has unnecessary blank lines; remove the empty lines so the
properties are placed consecutively (e.g., 'ActuatorType': command, 'Scalar':
value, 'Index': index) to improve readability and match surrounding formatting
for the code that constructs the command payload.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Outside diff comments:
In `@src/controller/patchDeviceController.ts`:
- Line 32: The error handler in patchDeviceController.ts currently chains
res.send(...).sendStatus(500), which sends the response twice and breaks header
handling; change it to set the status first using res.status(500) and then send
the error message (or send a JSON error) in a single response call instead of
chaining send and sendStatus on res.send(...).sendStatus(500).
---
Nitpick comments:
In `@src/controller/automation/deleteScriptController.ts`:
- Around line 20-21: Update the error response to explicitly use a text/plain
content type for the invalid filename path: when the filename fails
isValidAutomationScriptFileName(...) in deleteScriptController (the branch that
currently calls res.status(400).send(...)), set the response content type to
text/plain (for example via res.type('text/plain') or
res.set('Content-Type','text/plain')) before sending the message so reflected
input is returned as plain text.
In `@src/device/protocol/buttplugIo/buttplugIoDevice.ts`:
- Around line 86-91: The object literal containing 'ActuatorType', 'Scalar', and
'Index' in buttplugIoDevice.ts has unnecessary blank lines; remove the empty
lines so the properties are placed consecutively (e.g., 'ActuatorType': command,
'Scalar': value, 'Index': index) to improve readability and match surrounding
formatting for the code that constructs the command payload.
In `@src/util/devNullStream.ts`:
- Line 2: Remove the redundant EventEmitter import and the unused events
property in the DevNullStream class: delete the "import EventEmitter" line and
remove the class property named "events" (the instantiated EventEmitter) and any
related references, leaving the existing this.emit('idle') calls intact since
Writable already provides emit; ensure no other code relies on the removed
events instance (check for "events" property usages) and run tests.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: efddc9af-cb48-41d7-b16e-fbae8fcc1aa0

📥 Commits

Reviewing files that changed from the base of the PR and between a61e2f0 and 2f1bb38.

📒 Files selected for processing (77)
  • src/automation/automationEventType.ts
  • src/automation/scriptRuntime.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/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/floatDeviceAttribute.ts
  • src/device/attribute/intDeviceAttribute.ts
  • src/device/attribute/intRangeDeviceAttribute.ts
  • src/device/attribute/numberDeviceAttribute.ts
  • src/device/attribute/strDeviceAttribute.ts
  • src/device/deviceManager.ts
  • src/device/deviceManagerEvent.ts
  • src/device/deviceNameGenerator.ts
  • src/device/deviceState.ts
  • src/device/genericDeviceUpdater.ts
  • src/device/protocol/buttplugIo/buttplugIoDevice.ts
  • src/device/protocol/buttplugIo/buttplugIoDeviceFactory.ts
  • src/device/protocol/buttplugIo/buttplugIoWebsocketDeviceProviderFactory.ts
  • src/device/protocol/deviceProtocol.ts
  • src/device/protocol/virtual/audio/piperVirtualDeviceLogic.ts
  • src/device/protocol/zc95/Zc95SerialReader.ts
  • src/device/protocol/zc95/zc95Device.ts
  • src/device/protocol/zc95/zc95MessageFactory.ts
  • src/device/provider/deviceProviderEvent.ts
  • src/device/provider/deviceProviderFactory.ts
  • src/device/provider/deviceProviderLoader.ts
  • src/device/transport/serialPortObserver.ts
  • src/device/updater/abstractDeviceUpdater.ts
  • src/device/updater/bufferedDeviceUpdater.ts
  • src/device/updater/deviceUpdaterInterface.ts
  • src/device/webSocketEvent.ts
  • src/entity/automationScript.ts
  • src/entity/deviceList.ts
  • src/entity/list.ts
  • src/index.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/serialization/classToPlainSerializer.ts
  • src/serialization/discriminator/genericDeviceAttributeDiscriminator.ts
  • src/serialization/discriminator/objectDiscriminator.ts
  • src/serviceMap.ts
  • src/serviceProvider/automationServiceProvider.ts
  • src/serviceProvider/controllerServiceProvider.ts
  • src/serviceProvider/repositoryServiceProvider.ts
  • src/serviceProvider/schemaValidationServiceProvider.ts
  • src/serviceProvider/serializationServiceProvider.ts
  • src/serviceProvider/serverServiceProvider.ts
  • src/serviceProvider/settingsServiceProvider.ts
  • src/serviceProvider/socketServiceProvider.ts
  • src/settings/deviceSource.ts
  • src/settings/knownDevice.ts
  • src/settings/settings.ts
  • src/settings/settingsEventType.ts
  • src/settings/settingsManager.ts
  • src/socket/deviceUpdateHandler.ts
  • src/socket/types.ts
  • src/util/devNullStream.ts
  • src/util/numbers.ts
  • src/util/process.ts
  • tsconfig.json
💤 Files with no reviewable changes (3)
  • tsconfig.json
  • src/util/numbers.ts
  • src/device/protocol/zc95/zc95MessageFactory.ts

@heavyrubberslave
heavyrubberslave merged commit 708c0b8 into mainMar 7, 2026
16 checks passed
@heavyrubberslave
heavyrubberslave deleted the chore/eslint-fixes branch March 7, 2026 11:36
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

patchCreates a new patch/bugfix release if merged

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

@heavyrubberslave