From 30ac4140af958dad7770b6fc94b37e88a50944bc Mon Sep 17 00:00:00 2001 From: Paul Nothaft Date: Tue, 1 Sep 2026 19:17:09 +0200 Subject: [PATCH] chore(backend): teach eslint the rest-sibling omission idiom Adds varsIgnorePattern and ignoreRestSiblings to no-unused-vars, the config recommendation left open when the lint backlog was cleared. The "omit fields via rest spread" idiom is intentional and recurring -- adminEvents/helpers.js destructures password_hash and client_password_hash purely to keep them out of `...rest` -- and without ignoreRestSiblings every occurrence needs its own disable comment, which is noise that also suppresses genuine findings on the same line. Removed the one such comment that now exists; the explanatory comment above it stays, since the intent is not obvious from the code. Lint stays at 0 problems. Refs testplan REPORT.md D1. --- backend/.eslintrc.js | 10 +++++++++- backend/src/routes/adminEvents/helpers.js | 1 - 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/backend/.eslintrc.js b/backend/.eslintrc.js index 5b22df96..dc508bc8 100644 --- a/backend/.eslintrc.js +++ b/backend/.eslintrc.js @@ -17,7 +17,15 @@ module.exports = { 'linebreak-style': ['error', 'unix'], 'quotes': ['error', 'single'], 'semi': ['error', 'always'], - 'no-unused-vars': ['error', { 'argsIgnorePattern': '^_' }], + // varsIgnorePattern + ignoreRestSiblings cover the "omit fields via rest + // spread" idiom (e.g. adminEvents/helpers.js pulling password hashes out + // of ...rest), which is intentional and would otherwise need a disable + // comment at every occurrence. + 'no-unused-vars': ['error', { + 'argsIgnorePattern': '^_', + 'varsIgnorePattern': '^_', + 'ignoreRestSiblings': true + }], 'no-console': ['warn', { allow: ['warn', 'error'] }] } }; diff --git a/backend/src/routes/adminEvents/helpers.js b/backend/src/routes/adminEvents/helpers.js index 83d2df14..be10a8cc 100644 --- a/backend/src/routes/adminEvents/helpers.js +++ b/backend/src/routes/adminEvents/helpers.js @@ -177,7 +177,6 @@ const mapEventForApi = (event) => { customer_email, customer_phone, // Bound only to exclude the secrets from `...rest` — never read. - // eslint-disable-next-line no-unused-vars -- rest-sibling omission password_hash: _ph, client_password_hash: _cph, ...rest } = event;