1
0
mirror of https://github.com/mattermost/focalboard.git synced 2024-11-27 08:31:20 +02:00

Fix some linting issues

This commit is contained in:
Chen-I Lim 2020-10-22 09:46:06 -07:00
parent 84529f9c00
commit 9b19981e88
6 changed files with 30 additions and 25 deletions

View File

@ -1,5 +1,6 @@
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.
/* eslint-disable max-lines */
import React from 'react'
import {Archiver} from '../archiver'
@ -58,11 +59,11 @@ class BoardComponent extends React.Component<Props, State> {
}
}
componentDidMount() {
componentDidMount(): void {
document.addEventListener('keydown', this.keydownHandler)
}
componentWillUnmount() {
componentWillUnmount(): void {
document.removeEventListener('keydown', this.keydownHandler)
}
@ -76,13 +77,17 @@ class BoardComponent extends React.Component<Props, State> {
}
}
componentDidUpdate(prevPros: Props, prevState: State) {
shouldComponentUpdate(): boolean {
return true
}
componentDidUpdate(prevPros: Props, prevState: State): void {
if (this.state.isSearching && !prevState.isSearching) {
this.searchFieldRef.current.focus()
}
}
render() {
render(): JSX.Element {
const {boardTree, showView} = this.props
if (!boardTree || !boardTree.board) {
@ -92,7 +97,7 @@ class BoardComponent extends React.Component<Props, State> {
}
const propertyValues = boardTree.groupByProperty?.options || []
console.log(`${propertyValues.length} propertyValues`)
Utils.log(`${propertyValues.length} propertyValues`)
const groupByStyle = {color: '#000000'}
const {board, activeView} = boardTree
@ -204,7 +209,7 @@ class BoardComponent extends React.Component<Props, State> {
Group by <span
style={groupByStyle}
id='groupByLabel'
>{boardTree.groupByProperty?.name}</span>
>{boardTree.groupByProperty?.name}</span>
</div>
<div
className={hasFilter ? 'octo-button active' : 'octo-button'}
@ -432,7 +437,7 @@ class BoardComponent extends React.Component<Props, State> {
}
}
async addCard(groupByValue?: string) {
async addCard(groupByValue?: string): Promise<void> {
const {boardTree} = this.props
const {activeView, board} = boardTree
@ -450,7 +455,7 @@ class BoardComponent extends React.Component<Props, State> {
})
}
async propertyNameChanged(option: IPropertyOption, text: string) {
async propertyNameChanged(option: IPropertyOption, text: string): Promise<void> {
const {boardTree} = this.props
await mutator.changePropertyOptionValue(boardTree, boardTree.groupByProperty, option, text)
@ -567,8 +572,9 @@ class BoardComponent extends React.Component<Props, State> {
OldMenu.shared.showAtElement(e.target as HTMLElement)
}
private cardClicked(e: React.MouseEvent, card: Card) {
private cardClicked(e: React.MouseEvent, card: Card): void {
if (e.shiftKey) {
// Shift+Click = add to selection
let selectedCards = this.state.selectedCards.slice()
if (selectedCards.includes(card)) {
selectedCards = selectedCards.filter((o) => o != card)
@ -584,7 +590,7 @@ class BoardComponent extends React.Component<Props, State> {
}
async addGroupClicked() {
console.log('onAddGroupClicked')
Utils.log('onAddGroupClicked')
const {boardTree} = this.props

View File

@ -86,7 +86,7 @@ export default class CardDetail extends React.Component<Props, State> {
return (<div
key={block.id}
className='octo-block octo-hover-container'
>
>
<div className='octo-block-margin'>
<div
className='octo-button octo-hovercontrol square octo-hover-item'
@ -111,7 +111,7 @@ export default class CardDetail extends React.Component<Props, State> {
return (<div
key={block.id}
className='octo-block octo-hover-container'
>
>
<div className='octo-block-margin'>
<div
className='octo-button octo-hovercontrol square octo-hover-item'
@ -288,7 +288,7 @@ export default class CardDetail extends React.Component<Props, State> {
onMouseLeave={() => {
optionsButtonRef.current.style.display = 'none'
}}
>
>
<div className='comment-header'>
<img
className='comment-avatar'
@ -342,7 +342,7 @@ export default class CardDetail extends React.Component<Props, State> {
style={{display: 'none'}}
onClick={(e) => {
const text = newCommentRef.current.text
console.log(`Send comment: ${newCommentRef.current.text}`)
Utils.log(`Send comment: ${newCommentRef.current.text}`)
this.sendComment(text)
newCommentRef.current.text = undefined
newCommentRef.current.blur()

View File

@ -1,6 +1,6 @@
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.
import React, {ReactNode} from 'react'
import React from 'react'
import {Archiver} from '../archiver'
import {Board, MutableBoard} from '../blocks/board'
@ -32,7 +32,7 @@ class Sidebar extends React.Component<Props, State> {
return true
}
render(): ReactNode {
render(): JSX.Element {
const {workspaceTree} = this.props
if (!workspaceTree) {
return <div/>
@ -118,7 +118,7 @@ class Sidebar extends React.Component<Props, State> {
return (<div
key={view.id}
className='octo-sidebar-item subitem octo-hover-container'
>
>
<div
className='octo-sidebar-title'
onClick={() => {

View File

@ -1,7 +1,6 @@
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.
import {IMutableBlock} from './blocks/block'
import {IBlock} from './blocks/block'
import {IBlock, IMutableBlock} from './blocks/block'
import {Utils} from './utils'
//
@ -12,7 +11,7 @@ class OctoClient {
constructor(serverUrl?: string) {
this.serverUrl = serverUrl || window.location.origin
console.log(`OctoClient serverUrl: ${this.serverUrl}`)
Utils.log(`OctoClient serverUrl: ${this.serverUrl}`)
}
async getSubtree(rootId?: string): Promise<IBlock[]> {
@ -109,7 +108,7 @@ class OctoClient {
}
async deleteBlock(blockId: string): Promise<Response> {
console.log(`deleteBlock: ${blockId}`)
Utils.log(`deleteBlock: ${blockId}`)
return await fetch(this.serverUrl + `/api/v1/blocks/${encodeURIComponent(blockId)}`, {
method: 'DELETE',
headers: {

View File

@ -2,6 +2,8 @@
// See LICENSE.txt for license information.
import React from 'react'
import {Utils} from '../utils'
import Button from '../components/button'
import './loginPage.scss'
@ -20,7 +22,7 @@ export default class LoginPage extends React.Component<Props, State> {
}
handleLogin = () => {
console.log('Logging in')
Utils.log('Logging in')
}
render(): React.ReactNode {

View File

@ -123,9 +123,7 @@ class Utils {
// favicon
static setFavicon(icon?: string): void {
const href = icon ?
`data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><text y=".9em" font-size="90">${icon}</text></svg>` :
''
const href = icon ? `data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><text y=".9em" font-size="90">${icon}</text></svg>` : ''
const link = (document.querySelector("link[rel*='icon']") || document.createElement('link')) as HTMLLinkElement
link.type = 'image/x-icon'
link.rel = 'shortcut icon'