eslint-plugin-security
ESLint rules for Node Security
This project will help identify potential security hotspots, but finds a lot of false positives which need triage by a human.
Installation
npm install --save-dev eslint-plugin-security copy
or
yarn add --dev eslint-plugin-security copy
Usage
Flat config (requires eslint >= v8.23.0)
Add the following to your eslint.config.js file:
const pluginSecurity = require ( 'eslint-plugin-security' );
module . exports = [pluginSecurity.configs.recommended]; copy
eslintrc config (deprecated)
Add the following to your .eslintrc file:
module . exports = {
extends: [ 'plugin:security/recommended-legacy' ],
}; copy
Developer guide
Use GitHub pull requests .
Please implement a test for each new rule and use this command to be sure the new code respects the style guide and the tests keep passing:
npm run-script cont-int copy
Tests
Rules
⚠️ Configurations set to warn in.
✅ Set in the recommended configuration.
TypeScript support
Type definitions for this package are bundled with it, so nothing else needs to be installed.
They are written against the ESLint v9 type definitions, so they require either eslint >= v9.10.0, which is the first release that ships its own type definitions, or @types/eslint v9 alongside an older ESLint.
If you previously installed @types/eslint-plugin-security from DefinitelyTyped , it is no longer needed and can be removed:
npm uninstall @types/eslint-plugin-security
# OR
yarn remove @types/eslint-plugin-security copy