src/app/Routes.tsx
last analyzed

Complexity

Total Complexity 0
Complexity/F 0

Size

Lines of Code 47
Function Count 0

Duplication

Duplicated Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
wmc 0
eloc 37
mnd 0
bc 0
fnc 0
dl 0
loc 47
bpm 0
cpm 0
noi 13
c 0
b 0
f 0
1
import { Outlet, MakeGenerics, ReactLocation, Router } from 'react-location'
2
import { Main } from 'pages'
3
import { Header } from 'shared/ui'
4
import { ErrorBoundary } from 'entities/ErrorBoundary'
5
6
import { fetchMovieDetails } from 'pages/movie/model'
7
8
import { IMovieDetails } from 'types/common'
9
10
export type LocationGenerics = MakeGenerics<{
11
  LoaderData: { movie: IMovieDetails }
12
}>
13
14
const location = new ReactLocation<LocationGenerics>()
15
16
const Routes = () => (
0 ignored issues
show
introduced by
Function component is not a function declaration
Loading history...
17
  <>
0 ignored issues
show
introduced by
Fragments should contain more than one child - otherwise, there‘s no need for a Fragment at all.
Loading history...
introduced by
Expected indentation of 4 space characters but found 2.
Loading history...
introduced by
JSX not allowed in files with extension '.tsx'
Loading history...
18
    <Router
0 ignored issues
show
introduced by
Expected indentation of 6 space characters but found 4.
Loading history...
19
      location={location}
0 ignored issues
show
introduced by
Expected indentation of 8 space characters but found 6.
Loading history...
20
      routes={[
0 ignored issues
show
introduced by
Expected indentation of 8 space characters but found 6.
Loading history...
introduced by
JSX attribute values should not contain Arrays created in the same scope
Loading history...
21
        { path: '/', element: <Main /> },
22
        {
23
          path: 'movie',
24
          children: [
25
            {
26
              path: ':movieId',
27
              element: () => import('pages/movie').then(mod => <mod.default />),
0 ignored issues
show
introduced by
Declare this component outside parent component "Routes" or memoize it. If you want to allow component creation in props, set allowAsProps option to true.
Loading history...
28
              loader: async ({ params: { movieId } }) => {
29
                return {
30
                  movie: await fetchMovieDetails(Number(movieId)),
31
                }
32
              },
33
            },
34
          ],
35
        },
36
      ]}
37
    >
38
      <Header />
0 ignored issues
show
introduced by
Expected indentation of 8 space characters but found 6.
Loading history...
39
      <ErrorBoundary>
0 ignored issues
show
introduced by
Expected indentation of 8 space characters but found 6.
Loading history...
introduced by
JSX element should start in a new line
Loading history...
40
        <Outlet />
0 ignored issues
show
introduced by
Expected indentation of 10 space characters but found 8.
Loading history...
41
      </ErrorBoundary>
42
    </Router>
43
  </>
44
)
45
46
export { Routes }
47