Security News
NIST Misses 2024 Deadline to Clear NVD Backlog
NIST has failed to meet its self-imposed deadline of clearing the NVD's backlog by the end of the fiscal year. Meanwhile, CVE's awaiting analysis have increased by 33% since June.
eslint-plugin-react-refresh
Advanced tools
Validate that your components can safely be updated with fast refresh
Validate that your components can safely be updated with fast refresh.
⚠️ To avoid false positive, by default this plugin is only applied on tsx
& jsx
files. See options to run on JS files. ⚠️
The plugin rely on naming conventions (i.e. use PascalCase for components, camelCase for util functions). This is why there are some limitations:
export *
are not supported and will be reported as an errorexport default function() {}
)// eslint-disable-next-line react-refresh/only-export-components
export const CMS = () => <></>;
I may publish a rule base on type information from typescript-eslint to improve some limitations and catch some naming convention issues (like non-component function starting with an uppercase).
npm i -D eslint-plugin-react-refresh
{
"plugins": ["react-refresh"],
"rules": {
"react-refresh/only-export-components": "warn"
}
}
export const foo = () => {};
export const Bar = () => <></>;
export const CONSTANT = 3;
export const Foo = () => <></>;
export default function () {}
export default compose()(MainComponent)
export * from "./foo";
const Tab = () => {};
export const tabs = [<Tab />, <Tab />];
const App = () => {};
createRoot(document.getElementById("root")).render(<App />);
export default function Foo() {
return <></>;
}
const foo = () => {};
export const Bar = () => <></>;
import { App } from "./App";
createRoot(document.getElementById("root")).render(<App />);
If your using JSX inside .js
files (which I don't recommend because it forces you to configure every tool you use to switch the parser), you can still use the plugin by enabling this option. To reduce the number of false positive, only files importing react
are checked.
{
"react-refresh/only-export-components": ["warn", { "checkJS": true }]
}
0.3.5
Ignore stories files (*.stories.*
) (fixes #10)
FAQs
Validate that your components can safely be updated with fast refresh
The npm package eslint-plugin-react-refresh receives a total of 1,262,017 weekly downloads. As such, eslint-plugin-react-refresh popularity was classified as popular.
We found that eslint-plugin-react-refresh demonstrated a healthy version release cadence and project activity because the last version was released less than 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
NIST has failed to meet its self-imposed deadline of clearing the NVD's backlog by the end of the fiscal year. Meanwhile, CVE's awaiting analysis have increased by 33% since June.
Security News
Cloudflare has launched a setup wizard allowing users to easily create and manage a security.txt file for vulnerability disclosure on their websites.
Security News
The Socket Research team breaks down a malicious npm package targeting the legitimate DOMPurify library. It uses obfuscated code to hide that it is exfiltrating browser and crypto wallet data.