Security News
Python Overtakes JavaScript as Top Programming Language on GitHub
Python becomes GitHub's top language in 2024, driven by AI and data science projects, while AI-powered security tools are gaining adoption.
@arthurgeron/eslint-plugin-react-usememo
Advanced tools
Enforce that all function components are wrapped in `React.memo`, and that all props and deps are wrapped in `useMemo`/`useCallback` so they don’t break memo.
Enforce that all function components are wrapped in React.memo
, and that all props and deps are wrapped in useMemo
/useCallback
so they don’t break memo.
Rationale: Why we memo all the things.
yarn add @arthurgeron/eslint-plugin-react-usememo --dev
or
npm install @arthurgeron/eslint-plugin-react-usememo --save-dev
To enable the plugin add the following to the plugin
property your eslintrc
file:
plugins: ["@arthurgeron/react-usememo"],
Then enable any rules as you like, example:
rules: {
"@arthurgeron/react-usememo/require-usememo": [2],
},
require-memo
Requires all function components to be wrapped in React.memo()
.
May be useful when used with overrides in your eslint config, I do not recommend enabling this globally.
require-usememo
RecommendedRequires complex values (objects, arrays, functions, and JSX) that get passed props or referenced as a hook dependency to be wrapped in React.useMemo()
or React.useCallback()
.
Options:
{strict: true}
: Fails even in cases where it is difficult to determine if the value in question is a primitive (string or number) or a complex value (object, array, etc.).require-usememo-children
AdvancedRequires complex values (objects, arrays, functions, and JSX) that get passed as children to be wrapped in React.useMemo()
or React.useCallback()
.
Options:
{strict: true}
: Fails even in cases where it is difficult to determine if the value in question is a primitive (string or number) or a complex value (object, array, etc.).FAQs
This plugin enforces the wrapping of complex objects or functions (which might generate unnecessary renders or side-effects) in `useMemo` or `useCallback`. It also allows you to programmatically enforce the wrapping of functional components in `memo`, and
The npm package @arthurgeron/eslint-plugin-react-usememo receives a total of 2,704 weekly downloads. As such, @arthurgeron/eslint-plugin-react-usememo popularity was classified as popular.
We found that @arthurgeron/eslint-plugin-react-usememo demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers 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
Python becomes GitHub's top language in 2024, driven by AI and data science projects, while AI-powered security tools are gaining adoption.
Security News
Dutch National Police and FBI dismantle Redline and Meta infostealer malware-as-a-service operations in Operation Magnus, seizing servers and source code.
Research
Security News
Socket is tracking a new trend where malicious actors are now exploiting the popularity of LLM research to spread malware through seemingly useful open source packages.