Skip to content

Commit eab1a03

Browse files
committed
refactor(imports): switched to absolute paths import
1 parent 393b843 commit eab1a03

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+91
-94
lines changed

.eslintrc.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ module.exports = {
2626
},
2727
'import/resolver': {
2828
node: {
29+
paths: ['src'],
2930
extensions: ['.tsx', '.ts', '.js', '.json'],
3031
},
3132
alias: [

.storybook/preview.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
/* eslint-disable */
22

33
import { Provider } from 'react-redux'
4-
import { history, store } from '../src/store/store'
4+
import { history, store } from 'store/store'
55
import { HistoryRouter as Router } from 'redux-first-history/rr6'
66
import React from 'react'
77

8-
import i18n from '../src/config/i18n'
8+
import i18n from 'config/i18n'
99

1010
export const parameters = {
1111
actions: { argTypesRegex: '^on[A-Z].*' },

README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,12 @@ To enforce conventional commit format on git messages, run below command to use
9797
npx husky add .husky/commit-msg 'npx --no -- commitlint --edit "$1"'
9898
```
9999

100+
## Intelij
101+
102+
### Absolute imports
103+
104+
In Settings | Editor | Code Style | TypeScript | Imports, enable Use paths relative to tsconfig.json.
105+
100106
## Release
101107

102108
[//]: # 'TODO: add readme for release via Standard Version'

src/App.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@ import React from 'react'
22
import { Provider } from 'react-redux'
33
import { HistoryRouter as Router } from 'redux-first-history/rr6'
44

5-
import './App.css'
6-
import AppRoutes from './routes'
7-
import { history, store } from './store/store'
5+
import 'App.css'
6+
import AppRoutes from 'routes'
7+
import { history, store } from 'store/store'
88

99
const App = () => (
1010
<>

src/components/Layout/index.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,10 @@ import React from 'react'
55
import { useTranslation } from 'react-i18next'
66
import { Outlet } from 'react-router-dom'
77

8-
import Header from '../Header/Header'
8+
import Header from 'components/Header/Header'
99

1010
const Layout = () => {
1111
const [mode, setMode] = React.useState<'light' | 'dark'>('light')
12-
1312
const { i18n } = useTranslation()
1413

1514
// TODO: move state to redux

src/config/i18n/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import i18n from 'i18next'
22
import { initReactI18next } from 'react-i18next'
33

4-
import en from './locales/en.translation.json'
5-
import pl from './locales/pl.translation.json'
4+
import en from 'config/i18n/locales/en.translation.json'
5+
import pl from 'config/i18n/locales/pl.translation.json'
66

77
i18n.use(initReactI18next).init({
88
lng: 'en',

src/features/posts/api/__tests__/post.api.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import fixture from '../../../../test/server/db.initial.data.json'
2-
import { getPosts } from '../index'
1+
import { getPosts } from 'features/posts/api/index'
2+
import fixture from 'test/server/db.initial.data.json'
33

44
describe('Post API test - MSW example', () => {
55
it('should fetch all Posts', async () => {

src/features/posts/api/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/* eslint-disable @typescript-eslint/no-explicit-any */
2-
import { Env } from '../../../config/Env'
3-
import { Post } from '../types'
2+
import { Env } from 'config/Env'
3+
import { Post } from 'features/posts/types'
44

55
const POSTS_BASE_URL = `${Env.API_BASE_URL}/posts`
66

src/features/posts/components/PostCardView.stories.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { Container } from '@mui/material'
22
import { ComponentMeta, ComponentStory } from '@storybook/react'
33
import React from 'react'
44

5-
import { PostCardView } from '../index'
5+
import { PostCardView } from 'features/posts/components/PostCardView'
66

77
export default {
88
title: 'features/components/posts/PostCardView',

src/features/posts/components/PostCardView.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ import Typography from '@mui/material/Typography'
33
import React from 'react'
44
import { useTranslation } from 'react-i18next'
55

6-
import logoImage from '../assets/imgs/logo192.png'
7-
import { Post } from '../types'
6+
import logoImage from 'features/posts/assets/imgs/logo192.png'
7+
import { Post } from 'features/posts/types'
88

99
export type PostCardViewProps = {
1010
post: Post

0 commit comments

Comments
 (0)