eslint-plugin-no-secrets weekly downloads statistics
By nickdeis · npm · ESLint plugins
An eslint rule that searches for potential secrets/keys in code
eslint-plugin-no-secrets has 418,368 recorded weekly downloads on npm, an increase of 3.8% over the past 30 days, ranking #425 of 3,247 tracked listings.
About eslint-plugin-no-secrets
eslint-plugin-no-secrets
An eslint rule that searches for potential secrets/keys in code and JSON files.
This plugin has two rules:
no-secrets: Find potential secrets using cryptographic entropy or patterns in the AST (acts like a standard eslint rule, more configurable)no-pattern-match: Find potential secrets in text (acts likegrep, less configurable, but potentially more flexible)
<!-- vscode-markdown-toc -->
-
- 1.1. Flat config
- 1.2. eslintrc
- 1.3. Include JSON files
-
- 2.1.
no-secretsexamples - 2.2. When it's really not a secret
- 2.3.
no-secretsOptions
- 2.1.
1. <a name='Usage'></a>Usage
npm i -D eslint-plugin-no-secrets
1.1. <a name='Flatconfig'></a>Flat config
eslint.config.js
import noSecrets from "eslint-plugin-no-secrets";
export default [
{
files: ["**/*.js"],
plugins: {
"no-secrets": noSecrets,
},
rules: {
"no-secrets/no-secrets": "error",
},
},
];
1.2. <a name='eslintrc'></a>eslintrc
.eslintrc
{
"plugins": ["no-secrets"],
"rules": {
"no-secrets/no-secrets": "error"
}
}
//Found a string with entropy 4.3 : "ZWVTjPQSdhwRgl204Hc51YCsritMIzn8B=/p9UyeX7xu6KkAGqfm3FJ+oObLDNEva"
const A_SECRET =
"ZWVTjPQSdhwRgl204Hc51YCsritMIzn8B=/p9UyeX7xu6KkAGqfm3FJ+oObLDNEva";
//Found a string that matches "AWS API Key" : "AKIAIUWUUQQN3GNUA88V"
const AWS_TOKEN = "AKIAIUWUUQQN3GNUA88V";
1.3. <a name='IncludeJSONfiles'></a>Include JSON files
To include JSON files, install eslint-plugin-jsonc or @eslint/json (if using ESLint version 9.6 or above)
npm install --save-dev eslint-plugin-jsonc
Then in your .eslint configuration file, extend the jsonc base config
{
"extends": ["plugin:jsonc/base"]
}
or if you are using ESLint 9.6 or above
module.exports = [
{
plugins: {
json,
"no-secrets": noSecret,
},
},
{
files: ["**/*.json"],
language: "json/json",
....
},
];
1.3.1. <a name='IncludeJSONfileswithinflatconfigs'></a>Include JSON files with in "flat configs"
eslint.config.js
import noSecrets from "eslint-plugin-no-secrets";
import jsoncExtend from "eslint-plugin-jsonc";
export default [
...jsoncExtend.configs["flat/recommended-with-jsonc"],
{
languageOptions: { ecmaVersion: 6 },
plugins: {
"no-secrets": noSecrets,
},
rules: {
"no-secrets/no-secrets": "error",
},
},
];
2. <a name='no-secrets'></a>no-secrets
no-secrets is a rule that does two things:
- Search for patterns that often contain sensitive information
- Measure cryptographic entropy to find potentially leaked secrets/passwords
It's modeled after early truffleHog, but acts on ECMAscripts AST. This allows closer inspection into areas where secrets are commonly leaked like string templates or comments.
2.1. <a name='no-secretsexamples'></a>no-secrets examples
Decrease the tolerance for entropy
{
"plugins": ["no-secrets"],
"rules": {
"no-secrets/no-secrets": ["error", { "tolerance": 3.2 }]
}
}
Add additional patterns to check for certain token formats.
Standard patterns can be found here
{
"plugins": ["no-secrets"],
"rules": {
"no-secrets/no-secrets": [
"error",
{
"additionalRegexes": {
"Basic Auth": "Authorization: Basic [A-Za-z0-9+/=]*"
}
}
]
}
}
2.2. <a name='Whenitsreallynotasecret'></a>When it's really not a secret
2.2.1. <a name='Eitherdisableitwithacomment'></a> Either disable it with a comment
// Set of potential base64 characters
// eslint-disable-next-line no-secrets/no-secrets
const BASE64_CHARS =
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
This will tell future maintainers of the codebase that this suspicious string isn't an oversight
2.2.2. <a name='usetheignoreContenttoignorecertaincontent'></a> use the ignoreContent to ignore certain content
{
"plugins": ["no-secrets"],
"rules": {
"no-secrets/no-secrets": ["error", { "ignoreContent": "^ABCD" }]
}
}
2.2.3. <a name='UseignoreIdentifierstoignorecertainvariablepropertynames'></a> Use ignoreIdentifiers to ignore certain variable/property names
{
"plugins": ["no-secrets"],
"rules": {
"no-secrets/no-secrets": [
"error",
{ "ignoreIdentifiers": ["BASE64_CHARS"] }
]
}
}
2.2.4. <a name='UseadditionalDelimiterstofurthersplituptokens'></a> Use additionalDelimiters to further split up tokens…
Description from the npm listing.
- eslint
- eslint-plugin
- security
- secure
- secrets
- lint
- eslintplugin
README badge
Show your rank in a README or on your website. The badge updates automatically.
Charts
Images: 30d · 1y · all time · 1600×900 dark
Adoption over time
7/30/90-day growth
Ranking history
Listing placement
Listing placement
Filled points are observed values; hollow points come from Internet Archive snapshots of the listing page. Dashed segments span periods with no observations — values between points are not interpolated.
Each band is one page of 20. Weekly downloads on a linear scale. Placement is projected from weekly downloads, so it can differ from the marketplace's own sort order. Hover a dot to see the listing.
Recent observations
Full history (591)Similar npm ESLint plugins plugins
All 20 eslint-plugin-no-secrets alternativesData source
Weekly downloads (trailing 7 complete days) come from the official npm downloads API. Downloads include CI and mirrors and are not equivalent to installs or users. npm publishes no ratings.
Listing: https://www.npmjs.com/package/eslint-plugin-no-secrets. First seen Oct 16, 2026; last successful collection Dec 6, 2026. See the methodology.