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.
maybe-you-meant
Advanced tools
Find deceptive typo's in your react projects.
Are you familiar with the following?
class Foo extends Component {
static propTypes = {
foobar: PropTypes.string
}
static defaultProps = {
foobar: 'whatever'
}
}
// Somewhere in the app
// Oops! We misspelled, but we won't blow up because of a default prop type.
<Foo foobbar='not whatever' />
If so, maybe-you-meant
can help. Maybe you meant patches React.createElement
to patch every single components componentDidMount
, componentDidUpdate
(wraps for functional components) to issue console warnings whenever a prop type
is similar (but not equal) to one of your defined propTypes
.
The preceding, albeit contrived, example would issue the following:
In addition, maybe-you-meant will warn when Components are passed props not
defined in propTypes
, only when propTypes
are defined. By default, maybe-you-meant
whitelists react's internal properties (events, data-attributes, aria-attributes, html, and svg).
The following...
class Foo extends Component {
static propTypes = {}
}
// The following will result in a warning for the `bar` prop.
<Foo
bar='Bang'
data-foo='bar'
aria-expanded='false'
onClick={() => {}}
/>
...will result in:
yarn add -D maybe-you-meant
# Or
npm i -D maybe-you-meant
// Somewhere in the top of your app
import maybeYouMeant from 'maybe-you-meant'
maybeYouMeant()
// or
maybeYouMeant({
maxDistance: 3,
include: [/^Include/, 'PatchMe'],
exclude: [/^Connect/, 'DoNotPatchMe']
})
// Don't want warnings about undeclared props?
maybeYouMeant({
warnOnUndeclaredProps: false
})
// Want to extend the set of whitelisted props (for warning on undeclared props)?
import maybeYouMeant, { whitelisted } from 'maybe-you-meant'
// maybe-you-meant exports whitelisted properies from all of the following
// `all` is a combination of the rest.
const { all, react, events, aria, data, html, svg } = whitelisted
maybeYouMeant({
whitelistedProps: [
...whitelisted.all,
// Don't warn when these are passed and not declared in `propTypes`
'myProp',
/^myProps/
]
})
propTypes
(default is ture)
propTypes
reactProps.js
for more info)The awesome why-did-you-update module.
FAQs
Find deceptive prop-type typeo's in your react apps
The npm package maybe-you-meant receives a total of 6 weekly downloads. As such, maybe-you-meant popularity was classified as not popular.
We found that maybe-you-meant 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.