Skip to content

Commit

Permalink
ESLint to enforce Actual's useNavigate hook (actualbudget#2208)
Browse files Browse the repository at this point in the history
* ESLint to enforce Actual's useNavigate hook

* Release notes

---------

Co-authored-by: Matiss Janis Aboltins <[email protected]>
  • Loading branch information
joel-jeremy and MatissJanis authored Jan 9, 2024
1 parent 9fc2486 commit b960da8
Show file tree
Hide file tree
Showing 3 changed files with 27 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
6 changes: 6 additions & 0 deletions upcoming-release-notes/2208.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
category: Maintenance
authors: [joel-jeremy]
---

ESLint to enforce Actual's useNavigate hook

0 comments on commit b960da8

Please sign in to comment.