@unito/integration-sdk
Version:
Integration SDK
23 lines (22 loc) • 856 B
TypeScript
/**
* Disallow passing full error objects to logger methods. Full error objects
* contain stack traces, provider response bodies, and potentially credentials.
* Extract specific fields instead.
*
* Bad:
* catch (error) { logger.error(error); }
* logger.warn(err);
*
* Good:
* catch (error) { logger.error('upload failed', { message: error.message }); }
* logger.warn({ message: err.message, code: err.code });
*
* Detection tiers:
* 1. (high confidence) Inside a CatchClause, the caught parameter is passed
* directly to a logger call — regardless of the parameter's name.
* 2. (medium confidence) Any logger call with an argument matching the
* common error identifier pattern /^(e|err|error|ex|exception|cause)$/i.
*/
import type { Rule } from 'eslint';
declare const rule: Rule.RuleModule;
export default rule;