sonarjs/confidential-information-logging
eslint-plugin-sonarjs
export default [
{
rules: {
"sonarjs/confidential-information-logging": "error",
},
},
];This rule is deprecated. Check its documentation for a replacement before enabling it.
Confidential information should not be logged
The documentation shows no incorrect example for this rule.
const { Signale } = require('signale');
const CREDIT_CARD_NUMBERS = fetchFromWebForm()
// here we suppose the credit card numbers are retrieved somewhere and CREDIT_CARD_NUMBERS looks like ["1234-5678-0000-9999", "1234-5678-0000-8888"]; for instance
const options = {
secrets: ["([0-9]{4}-?)+"]
};
const logger = new Signale(options); // Compliant
CREDIT_CARD_NUMBERS.forEach(function(CREDIT_CARD_NUMBER) {
logger.log('The customer ordered products with the credit card number = %s', CREDIT_CARD_NUMBER);
});Examples from the ESLint documentation.
No tracked preset enables this rule, so it has no reach yet.
None of the tracked presets enable this rule. Turn it on with the config below.
sonarjs/confidential-information-logging
eslint-plugin-sonarjs
export default [
{
rules: {
"sonarjs/confidential-information-logging": "error",
},
},
];Oxlint does not have this rule.
Biome does not have this rule.
Cyclomatic Complexity of functions should not be too high
Variables and functions should not be declared in the global scope
Destructuring syntax should be used for assignments
Class methods should be used instead of "prototype" assignments