Skip to content

Commit

Permalink
Merge pull request #271 from dermeck/react-compiler-eslint
Browse files Browse the repository at this point in the history
add react compiler eslint rules
  • Loading branch information
dermeck authored Dec 7, 2024
2 parents 9a12d68 + 57bf55c commit afe093c
Show file tree
Hide file tree
Showing 6 changed files with 306 additions and 6 deletions.
6 changes: 4 additions & 2 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,10 @@
"ecmaVersion": 12,
"sourceType": "module"
},
"plugins": ["react", "@typescript-eslint"],
"rules": {},
"plugins": ["react", "@typescript-eslint", "eslint-plugin-react-compiler"],
"rules": {
"react-compiler/react-compiler": "error"
},
"settings": { "react": { "version": "detect" } },
"ignorePatterns": ["webpack.config.js", "webpack.stand-alone.js"]
}
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
"dotenv-cli": "^7.4.4",
"eslint": "^8.57.1",
"eslint-plugin-react": "^7.37.2",
"eslint-plugin-react-compiler": "beta",
"eslint-plugin-react-hooks": "^5.0.0",
"fast-xml-parser": "^4.5.0",
"feedparser": "^2.2.10",
Expand Down
2 changes: 1 addition & 1 deletion src/sidebar/MainView/folder-tree/FolderTreeNode.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ type FolderTreeNode = {
};

const FolderTreeNode = ({ nodeId, nestedLevel, filterString }: FolderTreeNode) => {
const selectTreeNode = useMemo(makeSelectTreeNode, []);
const selectTreeNode = useMemo(() => makeSelectTreeNode(), []);
const node = useAppSelector((state) => selectTreeNode(state.feeds, nodeId));

if (!node) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ const useDragDropNode = (nodeMeta: NodeMeta) => {

const [relativeDropPosition, setRelativDropPosition] = useState<RelativeDragDropPosition | undefined>(undefined);

const selectDescendentNodeIds = useMemo(makeselectDescendentNodeIds, [draggedNode]);
const selectDescendentNodeIds = useMemo(() => makeselectDescendentNodeIds(), []);
const draggedNodeDescendents = useAppSelector((state) => selectDescendentNodeIds(state.feeds, draggedNode?.nodeId));

const isDropNotAllowed =
Expand Down
4 changes: 3 additions & 1 deletion src/utils/hooks/useNamedCallback.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@ import { DependencyList, useCallback, useDebugValue } from 'react';
// eslint-disable-next-line @typescript-eslint/ban-types
function useNamedCallback<T extends Function>(name: string, callback: T, deps: DependencyList): T {
useDebugValue(name);
return useCallback(callback, [...deps, callback]);
const array = [...deps];
// eslint-disable-next-line react-compiler/react-compiler
return useCallback(callback, [array, callback]);
}

export default useNamedCallback;
Loading

0 comments on commit afe093c

Please sign in to comment.