Repository navigation
chore: Add Prettier and reformat - #245
Merged
Merged
Conversation
RobinBol
force-pushed
the
chore/prettier
branch
from
October 22, 2026 15:05
c7fe6a2 to
01a7814
Compare
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
The supplied changes are limited to formatter tooling, behavior-preserving formatting, and annotation guidance, with no unresolved blocking issues.
No open issues 🎉
What changed in this PR
Adds Prettier to standardize formatting across the Zigbee Cluster Library while preserving runtime behavior and documentation-generation compatibility.
Changes:
- Adds formatting scripts, a locked Prettier dependency, and exclusions for generated or formatting-sensitive files.
- Applies consistent formatting across source, tests, documentation examples, and workflows.
- Moves mandatory/optional annotations above multiline definition keys and documents the placement and lowercase hexadecimal conventions.
| File | Description |
|---|---|
| tsconfig.json | Removes a trailing comma. |
| test/util/mockNode.js | Formats mock factories and hexadecimal literals. |
| test/testZCLError.js | Formats error-response tests. |
| test/testTrxSequenceNumber.js | Formats sequence-number tests. |
| test/testNode.js | Formats node tests and bindings. |
| test/testMfgSpecificCommands.js | Formats manufacturer-specific command tests. |
| test/testConfigureReportingRecordsStruct.js | Formats reporting-record tests. |
| test/testClusterResponseTimeout.js | Formats response-timeout tests. |
| test/ota.js | Formats OTA request and response tests. |
| test/onOff.js | Formats on/off command tests. |
| test/manual/xiaomiHacks.js | Formats custom Xiaomi data parsers. |
| test/levelControl.js | Formats level-control tests. |
| test/iasZone.js | Formats IAS Zone tests. |
| test/endpointStandalone.js | Formats standalone endpoint tests. |
| test/doorLock.js | Formats door-lock tests and frame literals. |
| test/defaultResponse.js | Formats default-response tests. |
| test/colorControl.js | Formats color-control tests. |
| test/boundClusterAttributeStatus.js | Formats attribute-status tests. |
| test/attributeReport.js | Formats attribute-report tests. |
| README.md | Formats code examples and list spacing. |
| package.json | Adds Prettier and formatting scripts. |
| package-lock.json | Locks the Prettier dependency. |
| lib/zclTypes.js | Preserves status-table alignment with a formatter exclusion. |
| lib/zclFrames.js | Formats frame serialization and parsing code. |
| lib/util/index.js | Formats utility expressions and class spacing. |
| lib/Node.js | Formats endpoint iteration and logging. |
| lib/Endpoint.js | Formats frame handling and hexadecimal literals. |
| lib/clusters/windowCovering.js | Moves annotations above keys and formats spacing. |
| lib/clusters/touchlink.js | Formats nested response definitions. |
| lib/clusters/time.js | Formats the status attribute and class spacing. |
| lib/clusters/thermostatUserInterfaceConfiguration.js | Normalizes class spacing. |
| lib/clusters/thermostat.js | Formats bitmap attributes and class spacing. |
| lib/clusters/temperatureMeasurement.js | Normalizes class spacing. |
| lib/clusters/shadeConfiguration.js | Formats empty definitions and class spacing. |
| lib/clusters/scenes.js | Normalizes class spacing. |
| lib/clusters/relativeHumidity.js | Normalizes class spacing. |
| lib/clusters/pumpConfigurationAndControl.js | Formats empty definitions and class spacing. |
| lib/clusters/pressureMeasurement.js | Normalizes class spacing. |
| lib/clusters/powerProfile.js | Formats empty definitions and class spacing. |
| lib/clusters/powerConfiguration.js | Normalizes class spacing. |
| lib/clusters/pollControl.js | Normalizes class spacing. |
| lib/clusters/ota.js | Moves annotations above keys and formats definitions. |
| lib/clusters/onOffSwitch.js | Normalizes class spacing. |
| lib/clusters/onOff.js | Normalizes class spacing. |
| lib/clusters/occupancySensing.js | Moves mandatory and conditional annotations above keys. |
| lib/clusters/multistateValue.js | Formats status flags and class spacing. |
| lib/clusters/multistateOutput.js | Formats status flags and class spacing. |
| lib/clusters/multistateInput.js | Formats status flags and class spacing. |
| lib/clusters/metering.js | Moves annotations and lowercases hexadecimal literals. |
| lib/clusters/levelControl.js | Normalizes class spacing. |
| lib/clusters/index.js | Formats constant-property extraction. |
| lib/clusters/illuminanceMeasurement.js | Normalizes class spacing. |
| lib/clusters/illuminanceLevelSensing.js | Normalizes class spacing. |
| lib/clusters/identify.js | Normalizes class spacing. |
| lib/clusters/iasZone.js | Formats zone-status bitmap arguments. |
| lib/clusters/iasWD.js | Formats empty definitions and class spacing. |
| lib/clusters/iasACE.js | Formats empty definitions and class spacing. |
| lib/clusters/groups.js | Formats the name-support bitmap attribute. |
| lib/clusters/flowMeasurement.js | Normalizes class spacing. |
| lib/clusters/fanControl.js | Formats empty definitions and class spacing. |
| lib/clusters/electricalMeasurement.js | Formats measurement and alarm bitmaps. |
| lib/clusters/diagnostics.js | Normalizes class spacing. |
| lib/clusters/deviceTemperature.js | Formats the temperature-alarm bitmap attribute. |
| lib/clusters/dehumidificationControl.js | Formats empty definitions and class spacing. |
| lib/clusters/colorControl.js | Formats capability and command bitmaps. |
| lib/clusters/binaryValue.js | Formats status flags and class spacing. |
| lib/clusters/binaryOutput.js | Formats status flags and class spacing. |
| lib/clusters/binaryInput.js | Formats status flags and class spacing. |
| lib/clusters/basic.js | Normalizes class spacing. |
| lib/clusters/ballastConfiguration.js | Removes extra blank lines. |
| lib/clusters/analogValue.js | Formats status flags and class spacing. |
| lib/clusters/analogOutput.js | Formats status flags and class spacing. |
| lib/clusters/analogInput.js | Formats status flags and class spacing. |
| lib/clusters/alarms.js | Normalizes class spacing. |
| lib/BoundCluster.js | Formats attribute operations and command handling. |
| index.js | Compacts data-type destructuring. |
| docs/jsdoc.json | Compacts the plugin array without changing plugins. |
| AGENTS.md | Updates annotation placement and hexadecimal style guidance. |
| .prettierrc | Removes the JSDoc-rewriting plugin configuration. |
| .prettierignore | Excludes generated and formatting-sensitive content. |
| .github/workflows/lint.yml | Removes an extra blank line. |
| .github/workflows/generate-types.yml | Normalizes YAML quoting. |
| .github/workflows/docs.yml | Normalizes YAML indentation and spacing. |
| .github/workflows/deploy.yml | Normalizes condition indentation and spacing. |
Review effort: Balanced
This was referenced Oct 23, 2026
Picks up the style enforcement that went away with eslint-config-athom.
.prettierrc was already in the repo, unused, with no dependency and no
script to run it.
prettier-plugin-jsdoc is deliberately left out: it rewrites JSDoc type
expressions into TypeScript syntax (Promise<{ a: number[]; b: boolean }>)
that jsdoc 4 cannot parse, which breaks npm run build and with it the
docs and deploy workflows.
index.d.ts is ignored because it is generated, and AGENTS.md because
Prettier mangles its M* emphasis markers.
// Mandatory, // Optional and // Conditional describe the attribute or command as a whole. On the opening brace Prettier pulls them inside it, where they read as if they belong to the id field. Above the key they survive the formatter and say what they mean. 77 annotations across five cluster files, no other change.
Pure npm run format:write output, except for the prettier-ignore guard on the enum8Status table in lib/zclTypes.js, which keeps its column alignment.
The annotation moves above the key, which is both what it means and what survives Prettier. Prettier also lowercases hex digits, so the id examples follow.
The format:check script was added alongside Prettier but nothing ran it, so the formatting was advisory: one commit formatted by hand and the next npm run format:write is a hundred-file diff again, which undoes the point of the reformat.
The three EventEmitter imports now read node:events. The prefix cannot be shadowed by a local events.js and says outright that the module is built in. Only lib/ here; the test files are converted alongside the node:test migration they belong to.
RobinBol
force-pushed
the
chore/prettier
branch
from
October 23, 2026 07:31
670c7ca to
5b26951
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Wires up prettier and reformats the repo. Six commits:
chore: add prettier- dependency, scripts,.prettierignorerefactor: move the M/O annotations above the attribute key- 77 annotations, no formattingchore: apply prettier- pureformat:writeoutput, 82 filesdocs: record where the M/O annotation goes, and lowercase hex- AGENTS.mdci: enforce the Prettier formatting in CI-format:checkinlint.ymlrefactor: use the node: prefix for core imports in libSkip commit 3 while reviewing. The others are real.
Why
#244 drops
eslint-config-athomand every airbnb style rule with it..prettierrcwas already in the repo, unused, with no dependency and no script. It is the same config our other Node projects run.Commit 5 matters as much as the reformat: nothing ran
format:check, so prettier was advisory and the nextformat:writewould be another hundred-file diff.How
The M/O annotations move above the key.
// Mandatorydescribes the attribute, not its first line, but prettier pulls a trailing comment inside the braces where it reads as if it belongs toid. Above the key it says what it means and prettier leaves it alone: the reformat touches none of the 77 moved lines.Two forced deviations from that shared setup.
prettier-plugin-jsdocis out: it rewrites JSDoc types into TypeScript syntax that jsdoc 4 cannot parse, which breaksnpm run buildwith 10 errors. Without it no JSDoc comment inlib/changes at all. AndAGENTS.mdis in.prettierignore, because prettier mangles itsM*emphasis markers until the file documents the opposite of what it says.Prettier also lowercases hex,
0x001A->0x001a, 87 times. No option for it, so AGENTS.md follows.Testing
format:checkclean,npm test114 passing,lintexit 0,buildok,generate-typesleavesindex.d.tsunchanged,tsc --noEmitexit 0.