Security News
UK Officials Consider Banning Ransomware Payments from Public Entities
The UK is proposing a bold ban on ransomware payments by public entities to disrupt cybercrime, protect critical services, and lead global cybersecurity efforts.
eslint-plugin-try-catch-failsafe
Advanced tools
Make sure to use try-catch to wrap some dangerous actions!
Make sure to use try-catch to wrap up some dangerous actions!
Use package manager to install this plugin.
npm install --save-dev eslint-plugin-try-catch-failsafe
yarn add -D eslint-plugin-try-catch-failsafe
pnpm add -D eslint-plugin-try-catch-failsafe
Add this plugin to your ESLint configuration.
{
"plugins": [
"try-catch-failsafe"
]
}
error
false
Make sure to use try-catch to wrap up JSON.parse
. Notice that the JSON.parse
in catch
or finally
block may also throw an error in JavaScript, so we should wrap them up too.
// ❌ Error
JSON.parse('{"foo": "bar"}');
// ❌ Error
try {
// some code that may throw an error
} catch (e) {
JSON.parse('{"foo": "bar"}');
}
// ❌ Error
try {
// some code that may throw an error
} finally {
JSON.parse('{"foo": "bar"}');
}
// ✅ OK
try {
JSON.parse('{"foo": "bar"}');
} catch (e) {
console.error(e);
}
// ❌ Error
try {
// some code that may throw an error
} finally {
try {
JSON.parse('{"foo": "bar"}');
} finally {}
}
If you are confident that the JSON.parse
will not throw an error, you can disable this rule.
FAQs
Make sure to use try-catch to wrap up some dangerous actions!
The npm package eslint-plugin-try-catch-failsafe receives a total of 539 weekly downloads. As such, eslint-plugin-try-catch-failsafe popularity was classified as not popular.
We found that eslint-plugin-try-catch-failsafe 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
The UK is proposing a bold ban on ransomware payments by public entities to disrupt cybercrime, protect critical services, and lead global cybersecurity efforts.
Security News
Snyk's use of malicious npm packages for research raises ethical concerns, highlighting risks in public deployment, data exfiltration, and unauthorized testing.
Research
Security News
Socket researchers found several malicious npm packages typosquatting Chalk and Chokidar, targeting Node.js developers with kill switches and data theft.