Research
Security News
Quasar RAT Disguised as an npm Package for Detecting Vulnerabilities in Ethereum Smart Contracts
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
babel-plugin-react-query-key-gen
Advanced tools
React Query uses the convention of a string key as a unique, readable identifier for queries. However, naming things well is difficult. Poor naming causes further confusion for the next person reading your code.
Also, query keys should include variables that your query function depends on. Query function dependencies. You will most likely be introducing stale data and bugs if you're not following this advice.
We could generate this key at build-time, inferring from the name of it's associated query function. Why name things twice when you can just
reuse what's already there? This babel plugin will statically analyze your code and extract the query function name from your useQuery
hooks.
Secondly, given the recommendation of using inline functions in v3, we could look at which args are being passed to the nested queryFn call, and fill in the missing keys according to that.
yarn:
yarn add babel-plugin-react-query-key-gen --dev
npm:
npm install babel-plugin-react-query-key-gen --dev
Then, add plugin to your .babelrc
{
"plugins": ["babel-plugin-react-query-key-gen"]
}
You now have the option to exclude the string identifier from your query key if you want. However, if you do choose to include a string key manually, then nothing will change. This is to provide flexibility and ease of migration if you do decide to use this plugin.
This plugin makes a few assumptions about your query key order and query function:
FAQs
### Problem
The npm package babel-plugin-react-query-key-gen receives a total of 0 weekly downloads. As such, babel-plugin-react-query-key-gen popularity was classified as not popular.
We found that babel-plugin-react-query-key-gen 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
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
Security News
Research
A supply chain attack on Rspack's npm packages injected cryptomining malware, potentially impacting thousands of developers.
Research
Security News
Socket researchers discovered a malware campaign on npm delivering the Skuld infostealer via typosquatted packages, exposing sensitive data.