Security News
tea.xyz Spam Plagues npm and RubyGems Package Registries
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
maybe-you-meant
Advanced tools
Readme
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 1 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.
Security News
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.
Security News
UnitedHealth Group disclosed that the ransomware attack on Change Healthcare compromised protected health information for millions in the U.S., with estimated costs to the company expected to reach $1 billion.