Skip to content

Commit

Permalink
style[coral]: restrict page components to be only imported by router
Browse files Browse the repository at this point in the history
Resolves: #155
  • Loading branch information
SmuliS committed Oct 27, 2022
1 parent ef8e08a commit 27450f9
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
8 changes: 7 additions & 1 deletion coral/.eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,12 @@ module.exports = {
"rules": {
"no-relative-import-paths/no-relative-import-paths": [
"error"
]
],
"no-restricted-imports": ["error", {
"patterns": [{
"group": ["src/pages*"],
"message": "Pages should be only imported from '/src/router.tsx'"
}]
}]
}
}
2 changes: 2 additions & 0 deletions coral/src/router.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import { createBrowserRouter, Navigate, RouteObject } from "react-router-dom";
/* eslint-disable no-restricted-imports */
import HomePage from "src/pages";
import HelloPage from "src/pages/hello";
/* eslint-enable */

const routes: Array<RouteObject> = [
{
Expand Down

0 comments on commit 27450f9

Please sign in to comment.