From 040d25dbcc9ec46c4c21c945ccf02dcf1bf44c26 Mon Sep 17 00:00:00 2001 From: Michal Klobukowski Date: Wed, 13 Jun 2018 08:44:01 +0200 Subject: [PATCH] Set tslint semicolon rule and aply it to the project Feature #13590 Arvados-DCO-1.1-Signed-off-by: Michal Klobukowski --- src/components/api-token/api-token.tsx | 4 +-- src/components/breadcrumbs/breadcrumbs.tsx | 22 +++++++-------- .../dropdown-menu/dropdown-menu.tsx | 16 +++++------ src/components/main-app-bar/main-app-bar.tsx | 28 +++++++++---------- .../search-bar/search-bar.test.tsx | 4 +-- .../main-app-bar/search-bar/search-bar.tsx | 18 ++++++------ src/components/project-list/project-list.tsx | 2 +- src/components/project-tree/project-tree.tsx | 2 +- src/components/tree/tree.tsx | 6 ++-- src/services/auth-service/auth-service.ts | 4 +-- .../project-service/project-service.ts | 2 +- src/store/auth/auth-reducer.ts | 2 +- src/store/store.ts | 6 ++-- src/views/workbench/workbench.tsx | 12 ++++---- tslint.json | 3 +- 15 files changed, 66 insertions(+), 65 deletions(-) diff --git a/src/components/api-token/api-token.tsx b/src/components/api-token/api-token.tsx index 87da39b025..b6616d38bf 100644 --- a/src/components/api-token/api-token.tsx +++ b/src/components/api-token/api-token.tsx @@ -17,7 +17,7 @@ class ApiToken extends React.Component + return ; } } diff --git a/src/components/breadcrumbs/breadcrumbs.tsx b/src/components/breadcrumbs/breadcrumbs.tsx index 6c2d1fb22a..a3f9462e9a 100644 --- a/src/components/breadcrumbs/breadcrumbs.tsx +++ b/src/components/breadcrumbs/breadcrumbs.tsx @@ -8,15 +8,15 @@ import ChevronRightIcon from '@material-ui/icons/ChevronRight'; import { withStyles } from '@material-ui/core'; export interface Breadcrumb { - label: string + label: string; } interface BreadcrumbsDataProps { - items: Breadcrumb[] + items: Breadcrumb[]; } interface BreadcrumbsActionProps { - onClick: (breadcrumb: Breadcrumb) => any + onClick: (breadcrumb: Breadcrumb) => any; } type BreadcrumbsProps = BreadcrumbsDataProps & BreadcrumbsActionProps & WithStyles; @@ -51,29 +51,29 @@ class Breadcrumbs extends React.Component { )) } - + ; } getInactiveItems = () => { - return this.props.items.slice(0, -1) + return this.props.items.slice(0, -1); } getActiveItem = () => { - return this.props.items.slice(-1) + return this.props.items.slice(-1); } } -type CssRules = 'inactiveItem' +type CssRules = 'inactiveItem'; const styles: StyleRulesCallback = theme => { - const { unit } = theme.spacing + const { unit } = theme.spacing; return { inactiveItem: { opacity: 0.6 } - } -} + }; +}; -export default withStyles(styles)(Breadcrumbs) +export default withStyles(styles)(Breadcrumbs); diff --git a/src/components/main-app-bar/dropdown-menu/dropdown-menu.tsx b/src/components/main-app-bar/dropdown-menu/dropdown-menu.tsx index 34f9bf3f46..4ce2f596e5 100644 --- a/src/components/main-app-bar/dropdown-menu/dropdown-menu.tsx +++ b/src/components/main-app-bar/dropdown-menu/dropdown-menu.tsx @@ -8,8 +8,8 @@ import { PopoverOrigin } from '@material-ui/core/Popover'; interface DropdownMenuDataProps { - id: string, - icon: React.ComponentType, + id: string; + icon: React.ComponentType; } @@ -19,12 +19,12 @@ class DropdownMenu extends React.Component { state = { anchorEl: undefined - } + }; transformOrigin: PopoverOrigin = { vertical: "top", horizontal: "center" - } + }; render() { const { icon: Icon, id, children } = this.props; @@ -52,17 +52,17 @@ class DropdownMenu extends React.Component { {children} - ) + ); } handleClose = () => { - this.setState({ anchorEl: undefined }) + this.setState({ anchorEl: undefined }); } handleOpen = (event: React.MouseEvent) => { - this.setState({ anchorEl: event.currentTarget }) + this.setState({ anchorEl: event.currentTarget }); } } -export default DropdownMenu +export default DropdownMenu; diff --git a/src/components/main-app-bar/main-app-bar.tsx b/src/components/main-app-bar/main-app-bar.tsx index 7e0182e271..eb18fd1278 100644 --- a/src/components/main-app-bar/main-app-bar.tsx +++ b/src/components/main-app-bar/main-app-bar.tsx @@ -8,8 +8,8 @@ import NotificationsIcon from "@material-ui/icons/Notifications"; import PersonIcon from "@material-ui/icons/Person"; import HelpIcon from "@material-ui/icons/Help"; import SearchBar from "./search-bar/search-bar"; -import Breadcrumbs, { Breadcrumb } from "../breadcrumbs/breadcrumbs" -import DropdownMenu from "./dropdown-menu/dropdown-menu" +import Breadcrumbs, { Breadcrumb } from "../breadcrumbs/breadcrumbs"; +import DropdownMenu from "./dropdown-menu/dropdown-menu"; import { User } from "../../models/user"; export interface MainAppBarMenuItem { @@ -31,9 +31,9 @@ interface MainAppBarDataProps { } export interface MainAppBarActionProps { - onSearch: (searchText: string) => void, - onBreadcrumbClick: (breadcrumb: Breadcrumb) => void, - onMenuItemClick: (menuItem: MainAppBarMenuItem) => void + onSearch: (searchText: string) => void; + onBreadcrumbClick: (breadcrumb: Breadcrumb) => void; + onMenuItemClick: (menuItem: MainAppBarMenuItem) => void; } type MainAppBarProps = MainAppBarDataProps & MainAppBarActionProps & WithStyles; @@ -41,7 +41,7 @@ type MainAppBarProps = MainAppBarDataProps & MainAppBarActionProps & WithStyles< export class MainAppBar extends React.Component { render() { - const { classes, searchText, breadcrumbs, searchDebounce } = this.props + const { classes, searchText, breadcrumbs, searchDebounce } = this.props; return { } - + ; } renderMenuForUser = () => { - const { user } = this.props + const { user } = this.props; return ( <> @@ -94,19 +94,19 @@ export class MainAppBar extends React.Component { {this.renderMenuItems(this.props.menuItems.helpMenu)} - ) + ); } renderMenuForAnonymous = () => { return this.props.menuItems.anonymousMenu.map((item, index) => ( - )) + )); } renderMenuItems = (menuItems: MainAppBarMenuItem[]) => { return menuItems.map((item, index) => ( this.props.onMenuItemClick(item)}>{item.label} - )) + )); } getUserFullname = () => { @@ -116,12 +116,12 @@ export class MainAppBar extends React.Component { } -type CssRules = "appBar" +type CssRules = "appBar"; const styles: StyleRulesCallback = theme => ({ appBar: { backgroundColor: "#692498" } -}) +}); -export default withStyles(styles)(MainAppBar) \ No newline at end of file +export default withStyles(styles)(MainAppBar); \ No newline at end of file diff --git a/src/components/main-app-bar/search-bar/search-bar.test.tsx b/src/components/main-app-bar/search-bar/search-bar.test.tsx index eaadd1273d..2479e4011c 100644 --- a/src/components/main-app-bar/search-bar/search-bar.test.tsx +++ b/src/components/main-app-bar/search-bar/search-bar.test.tsx @@ -86,10 +86,10 @@ describe("", () => { jest.advanceTimersByTime(500); searchBar.find("input").simulate("change", { target: { value: "intermediate value" } }); jest.advanceTimersByTime(1000); - expect(onSearch).toBeCalledWith("intermediate value") + expect(onSearch).toBeCalledWith("intermediate value"); searchBar.find("input").simulate("change", { target: { value: "latest value" } }); jest.advanceTimersByTime(1000); - expect(onSearch).toBeCalledWith("latest value") + expect(onSearch).toBeCalledWith("latest value"); expect(onSearch).toHaveBeenCalledTimes(2); }); diff --git a/src/components/main-app-bar/search-bar/search-bar.tsx b/src/components/main-app-bar/search-bar/search-bar.tsx index 944eb426dc..f9e93d679c 100644 --- a/src/components/main-app-bar/search-bar/search-bar.tsx +++ b/src/components/main-app-bar/search-bar/search-bar.tsx @@ -15,7 +15,7 @@ interface SearchBarActionProps { debounce?: number; } -type SearchBarProps = SearchBarDataProps & SearchBarActionProps & WithStyles +type SearchBarProps = SearchBarDataProps & SearchBarActionProps & WithStyles; interface SearchBarState { value: string; @@ -27,12 +27,12 @@ class SearchBar extends React.Component { state: SearchBarState = { value: "" - } + }; timeout: NodeJS.Timer; render() { - const { classes } = this.props + const { classes } = this.props; return
{ -
+ ; } componentDidMount() { @@ -80,10 +80,10 @@ class SearchBar extends React.Component { } -type CssRules = 'container' | 'input' | 'button' +type CssRules = 'container' | 'input' | 'button'; const styles: StyleRulesCallback = theme => { - const { unit } = theme.spacing + const { unit } = theme.spacing; return { container: { position: 'relative', @@ -104,7 +104,7 @@ const styles: StyleRulesCallback = theme => { width: unit * 3, height: unit * 3 } - } -} + }; +}; -export default withStyles(styles)(SearchBar) \ No newline at end of file +export default withStyles(styles)(SearchBar); \ No newline at end of file diff --git a/src/components/project-list/project-list.tsx b/src/components/project-list/project-list.tsx index ec16a677f4..88cd0f7c2c 100644 --- a/src/components/project-list/project-list.tsx +++ b/src/components/project-list/project-list.tsx @@ -54,7 +54,7 @@ class ProjectList extends React.Component - + ; } } diff --git a/src/components/project-tree/project-tree.tsx b/src/components/project-tree/project-tree.tsx index 5243b5e7ee..43ad312a94 100644 --- a/src/components/project-tree/project-tree.tsx +++ b/src/components/project-tree/project-tree.tsx @@ -65,4 +65,4 @@ class ProjectTree extends React.Component { class Tree extends React.Component & WithStyles, {}> { renderArrow (items: boolean, arrowClass: string, open: boolean){ - return + return ; } render(): ReactElement { const level = this.props.level ? this.props.level : 0; @@ -67,9 +67,9 @@ class Tree extends React.Component & WithStyles, {}> { level={level + 1}/> } )} - + ; } } const StyledTree = withStyles(styles)(Tree); -export default StyledTree +export default StyledTree; diff --git a/src/services/auth-service/auth-service.ts b/src/services/auth-service/auth-service.ts index da593c2dfb..4e5013807f 100644 --- a/src/services/auth-service/auth-service.ts +++ b/src/services/auth-service/auth-service.ts @@ -70,8 +70,8 @@ export default class AuthService { .get('/users/current') .then(resp => { dispatch(actions.USER_DETAILS_SUCCESS(resp.data)); - }) + }); // .catch(err => { // }); - }; + } } diff --git a/src/services/project-service/project-service.ts b/src/services/project-service/project-service.ts index 9350dabdc4..939799d2dd 100644 --- a/src/services/project-service/project-service.ts +++ b/src/services/project-service/project-service.ts @@ -53,5 +53,5 @@ export default class ProjectService { dispatch(actions.PROJECTS_SUCCESS({projects, parentItemId: parentUuid})); return projects; }); - }; + } } diff --git a/src/store/auth/auth-reducer.ts b/src/store/auth/auth-reducer.ts index 57a17ae53c..3fd7044205 100644 --- a/src/store/auth/auth-reducer.ts +++ b/src/store/auth/auth-reducer.ts @@ -11,7 +11,7 @@ import { UserDetailsResponse } from "../../services/auth-service/auth-service"; export interface AuthState { user?: User; apiToken?: string; -}; +} const authReducer = (state: AuthState = {}, action: AuthAction) => { return actions.match(action, { diff --git a/src/store/store.ts b/src/store/store.ts index d541156e2d..499d89e82f 100644 --- a/src/store/store.ts +++ b/src/store/store.ts @@ -15,9 +15,9 @@ const composeEnhancers = compose; export interface RootState { - auth: AuthState, - projects: ProjectState, - router: RouterState + auth: AuthState; + projects: ProjectState; + router: RouterState; } const rootReducer = combineReducers({ diff --git a/src/views/workbench/workbench.tsx b/src/views/workbench/workbench.tsx index 3d0a7ad310..ef8e6bd428 100644 --- a/src/views/workbench/workbench.tsx +++ b/src/views/workbench/workbench.tsx @@ -25,7 +25,7 @@ import { RootState } from "../../store/store"; import MainAppBar, { MainAppBarActionProps, MainAppBarMenuItems, MainAppBarMenuItem } from '../../components/main-app-bar/main-app-bar'; import { Breadcrumb } from '../../components/breadcrumbs/breadcrumbs'; import { push } from 'react-router-redux'; -import projectActions from "../../store/project/project-action" +import projectActions from "../../store/project/project-action"; import ProjectTree from '../../components/project-tree/project-tree'; import { TreeItem } from "../../components/tree/tree"; import { Project } from "../../models/project"; @@ -76,11 +76,11 @@ interface WorkbenchActionProps { type WorkbenchProps = WorkbenchDataProps & WorkbenchActionProps & DispatchProp & WithStyles; interface NavBreadcrumb extends Breadcrumb { - path: string + path: string; } interface NavMenuItem extends MainAppBarMenuItem { - action: () => void + action: () => void; } interface WorkbenchState { @@ -131,7 +131,7 @@ class Workbench extends React.Component { } ] } - } + }; mainAppBarActions: MainAppBarActionProps = { @@ -141,13 +141,13 @@ class Workbench extends React.Component { this.props.dispatch(push(`/search?q=${searchText}`)); }, onMenuItemClick: (menuItem: NavMenuItem) => menuItem.action() - } + }; toggleProjectTreeItem = (itemId: string) => { this.props.dispatch(projectService.getProjectList(itemId)).then(() => { this.props.dispatch(projectActions.TOGGLE_PROJECT_TREE_ITEM(itemId)); }); - }; + } render() { const { classes, user } = this.props; diff --git a/tslint.json b/tslint.json index 1b26ab5f0f..4845e4d2c8 100644 --- a/tslint.json +++ b/tslint.json @@ -11,7 +11,8 @@ "jsx-no-lambda": false, "no-debugger": false, "no-console": false, - "no-shadowed-variable": false + "no-shadowed-variable": false, + "semicolon": true }, "linterOptions": { "exclude": [ -- 2.30.2