Registry / testing / eslint-plugin-pii

eslint-plugin-pii

JSON →
library1.0.2jsnpmunverified

An ESLint plugin that provides linting rules to prevent Personally Identifiable Information (PII) such as emails, dates of birth, IP addresses, and phone numbers from appearing in comments or string literals. Version 1.0.2 is the latest stable release, last updated in 2023. The plugin offers a recommended configuration via plugin:pii/recommended for easy setup. It uses regex-based checks and is designed for Node.js >=0.10.0 with ESLint >=4.19.1. Compared to similar tools like eslint-plugin-no-secrets, this plugin focuses specifically on PII patterns and provides granular rule control.

npm install eslint-plugin-pii
INSTALL
IMPORT
SIG · ESLINT-PLUGIN-PII
E
eslint-plugin-pii
testingjavascriptv1.0.2
Install
—
Import
—
Disk
—
Pass rate
0/ 6
Env Coverage0 / 6
glibc
18–22
musl
18–22
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18–226 runs
build_error
glibc
node 18–226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

plugin
✓ // In .eslintrc: {"plugins": ["pii"]}
✗ Using require directly in code: const pii = require('eslint-plugin-pii')
This is an ESLint plugin, not a library. Configure in .eslintrc or eslint.config.js, not via import/require in source files.
rules
✓ // In .eslintrc: {"rules": {"pii/no-email": "error"}}
✗ Using wrong rule prefix: {"rules": {"eslint-plugin-pii/no-email": "error"}}
Rules are prefixed with 'pii/', not the full plugin name. Available rules: no-email, no-dob, no-ip, no-phone-number.
recommended config
✓ // In .eslintrc: {"extends": ["plugin:pii/recommended"]}
✗ Extending 'pii/recommended' without 'plugin:' prefix: {"extends": ["pii/recommended"]}
The extends value must include the 'plugin:' prefix to reference the plugin's configuration.

Configures ESLint to use eslint-plugin-pii with four rules enabled and shows example violations.

// .eslintrc.json { "plugins": ["pii"], "rules": { "pii/no-email": "error", "pii/no-dob": "warn", "pii/no-ip": "error", "pii/no-phone-number": "error" } } // Sample file with violations: // const email = 'user@example.com'; // -> error: no-email // const ip = '192.168.1.1'; // -> error: no-ip
Debug
Known issues
gotchaRules only check comments and string literals, not variable values or dynamic strings.
fix
Manually review runtime data handling; the plugin does not catch PII in variables or function arguments.
affects: all
gotchaThe plugin uses regex patterns that may have false positives or miss certain PII formats.
fix
Test thoroughly with your codebase; consider complementing with additional tools or custom rules.
affects: all
deprecatedNode engine >=0.10.0 is very old; newer Node versions may have compatibility issues with ESLint 4.
fix
Use ESLint >=4.19.1 and Node >=8.0.0. If using ESLint 8+, upgrade plugin if later version exists.
affects: >=1.0.0 <2.0.0
gotchaThe plugin does not support flat config (eslint.config.js); only works with .eslintrc files.
fix
Use .eslintrc.json or .eslintrc.yaml format; do not use eslint.config.js.
affects: all
Errors
Common errors & fixes
ESLint couldn't find the plugin "eslint-plugin-pii".
Plugin not installed or not listed in package.json devDependencies.
fix
Run 'npm install eslint-plugin-pii --save-dev' and ensure it is installed in the project.
Configuration for rule "pii/no-email" is invalid: Severity should be one of the following: 0 = off, 1 = warn, 2 = error.
Rule severity set to an invalid value (e.g., string 'error' without quotes in JSON? Actually 'error' is valid). Might be using wrong config format.
fix
Ensure rule value is 'off', 'warn', or 'error' (or numbers 0,1,2). Example: "pii/no-email": "error"
Parsing error: The keyword 'const' is reserved
ESLint parser expecting older ECMAScript version.
fix
Add 'parserOptions': { 'ecmaVersion': 2020 } or higher in .eslintrc.
Upgrade
Version history
1.0.2latest on npm
Audit
Dependencies
eslintrequiredPeer dependency required for plugin to function
Agent activity
6 hits · last 30 days
node
6
Resources
eslint-plugin-pii — npm install eslint-plugin-pii · libregistry