Skip to content

Commit 8f531c6

Browse files
authored
Merge pull request #43 from swiftss-org/feat/improve_eslint
Feat/improve eslint
2 parents 33ddfb8 + 3d028e4 commit 8f531c6

29 files changed

+427
-90
lines changed

.eslintrc.json

Lines changed: 57 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,16 @@
11
{
2-
"extends": ["eslint:recommended", "plugin:@typescript-eslint/recommended", "prettier"],
3-
"plugins": ["react", "@typescript-eslint", "react-hooks"],
4-
2+
"extends": [
3+
"eslint:recommended",
4+
"plugin:@typescript-eslint/recommended",
5+
"prettier"
6+
],
7+
"plugins": [
8+
"react",
9+
"@typescript-eslint",
10+
"react-hooks",
11+
"import",
12+
"better-styled-components"
13+
],
514
"env": {
615
"node": true,
716
"browser": true,
@@ -10,11 +19,54 @@
1019
"es6": true
1120
},
1221
"rules": {
22+
"better-styled-components/sort-declarations-alphabetically": 2,
23+
"import/order": [
24+
"error",
25+
{
26+
"groups": [
27+
"builtin",
28+
"external",
29+
[
30+
"internal",
31+
"parent",
32+
"sibling",
33+
"index",
34+
"object"
35+
]
36+
],
37+
"pathGroups": [
38+
{
39+
"pattern": "react",
40+
"group": "external",
41+
"position": "before"
42+
},
43+
{
44+
"pattern": "src/**",
45+
"group": "internal"
46+
},
47+
{
48+
"pattern": "theme/**",
49+
"group": "internal"
50+
}
51+
],
52+
"pathGroupsExcludedImportTypes": [
53+
"react"
54+
],
55+
"alphabetize": {
56+
"order": "asc",
57+
"caseInsensitive": true
58+
},
59+
"newlines-between": "always"
60+
}
61+
],
1362
"@typescript-eslint/naming-convention": [
1463
"error",
1564
{
1665
"selector": "typeLike",
17-
"format": ["PascalCase", "UPPER_CASE"]
66+
"format": [
67+
"PascalCase",
68+
"UPPER_CASE"
69+
]
1870
}
1971
],
2072
"react-hooks/rules-of-hooks": "error",
@@ -23,6 +75,7 @@
2375
"no-unused-expressions": "off",
2476
"@typescript-eslint/no-unused-expressions": "error",
2577
"no-unused-vars": "off",
78+
"@typescript-eslint/explicit-module-boundary-types": 0,
2679
"@typescript-eslint/no-unused-vars": [
2780
"error",
2881
{

package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,8 @@
7373
"babel-plugin-styled-components": "^1.12.0",
7474
"cross-env": "^7.0.3",
7575
"eslint-config-prettier": "^7.2.0",
76+
"eslint-plugin-better-styled-components": "^1.1.2",
77+
"eslint-plugin-import": "^2.23.4",
7678
"husky": "^6.0.0",
7779
"lint-staged": "^10.5.4",
7880
"prettier": "^2.2.1",

src/App.style.ts

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,22 +3,22 @@ import styled from '@emotion/styled';
33
import theme from 'theme/globals';
44

55
export const AppWrapper = styled.div`
6-
width: 100%;
7-
height: calc(100vh);
86
background-color: ${theme.defaultBackgroundColor};
9-
font-family: ${theme.fontFamily};
107
color: ${theme.defaultTextColor};
11-
position: relative;
8+
font-family: ${theme.fontFamily};
9+
height: calc(100vh);
1210
overflow: hidden;
11+
position: relative;
12+
width: 100%;
1313
`;
1414

1515
export const TopBar = styled.div`
16-
width: 100%;
17-
position: sticky;
18-
display: flex;
19-
flex-direction: row;
2016
align-items: center;
17+
border-bottom: 1px black solid;
2118
color: black;
19+
display: flex;
20+
flex-direction: row;
2221
font-weight: 700;
23-
border-bottom: 1px black solid;
22+
position: sticky;
23+
width: 100%;
2424
`;

src/App.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
import React from 'react';
2-
import { BrowserRouter as Router } from 'react-router-dom';
2+
33
import { ThemeProvider } from '@orfium/ictinus';
44
import { QueryClient, QueryClientProvider } from 'react-query';
5+
import { BrowserRouter as Router } from 'react-router-dom';
6+
57

6-
import theme from 'theme/globals';
78
import { AppWrapper } from './App.style';
89
import Routes from './routing/Routes';
10+
import theme from 'theme/globals';
911

1012
const queryClient = new QueryClient();
1113

src/api/userAPI/userAPI.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/* eslint-disable @typescript-eslint/explicit-module-boundary-types */
2-
import { METHODS, request } from '../axiosInstances';
32
import { LoginResponse } from '../../models/apiTypes';
3+
import { METHODS, request } from '../axiosInstances';
44

55
export default {
66
signIn: (params: LoginResponse) => request(METHODS.POST, '/sign-in/', { params }),

src/common.style.tsx

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1+
import { css } from '@emotion/react';
12
import styled from '@emotion/styled';
23
import { grid } from '@orfium/ictinus/dist/theme/functions';
4+
35
import { flex } from './theme/functions';
4-
import { css } from '@emotion/react';
56

67
export const PageWrapper = styled.div`
78
${flex};
@@ -44,26 +45,26 @@ export const CheckBoxContainer = styled.div<{ error?: boolean; checked?: boolean
4445

4546
export const FieldsContainer = styled.div<{ withMargin?: boolean }>`
4647
${grid};
47-
grid-template-columns: 1fr 1fr;
4848
column-gap: 38px;
49-
row-gap: 24px;
49+
grid-template-columns: 1fr 1fr;
5050
margin-bottom: ${(props) => (props.withMargin ? '24px' : null)};
51+
row-gap: 24px;
5152
`;
5253

5354
export const LongFieldWrapper = styled.div`
5455
grid-column: 1 / 3;
5556
`;
5657

5758
export const FieldWrapper = styled.div`
58-
width: 100%;
5959
box-sizing: border-box;
60+
width: 100%;
6061
`;
6162

6263
export const RadioText = styled.span`
63-
min-height: 48px;
64-
display: inline-flex;
6564
align-items: center;
65+
display: inline-flex;
6666
margin-left: 8px;
67+
min-height: 48px;
6768
`;
6869

6970
// eslint-disable-next-line @typescript-eslint/ban-ts-comment

src/hooks/api/userHooks.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
/* eslint-disable @typescript-eslint/explicit-module-boundary-types */
2+
import { AxiosError } from 'axios';
23
import { useMutation } from 'react-query';
34
import { useHistory } from 'react-router-dom';
4-
import { AxiosError } from 'axios';
5+
import { __TOKEN__ } from 'utils/constants';
56

6-
import { LoginFormType, LoginResponse } from '../../models/apiTypes';
7-
import userAPI from '../../api/userAPI';
87
import { setAxiosToken } from '../../api/axiosInstances';
9-
import { __TOKEN__ } from 'utils/constants';
8+
import userAPI from '../../api/userAPI';
9+
import { LoginFormType, LoginResponse } from '../../models/apiTypes';
10+
import urls from '../../routing/urls';
1011
import { setUserStorageItem } from '../../utils/storage';
1112

12-
import urls from '../../routing/urls';
1313

1414
export const useSignIn = () => {
1515
const history = useHistory();

src/hooks/useResponsiveSidebar.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { useEffect, useState } from 'react';
2+
23
import useBreakpoints from '@orfium/ictinus/dist/hooks/useBreakpoints';
34

45
export const useResponsiveLayout = () => {

src/index.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
import React from 'react';
2+
23
import ReactDOM from 'react-dom';
34

45
import './index.css';
5-
import App from './App';
66
import { setAxiosToken } from './api/axiosInstances';
7-
import { getUserStorageItem } from './utils/storage';
7+
import App from './App';
88
import { __TOKEN__ } from './utils/constants';
9+
import { getUserStorageItem } from './utils/storage';
910

1011
const token = getUserStorageItem(__TOKEN__);
1112
if (token) {

src/pages/Layout/Layout.style.ts

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
import styled from '@emotion/styled';
22
import { flexCenter } from '@orfium/ictinus/dist/theme/functions';
33

4-
import { flex } from 'theme/functions';
4+
55
import { scrollBar } from '../../common.style';
66
import { ResponsiveProps } from '../types';
7+
import { flex } from 'theme/functions';
78

89
const SIDEBAR_WIDTH_COLLAPSED = 110;
910

@@ -28,31 +29,31 @@ export const Main = styled.main`
2829
grid-area: main;
2930
${scrollBar};
3031
31-
overflow-y: auto;
3232
overflow-x: hidden;
33+
overflow-y: auto;
3334
3435
${flex}
3536
`;
3637

3738
export const MainContainer = styled.div<ResponsiveProps>`
3839
display: grid;
39-
grid-template-columns: ${getWidth}px 1fr;
40-
grid-template-rows: 0fr;
4140
grid-template-areas:
4241
'header header'
4342
'sidebar main'
4443
'sidebar main';
44+
grid-template-columns: ${getWidth}px 1fr;
45+
grid-template-rows: 0fr;
4546
height: 100vh;
4647
transition: all 0.5s ease-in-out 0s;
4748
`;
4849

4950
export const Header = styled.header`
50-
width: 100%;
5151
grid-area: header;
52+
width: 100%;
5253
z-index: 120;
5354
& > div > div:nth-of-type(2) {
54-
flex: 1;
5555
display: flex;
56+
flex: 1;
5657
justify-content: flex-end;
5758
}
5859
`;

0 commit comments

Comments
 (0)