Skip to content

Commit

Permalink
Add eslint-plugin-react-compiler
Browse files Browse the repository at this point in the history
  • Loading branch information
acelaya committed Mar 7, 2025
1 parent de9be5f commit 176e0b4
Show file tree
Hide file tree
Showing 7 changed files with 144 additions and 4 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
* Update to `@shlinkio/shlink-frontend-kit` 0.7.0
* Update to `@shlinkio/shlink-web-component` 0.13.0
* Update to `@shlinkio/shlink-js-sdk` 2.0.0
* Add `eslint-plugin-react-compiler`

### Deprecated
* *Nothing*
Expand Down
6 changes: 5 additions & 1 deletion eslint.config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
import shlink from '@shlinkio/eslint-config-js-coding-standard';
import reactCompiler from 'eslint-plugin-react-compiler';

/* eslint-disable-next-line no-restricted-exports */
export default shlink;
export default [
...shlink,
reactCompiler.configs.recommended,
];
132 changes: 132 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@
"eslint": "^9.21.0",
"eslint-plugin-jsx-a11y": "^6.10.2",
"eslint-plugin-react": "^7.37.4",
"eslint-plugin-react-compiler": "^19.0.0-beta-40c6c23-20250301",
"eslint-plugin-react-hooks": "^5.2.0",
"eslint-plugin-simple-import-sort": "^12.1.1",
"history": "^5.3.0",
Expand Down
5 changes: 2 additions & 3 deletions src/container/utils.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
import type { IContainer } from 'bottlejs';
import type { FC } from 'react';
import { useRef } from 'react';
import { useMemo } from 'react';

export type FCWithDeps<Props, Deps> = FC<Props> & Partial<Deps>;

export function useDependencies<Deps>(obj: Deps): Omit<Required<Deps>, keyof FC> {
const depsRef = useRef(obj as Omit<Required<Deps>, keyof FC>);
return depsRef.current;
return useMemo(() => obj as Omit<Required<Deps>, keyof FC>, [obj]);
}

export function componentFactory<Deps, CompType = Omit<Partial<Deps>, keyof FC>>(
Expand Down
2 changes: 2 additions & 0 deletions src/servers/CreateServer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,9 @@ const CreateServer: FCWithDeps<CreateServerProps, CreateServerDeps> = ({ servers
const navigate = useNavigate();
const goBack = useGoBack();
const hasServers = !!Object.keys(servers).length;
// eslint-disable-next-line react-compiler/react-compiler
const [serversImported, setServersImported] = useTimeoutToggle(false, SHOW_IMPORT_MSG_TIME);
// eslint-disable-next-line react-compiler/react-compiler
const [errorImporting, setErrorImporting] = useTimeoutToggle(false, SHOW_IMPORT_MSG_TIME);
const [isConfirmModalOpen, toggleConfirmModal] = useToggle();
const [serverData, setServerData] = useState<ServerData>();
Expand Down
1 change: 1 addition & 0 deletions src/servers/ManageServers.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ const ManageServers: FCWithDeps<ManageServersProps, ManageServersDeps> = ({ serv
[allServers, searchTerm],
);
const hasAutoConnect = allServers.some(({ autoConnect }) => !!autoConnect);
// eslint-disable-next-line react-compiler/react-compiler
const [errorImporting, setErrorImporting] = useTimeoutToggle(false, SHOW_IMPORT_MSG_TIME);

return (
Expand Down

0 comments on commit 176e0b4

Please sign in to comment.