{"id":19871,"library":"eslint-plugin-pii","title":"eslint-plugin-pii","description":"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.","status":"active","version":"1.0.2","language":"javascript","source_language":"en","source_url":"https://github.com/shiva-hack/eslint-plugin-pii","tags":["javascript","eslint","eslintplugin","eslint-plugin","pii"],"install":[{"cmd":"npm install eslint-plugin-pii","lang":"bash","label":"npm"},{"cmd":"yarn add eslint-plugin-pii","lang":"bash","label":"yarn"},{"cmd":"pnpm add eslint-plugin-pii","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Peer dependency required for plugin to function","package":"eslint","optional":false}],"imports":[{"note":"This is an ESLint plugin, not a library. Configure in .eslintrc or eslint.config.js, not via import/require in source files.","wrong":"Using require directly in code: const pii = require('eslint-plugin-pii')","symbol":"plugin","correct":"// In .eslintrc: {\"plugins\": [\"pii\"]}"},{"note":"Rules are prefixed with 'pii/', not the full plugin name. Available rules: no-email, no-dob, no-ip, no-phone-number.","wrong":"Using wrong rule prefix: {\"rules\": {\"eslint-plugin-pii/no-email\": \"error\"}}","symbol":"rules","correct":"// In .eslintrc: {\"rules\": {\"pii/no-email\": \"error\"}}"},{"note":"The extends value must include the 'plugin:' prefix to reference the plugin's configuration.","wrong":"Extending 'pii/recommended' without 'plugin:' prefix: {\"extends\": [\"pii/recommended\"]}","symbol":"recommended config","correct":"// In .eslintrc: {\"extends\": [\"plugin:pii/recommended\"]}"}],"quickstart":{"code":"// .eslintrc.json\n{\n  \"plugins\": [\"pii\"],\n  \"rules\": {\n    \"pii/no-email\": \"error\",\n    \"pii/no-dob\": \"warn\",\n    \"pii/no-ip\": \"error\",\n    \"pii/no-phone-number\": \"error\"\n  }\n}\n\n// Sample file with violations:\n// const email = 'user@example.com'; // -> error: no-email\n// const ip = '192.168.1.1'; // -> error: no-ip","lang":"javascript","description":"Configures ESLint to use eslint-plugin-pii with four rules enabled and shows example violations."},"warnings":[{"fix":"Manually review runtime data handling; the plugin does not catch PII in variables or function arguments.","message":"Rules only check comments and string literals, not variable values or dynamic strings.","severity":"gotcha","affected_versions":"all"},{"fix":"Test thoroughly with your codebase; consider complementing with additional tools or custom rules.","message":"The plugin uses regex patterns that may have false positives or miss certain PII formats.","severity":"gotcha","affected_versions":"all"},{"fix":"Use ESLint >=4.19.1 and Node >=8.0.0. If using ESLint 8+, upgrade plugin if later version exists.","message":"Node engine >=0.10.0 is very old; newer Node versions may have compatibility issues with ESLint 4.","severity":"deprecated","affected_versions":">=1.0.0 <2.0.0"},{"fix":"Use .eslintrc.json or .eslintrc.yaml format; do not use eslint.config.js.","message":"The plugin does not support flat config (eslint.config.js); only works with .eslintrc files.","severity":"gotcha","affected_versions":"all"}],"env_vars":null,"last_verified":"2026-04-25T00:00:00.000Z","next_check":"2026-07-24T00:00:00.000Z","problems":[{"fix":"Run 'npm install eslint-plugin-pii --save-dev' and ensure it is installed in the project.","cause":"Plugin not installed or not listed in package.json devDependencies.","error":"ESLint couldn't find the plugin \"eslint-plugin-pii\"."},{"fix":"Ensure rule value is 'off', 'warn', or 'error' (or numbers 0,1,2). Example: \"pii/no-email\": \"error\"","cause":"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.","error":"Configuration for rule \"pii/no-email\" is invalid: Severity should be one of the following: 0 = off, 1 = warn, 2 = error."},{"fix":"Add 'parserOptions': { 'ecmaVersion': 2020 } or higher in .eslintrc.","cause":"ESLint parser expecting older ECMAScript version.","error":"Parsing error: The keyword 'const' is reserved"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}