Skip to content

Commit

Permalink
ESLint to enforce Actual's useNavigate hook
Browse files Browse the repository at this point in the history
  • Loading branch information
joel-jeremy committed Jan 9, 2024
1 parent 1a6db82 commit 9cd7087
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
20 changes: 20 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,26 @@ module.exports = {
],
},
},
{
files: ['./packages/desktop-client/**/*'],
excludedFiles: [
'./packages/desktop-client/src/hooks/useNavigate.{ts,tsx}',
],
rules: {
'no-restricted-imports': [
'warn',
{
patterns: [
{
group: ['react-router-dom'],
importNames: ['useNavigate'],
message: 'Please use Actual’s useNavigate() hook instead.',
},
],
},
],
},
},
{
files: ['./packages/loot-core/src/**/*'],
rules: {
Expand Down
2 changes: 1 addition & 1 deletion packages/desktop-client/src/components/FinancesApp.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import {
Route,
Routes,
Navigate,
useNavigate,
BrowserRouter,
useLocation,
useHref,
Expand All @@ -20,6 +19,7 @@ import { checkForUpdateNotification } from 'loot-core/src/client/update-notifica
import * as undo from 'loot-core/src/platform/client/undo';

import { useActions } from '../hooks/useActions';
import { useNavigate } from '../hooks/useNavigate';
import { useResponsive } from '../ResponsiveProvider';
import { theme } from '../style';
import { ExposeNavigate } from '../util/router-tools';
Expand Down

0 comments on commit 9cd7087

Please sign in to comment.