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.
This commit is contained in:
@@ -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'] }]
|
||||
}
|
||||
};
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user