
Security News
Open Source CAI Framework Handles Pen Testing Tasks up to 3,600× Faster Than Humans
CAI is a new open source AI framework that automates penetration testing tasks like scanning and exploitation up to 3,600× faster than humans.
eslint-plugin-require-explicit-generics
Advanced tools
Force configured functions to include explicit generics
Allow configured functions to require explicit generics.
Some libraries are over-permissive with their types, allowing generics to be omitted defaulting them to the any
type.
To prevent accidentally relying on this behaviour:
this plugin allows you to specify a list of functions and constructors that MUST have explicit generics set.
If you list myFunction
in your .eslintrc.js
:
myFunction(); // ❌ ESLint: Function 'myFunction' must be called with explicit generics...
myFunction<SomeType>(); // ✅ ESLint: Pass
First install ESLint:
# npm
npm install eslint --save-dev
# yarn
yarn add eslint --dev
Next, install eslint-plugin-require-explicit-generics
# npm
npm install eslint-plugin-require-explicit-generics --save-dev
# yarn
yarn add eslint-plugin-require-explicit-generics --dev
In your .estlintrc.js
add "require-explicit-generics"
to the plugin list.
plugins: [
"require-explicit-generics",
],
Then in the rules section set "require-explicit-generics/require-explicit-generics"
pass the log level (either "error"
or "warning"
),
then the list of functions to check.
rules: {
"require-explicit-generics/require-explicit-generics": [
"error",
// List your functions here
[ "myFunction", "myVar.myOtherFunction" ]
]
},
You can also use a map to define how many generics to expect for each function.
rules: {
"require-explicit-generics/require-explicit-generics": [
"error",
{ "myFunction": 3, "myVar.myOtherFunction": 1 }
]
},
myVar.myOtherFunction(); // Function 'myVar.myOtherFunction' must be called with generics...
myFunction<TypeA>(); // Function 'myOtherFunction' called with too few explicit generics...
1.0.0
FAQs
Force configured functions to include explicit generics
The npm package eslint-plugin-require-explicit-generics receives a total of 9,405 weekly downloads. As such, eslint-plugin-require-explicit-generics popularity was classified as popular.
We found that eslint-plugin-require-explicit-generics demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
CAI is a new open source AI framework that automates penetration testing tasks like scanning and exploitation up to 3,600× faster than humans.
Security News
Deno 2.4 brings back bundling, improves dependency updates and telemetry, and makes the runtime more practical for real-world JavaScript projects.
Security News
CVEForecast.org uses machine learning to project a record-breaking surge in vulnerability disclosures in 2025.