Skip to content
This repository was archived by the owner on Jan 16, 2022. It is now read-only.

Commit ae73772

Browse files
priscilawebdevsergiohgz
authored andcommitted
feat(eslint-config): add order rule in import
* refactor: added eslint-plugin-import * refactor: disable some rules for muiComponents * fix: fixed import
1 parent 950f6de commit ae73772

File tree

84 files changed

+149
-94
lines changed

Some content is hidden

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

84 files changed

+149
-94
lines changed

.eslintignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ coverage/
33
static/
44
.github/
55
.circleci/
6+
build
67
*.md
78
*.lock
89
*.yaml

.eslintrc

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@
55
"plugin:jest/recommended",
66
"plugin:prettier/recommended",
77
"plugin:verdaccio/recommended",
8-
"plugin:jsx-a11y/recommended"
8+
"plugin:jsx-a11y/recommended",
9+
"plugin:import/typescript"
910
],
1011
"plugins": [
1112
"react",
@@ -14,7 +15,8 @@
1415
"verdaccio",
1516
"jsx-a11y",
1617
"codeceptjs",
17-
"react-hooks"
18+
"react-hooks",
19+
"import"
1820
],
1921
"settings": {
2022
"react": {
@@ -28,6 +30,7 @@
2830
}
2931
},
3032
"rules": {
33+
"import/order": ["error", {"newlines-between": "always"}],
3134
"babel/no-invalid-this": 0,
3235
"no-invalid-this": 0,
3336
"no-console": ["error", { "allow": ["warn", "error"] }],

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@
4949
"enzyme-to-json": "3.4.0",
5050
"eslint": "6.5.1",
5151
"eslint-plugin-codeceptjs": "1.1.0",
52+
"eslint-plugin-import": "2.18.2",
5253
"eslint-plugin-jsx-a11y": "6.2.3",
5354
"eslint-plugin-prettier": "3.1.0",
5455
"eslint-plugin-react": "7.14.3",
@@ -148,7 +149,7 @@
148149
}
149150
],
150151
"scripts": {
151-
"type-check": "tsc --noEmit",
152+
"type-check": "tsc --noEmit --pretty",
152153
"type-check:watch": "npm run type-check -- --watch",
153154
"release": "standard-version -a",
154155
"test:clean": "npx jest --clearCache",

src/App/App.test.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
import React from 'react';
22
import { mount } from 'enzyme';
3-
import storage from '../utils/storage';
4-
import App from './App';
53

4+
import storage from '../utils/storage';
65
import { generateTokenWithTimeRange } from '../../jest/unit/components/__mocks__/token';
76

7+
import App from './App';
8+
89
jest.mock('../utils/storage', () => {
910
class LocalStorageMock {
1011
private store: object;

src/App/App.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import isNil from 'lodash/isNil';
33

44
import storage from '../utils/storage';
55
import { makeLogin, isTokenExpire } from '../utils/login';
6-
76
import Loading from '../components/Loading';
87
import LoginModal from '../components/Login';
98
import Header from '../components/Header';
@@ -14,7 +13,7 @@ import 'typeface-roboto/index.css';
1413
import '../utils/styles/global';
1514
import 'normalize.css';
1615
import Footer from '../components/Footer';
17-
import { FormError } from 'src/components/Login/Login';
16+
import { FormError } from '../components/Login/Login';
1817

1918
export const AppContext = React.createContext<{}>({});
2019
export const AppContextProvider = AppContext.Provider;

src/App/styles.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { css } from 'emotion';
2+
23
import colors from '../utils/styles/colors';
34

45
export const alertError = css({

src/components/ActionBar/ActionBar.test.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import React from 'react';
22
import { mount } from 'enzyme';
3+
34
import { ActionBar } from './ActionBar';
45

56
const mockPackageMeta: jest.Mock = jest.fn(() => ({

src/components/ActionBar/ActionBar.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
import React, { Component, ReactElement } from 'react';
2-
32
import BugReportIcon from '@material-ui/icons/BugReport';
43
import DownloadIcon from '@material-ui/icons/CloudDownload';
54
import HomeIcon from '@material-ui/icons/Home';
65
import List from '@material-ui/core/List';
76

87
import { DetailContextConsumer, VersionPageConsumerProps } from '../../pages/Version';
9-
import { Fab, ActionListItem } from './styles';
108
import { isURL, extractFileName, downloadFile } from '../../utils/url';
119
import api from '../../utils/api';
1210
import Tooltip from '../../muiComponents/Tooltip';
1311

12+
import { Fab, ActionListItem } from './styles';
13+
1414
export interface Action {
1515
icon: string;
1616
title: string;

src/components/Author/Author.tsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
11
import React, { FC, useContext } from 'react';
2-
32
import List from '@material-ui/core/List';
43

54
import { DetailContext } from '../../pages/Version';
6-
import { Heading, AuthorListItem, AuthorListItemText } from './styles';
75
import { isEmail } from '../../utils/url';
8-
96
import Avatar from '../../muiComponents/Avatar';
107

8+
import { Heading, AuthorListItem, AuthorListItemText } from './styles';
9+
1110
const Author: FC = () => {
1211
const { packageMeta } = useContext(DetailContext);
1312

src/components/Author/styles.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
import styled from 'react-emotion';
22
import ListItem from '@material-ui/core/ListItem';
33
import Typography from '@material-ui/core/Typography';
4-
import { fontWeight } from '../../utils/styles/sizes';
54
import ListItemText from '@material-ui/core/ListItemText';
65

6+
import { fontWeight } from '../../utils/styles/sizes';
7+
78
export const Heading = styled(Typography)({
89
'&&': {
910
fontWeight: fontWeight.bold,

0 commit comments

Comments
 (0)