sonarjs/pseudo-random
eslint-plugin-sonarjs
No autofixRecommended
eslint.config.js
export default [
{
rules: {
"sonarjs/pseudo-random": "error",
},
},
];Pseudorandom number generators (PRNGs) should not be used in security contexts
The documentation shows no incorrect example for this rule.
// === Client side ===
const crypto = window.crypto || window.msCrypto;
var array = new Uint32Array(1);
crypto.getRandomValues(array); // Compliant for security-sensitive use cases
// === Server side ===
const crypto = require('crypto');
const buf = crypto.randomBytes(1); // Compliant for security-sensitive use casesExamples from the ESLint documentation.
sonarjs/pseudo-random
eslint-plugin-sonarjs
export default [
{
rules: {
"sonarjs/pseudo-random": "error",
},
},
];Oxlint does not have this rule.
Biome does not have this rule.
Debugging features should not be enabled in production
Public "static" fields should be read-only
Temporary files should not be created in publicly writable directories
The most specific assertion should be used
"Array.reduce()" calls should include an initial value