Skip to content

chore: migrate to eslint 10 flat config - #244

Merged
RobinBol merged 2 commits into
masterfrom
chore/eslint-flat-config
Oct 23, 2026
Merged

RobinBol merged 2 commits into
masterfrom
chore/eslint-flat-config

Conversation

@RobinBol

@RobinBol RobinBol commented Oct 22, 2026 •

Copy link
Copy Markdown
Collaborator

What

eslint 6 -> 10 with a flat config. .eslintrc.json and .eslintignore become eslint.config.js, and eslint-config-athom is dropped. Supersedes #222.

Why

eslint-config-athom@4.0.2 is still a legacy eslintrc config with a peer of eslint >=8.57.1 <9.0.0, so it cannot be installed next to eslint 10. FlatCompat does not rescue it either: it pulls eslint-plugin-node@11, unmaintained since 2021, which calls context.getFilename, removed in eslint 9.

both failures
npm error peer eslint@">=8.57.1 <9.0.0" from eslint-config-athom@4.0.2

TypeError: Error while loading rule 'node/no-deprecated-api':
  context.getFilename is not a function

So the config has to go. This follows the setup our other Node projects already run: @eslint/js recommended, globals, curly: ['error', 'multi-line'], and no-unused-vars with an ^_ prefix for intentionally unused bindings. No typescript-eslint, this repo is plain JavaScript.

How

Also in the diff: 35 eslint-disable directives for rules that no longer exist, and 19 bindings the stricter no-unused-vars flags, prefixed with _ or changed to an optional catch binding.

A last commit adds a TODO on discoverAttributes and discoverAttributesExtended. The _ prefixes say those parameters are unused but not that the behavior is wrong: both ignore startValue and maxResults and always answer with every attribute and lastResponse: true. Recorded, not fixed, since that is a behavior change on a ZCL command.

Trade-off: every airbnb-base style rule goes with it (indent, quotes, semi, max-len). Only correctness rules remain. #245 wires up prettier to put style enforcement back, so merge the two close together.

Testing

npm test 114 passing, npm run lint exit 0, npm run build ok, generate-types leaves index.d.ts unchanged, tsc --noEmit exit 0. npm audit 19 -> 9, lockfile 584 -> 390 entries.

eslint-config-athom@4 peer-requires eslint >=8.57.1 <9, and its
eslint-plugin-node@11 dependency crashes on eslint 9+ even through
FlatCompat, so the config cannot come along. Replace it with the setup
node-zigbee uses: @eslint/js recommended, globals, curly and an
underscore prefix for intentionally unused bindings. typescript-eslint
is left out, this repo is plain JavaScript.

Drops the eslint-disable directives for rules that no longer apply, and
prefixes the bindings the stricter no-unused-vars now flags.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟢 Approval recommended

The configuration fits the CommonJS/Mocha setup and Node 24 CI environment, and the remaining edits preserve runtime behavior with no blocking issues identified.

No open issues 🎉

What changed in this PR

Migrates the Zigbee Cluster Library from ESLint 6 to ESLint 10 using a CommonJS flat configuration, replacing the incompatible Athom preset and superseding #222.

Changes:

  • Adds recommended ESLint rules, Node/Mocha globals, and underscore-prefixed unused-binding exemptions.
  • Removes obsolete lint directives and updates unused bindings without changing runtime behavior.
  • Drops legacy style enforcement, with formatting checks deferred to the planned Prettier follow-up.
File Description
test/​testZCLError.js Removes obsolete lint directives.
test/​testTrxSequenceNumber.js Removes obsolete lint directive.
test/​testNode.js Removes lint directive and unused catch bindings.
test/​testMfgSpecificCommands.js Removes obsolete lint directive.
test/​testClusterResponseTimeout.js Removes obsolete lint directives.
test/​ota.js Removes obsolete lint directive.
test/​onOff.js Removes obsolete lint directive.
test/​manual/​xiaomiHacks.js Prefixes unused parameters and removes lint directives.
test/​levelControl.js Removes obsolete lint directive.
test/​iasZone.js Removes obsolete lint directive.
test/​doorLock.js Removes obsolete lint directive.
test/​colorControl.js Removes obsolete lint directives.
test/​boundClusterAttributeStatus.js Removes obsolete lint directive.
package.json Updates ESLint dependencies and removes Athom preset.
lib/​zclTypes.js Removes blanket lint suppression.
lib/​zclFrames.js Removes obsolete lint directive.
lib/​util/​index.js Removes obsolete lint directive.
lib/​Node.js Removes obsolete lint directive.
lib/​Endpoint.js Removes unused catch binding.
lib/​Cluster.js Removes obsolete lint directives.
lib/​BoundCluster.js Prefixes unused bindings and removes lint directives.
eslint.config.js Adds CommonJS flat configuration and test globals.
.eslintrc.json Removes legacy configuration.
.eslintignore Removes legacy ignore file; build exclusion moves into flat config.

Review effort: Balanced

The underscore prefixes added here say the parameters are unused, but
not that the behavior is wrong. discoverAttributes and
discoverAttributesExtended ignore startValue and maxResults and always
answer with every attribute and lastResponse true, so a device asking
for attributes from an offset gets the full list from zero.

Recording it rather than fixing it: the fix is a behavior change on a
ZCL command and does not belong in a lint migration.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟢 Approval recommended

The configuration migration and behavior-preserving cleanup have no identified blocking issues and are compatible with the repository’s Node.js 24 CI environment.

No open issues 🎉

Review effort: Balanced

Base automatically changed from chore/native-type-stripping to master October 23, 2026 07:15
@RobinBol
RobinBol merged commit bb1a6a1 into master Oct 23, 2026
3 checks passed
@RobinBol
RobinBol deleted the chore/eslint-flat-config branch October 23, 2026 07:21
RobinBol added a commit that referenced this pull request Oct 23, 2026
The generated docs are a static site that works straight from disk: no
fetch, no XHR, no module scripts, only relative classic script tags.
Checked over file:// in Chrome and Safari, with stylesheets, the sidebar
filter, dark mode, syntax highlighting and deep links all working, and
console output identical to serving it over http.

So serve, watch and concurrently go without a replacement, along with
build:clean and build:watch. Together they pulled in 148 transitive
dependencies and 5 audit findings for a preview that never runs in CI;
concurrently@5 is from 2020 and watch@1.0.2 from 2016.

npm run docs builds and opens build/index.html with macOS open. AGENTS.md
says how to view the docs elsewhere, and its lint line no longer refers
to the eslint-config-athom setup that #244 removed.
@RobinBol RobinBol added the internal Tooling, CI or docs, left out of the release notes label Oct 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

internal Tooling, CI or docs, left out of the release notes

Development

Successfully merging this pull request may close these issues.

2 participants