File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11# Changelog
22
3+ ## Unreleased
4+
5+ - Support false positives with TypeScript function overloading (fixes [ #105 ] ( https://github.com/ArnaudBarre/eslint-plugin-react-refresh/issues/105 ) )
6+
37## 0.5.0
48
59### Breaking changes
Original file line number Diff line number Diff line change @@ -275,6 +275,13 @@ const valid: {
275275 name : "Export default class component" ,
276276 code : "export default class MyComponent extends Component { render() { return <div>Hello</div>; } }" ,
277277 } ,
278+ {
279+ name : "Direct export uppercase function" ,
280+ code : `export function Button(props: PropsWithChildren<{ onClick: () => void }>): ReactNode;
281+ export function Button(props: PropsWithChildren): ReactNode {
282+ return <button {...props}>{props.children}</button>;
283+ }` ,
284+ } ,
278285] ;
279286
280287const invalid : {
Original file line number Diff line number Diff line change @@ -297,9 +297,13 @@ export const onlyExportComponents: TSESLint.RuleModule<
297297 }
298298 } else if ( node . type === "ExportNamedDeclaration" ) {
299299 if ( node . exportKind === "type" ) continue ;
300+ const declaration = node . declaration
301+ ? skipTSWrapper ( node . declaration )
302+ : null ;
303+ if ( declaration ?. type === "TSDeclareFunction" ) continue ;
300304 hasExports = true ;
301- if ( node . declaration ) {
302- handleExportDeclaration ( skipTSWrapper ( node . declaration ) ) ;
305+ if ( declaration ) {
306+ handleExportDeclaration ( declaration ) ;
303307 }
304308 for ( const specifier of node . specifiers ) {
305309 handleExportIdentifier (
You can’t perform that action at this time.
0 commit comments