Research
Security News
Malicious npm Package Targets Solana Developers and Hijacks Funds
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
typescript-eslint-jsx-conditionals
Advanced tools
TypeScript ESlint rule to remove unsafe conditionals in JSX.
TypeScript ESLint rule to remove unsafe conditionals in JSX.
npm install --save-dev typescript-eslint-jsx-conditionals
yarn add -D typescript-eslint-jsx-conditionals
module.exports = {
root: true,
parser: '@typescript-eslint/parser',
plugins: ['@typescript-eslint', 'typescript-eslint-jsx-conditionals'],
ignorePatterns: ['.eslintrc.js'],
rules: {
'typescript-eslint-jsx-conditionals/strict-jsx-conditionals': 'error',
},
}
const Component = ({ check }: { check: boolean }) => {
return <div>{check && <p>Check</p>}</div>
}
const HelloWorld = () => {
const someCondition = true
return <div>{someCondition && <p>Check</p>}</div>
}
Check might be undefined.
const Component = ({ check }: { check?: boolean }) => {
return <div>{check && <p>Check</p>}</div>
}
message.length is a number
const HelloWorld = () => {
const message = 'hello world'
return <div>{message.length && <p>Check</p>}</div>
}
Check might not be a boolean
const Component = ({ check }: { check: boolean | string | null }) => {
return <div>{check && <p>Check</p>}</div>
}
Name | Type | Default Value | Description |
---|---|---|---|
preferBoolean | boolean | false | When using auto-fix, use Boolean() cast instead of !! |
normalize | boolean | false | ensure that your whole codebase uses the same type of casting - HIGHLY EXPERIMENTAL and NOT recommended |
FAQs
TypeScript ESlint rule to remove unsafe conditionals in JSX.
We found that typescript-eslint-jsx-conditionals 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.
Research
Security News
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Security News
Research
Socket researchers have discovered malicious npm packages targeting crypto developers, stealing credentials and wallet data using spyware delivered through typosquats of popular cryptographic libraries.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.