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-piiVerified import paths — ran on the pinned version, not inferred.
Configures ESLint to use eslint-plugin-pii with four rules enabled and shows example violations.
Manually review runtime data handling; the plugin does not catch PII in variables or function arguments.
Test thoroughly with your codebase; consider complementing with additional tools or custom rules.
Use ESLint >=4.19.1 and Node >=8.0.0. If using ESLint 8+, upgrade plugin if later version exists.
Use .eslintrc.json or .eslintrc.yaml format; do not use eslint.config.js.
Run 'npm install eslint-plugin-pii --save-dev' and ensure it is installed in the project.
Ensure rule value is 'off', 'warn', or 'error' (or numbers 0,1,2). Example: "pii/no-email": "error"
Add 'parserOptions': { 'ecmaVersion': 2020 } or higher in .eslintrc.