Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

eslint-plugin-react-refresh

Package Overview
Dependencies
Maintainers
1
Versions
24
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

eslint-plugin-react-refresh

Validate that your components can safely be updated with fast refresh

  • 0.2.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1.6M
decreased by-24.59%
Maintainers
1
Weekly downloads
 
Created
Source

eslint-plugin-react-refresh npm

Validate that your components can safely be updated with fast refresh.

Limitations

⚠️ To avoid false positive, this plugin is only applied on tsx & jsx files ⚠️

Like the implementation for vite, the plugin rely on naming conventions (i.e. use ). This is why there is some limitations:

  • export * are not supported and will be reported as an error
  • anonymous function are not supported (i.e export default function() {})
  • Full uppercase export would be considered as an error. It can be disabled locally when it's effectively a React component:
// eslint-disable-next-line react-refresh/eslint-plugin-react-refresh
export const CMS = () => <></>;

Installation

npm i -D eslint-plugin-react-refresh

Usage

{
  "plugins": ["react-refresh"],
  "rules": {
    "react-refresh/only-export-components": "warn"
  }
}

Fail

export const foo = () => {};
export const Bar = () => <></>;
export const CONSTANT = 3;
export const Foo = () => <></>;
export default function () {}
export * from "./foo";

Pass

export default function Foo() {
  return <></>;
}
const foo = () => {};
export const Bar = () => <></>;

Keywords

FAQs

Package last updated on 23 Jan 2022

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc