An ESLint plugin that provides a single rule (`no-secrets`) to detect potential secrets, API keys, tokens, or other sensitive data hardcoded in source code. Version 2.3.3 (stable, maintained as of early 2025) supports Node >=18 and npm >=8. It uses a configurable regex-based pattern matching approach, with a default set of patterns for common secret formats (e.g., AWS keys, GitHub tokens, private keys). Unlike generic secret scanners, it integrates directly into ESLint workflows and supports per-file ignore lists via inline comments. The rule can be tuned by adding custom patterns or adjusting entropy thresholds. Ships TypeScript definitions.
npm install eslint-plugin-no-secretsVerified import paths — ran on the pinned version, not inferred.
Shows how to enable the `no-secrets` plugin and rule in an ESLint flat config (ESM). Uses dynamic import because the plugin is ESM by default.
Tune patterns per project, add violations to ignore list via inline comment `// eslint-disable-next-line no-secrets/no-secrets` or configure `ignore` option in rule settings.
Adjust `entropy` option threshold or add `ignore` patterns to exclude known non-secrets.
Upgrade ESLint to version 5 or later.
Upgrade Node to >=18 and npm to >=8.
Switch to flat config format with explicit plugin import and rules declaration.
Run `npm install eslint-plugin-no-secrets --save-dev`.
Add 'no-secrets' to plugins array in ESLint config.
Use `await import('eslint-plugin-no-secrets')` or ensure the package is installed.