Skip to content
Permalink
Browse files
eslintを適用
  • Loading branch information
parrot-studio committed Jun 28, 2020
1 parent 8c8a1be commit 749ce559c70a291cd2c526a78b436fe82dadceec
Showing 40 changed files with 93 additions and 58 deletions.
@@ -1,7 +1,7 @@
declare var window
declare var document
declare var history
declare var $
declare let window
declare let document
declare let history
declare let $

// ブラウザ代理オブジェクト(クライアント)
export default class Browser {
@@ -59,7 +59,8 @@ export default class Browser {
})
}

public static addDropHandler(div: HTMLDivElement, code: string, callback): void {
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
public static addDropHandler(div: HTMLLIElement | HTMLDivElement | null, code: string, callback): void {
if (!div) {
return
}
@@ -72,6 +73,7 @@ export default class Browser {
})
}

// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
public static addSwipeHandler(div: HTMLDivElement, callbackLeft, callbackRight): void {
if (!div) {
return
@@ -89,7 +91,8 @@ export default class Browser {
})
}

public static addSwitchHandler(div: HTMLDivElement, state: boolean, callback, params: any): void {
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
public static addSwitchHandler(div: HTMLDivElement, state: boolean, callback, params): void {
if (!div) {
return
}
@@ -5,9 +5,9 @@ import FastClick from "fastclick"
import AppView from "./ccpts/components/AppView"
import Browser from "./ccpts/lib/BrowserProxy"

declare var document
declare var window
declare var FastClick
declare let document
declare let window
declare let FastClick

document.addEventListener("DOMContentLoaded", () => {
// init
@@ -1,3 +1,4 @@
/* eslint-disable @typescript-eslint/no-explicit-any */
import * as _ from "lodash"
import * as React from "react"
import { Alert, Modal } from "react-bootstrap"
@@ -29,7 +29,7 @@ export default class ArcanaViewModal extends React.Component<ArcanaViewModalProp
}
}

private addFavHandler(inp: HTMLElement | null, a: Arcana): void {
private addFavHandler(inp: HTMLDivElement | null, a: Arcana): void {
if (!inp) {
return
}
@@ -420,7 +420,7 @@ export default class ArcanaViewModal extends React.Component<ArcanaViewModalProp
const small = [this.renderNoramlDetail(a)]
const normal = [
(
<Tab eventKey="normal" title="通常アビリティ" tabClassName="small">
<Tab eventKey="normal" key="normal" title="通常アビリティ" tabClassName="small">
{this.renderNoramlDetail(a)}
</Tab>
)
@@ -58,7 +58,7 @@ export default class ConditionView extends React.Component<ConditionViewProps, C

private notifier: Bacon.Bus<QueryParam>

constructor(props) {
constructor(props: Readonly<ConditionViewProps>) {
super(props)
let q = {}
if (this.props.query) {
@@ -1,4 +1,3 @@
import * as _ from "lodash"
import * as React from "react"
import { Alert } from "react-bootstrap"
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"
@@ -25,7 +24,7 @@ export default class LatestInfoArea extends React.Component<LatestInfoAreaProps,
let visible = false
if (this.props.latestInfo) {
const ver = String(this.props.latestInfo.version) || ""
const cs: any = {}
const cs = {}
cs[LatestInfoArea.COOKIE_NAME] = ver
Cookie.set(cs)
visible = true
@@ -8,11 +8,13 @@ interface NameSearchFormState {
name: string
}

// eslint-disable-next-line @typescript-eslint/ban-types
export default class NameSearchForm extends React.Component<{}, NameSearchFormState> {

private nameStream: Bacon.Bus<QueryParam> = new Bacon.Bus()

constructor(props) {
// eslint-disable-next-line @typescript-eslint/ban-types
constructor(props: Readonly<{}>) {
super(props)

this.state = {
@@ -1,4 +1,3 @@
import * as _ from "lodash"
import * as React from "react"
import { Nav, NavItem } from "react-bootstrap"

@@ -11,6 +11,7 @@ interface PagerAreaProps {

export default class PagerArea extends React.Component<PagerAreaProps> {

// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
public render() {
const pager = this.props.pager

@@ -1,3 +1,4 @@
/* eslint-disable react/prop-types */
import * as React from "react"
import { Pagination } from "react-bootstrap"
import { createUltimatePagination, ITEM_TYPES } from "react-ultimate-pagination"
@@ -8,6 +8,7 @@ import QueryResult from "../../model/QueryResult"

export interface ResultViewProps {
pagerSize: number
// eslint-disable-next-line @typescript-eslint/no-explicit-any
firstResults: any
}

@@ -14,9 +14,11 @@ interface SearchMenuButtonState {
querys: Query[]
}

// eslint-disable-next-line @typescript-eslint/ban-types
export default class SearchMenuButton extends React.Component<{}, SearchMenuButtonState> {

constructor(props) {
// eslint-disable-next-line @typescript-eslint/ban-types
constructor(props: Readonly<{}>) {
super(props)
this.state = {
querys: QueryRepository.querys
@@ -19,7 +19,7 @@ interface DatabaseAreaHeaderState {

export default class DatabaseAreaHeader extends React.Component<DatabaseAreaHeaderProps, DatabaseAreaHeaderState> {

constructor(props) {
constructor(props: Readonly<DatabaseAreaHeaderProps>) {
super(props)
this.state = {
showShareModal: false,
@@ -16,6 +16,7 @@ interface DatabaseModeViewProps {
pagerSize: number
latestInfo: LatestInfo | null
firstQuery: Query | null
// eslint-disable-next-line @typescript-eslint/no-explicit-any
firstResults: any
switchConditionMode(): void
}
@@ -27,7 +28,7 @@ interface DatabaseModeViewState {

export default class DatabaseModeView extends React.Component<DatabaseModeViewProps, DatabaseModeViewState> {

constructor(props) {
constructor(props: Readonly<DatabaseModeViewProps>) {
super(props)

let showHeader = true
@@ -29,7 +29,7 @@ export default abstract class ArcanaRenderer<T, S> extends React.Component<T, S>
}
}

protected isSameArcana(ba: Arcana | null, na: Arcana | null) {
protected isSameArcana(ba: Arcana | null, na: Arcana | null): boolean {
if (ba == null && na == null) {
return true
}
@@ -40,12 +40,13 @@ export default abstract class ArcanaRenderer<T, S> extends React.Component<T, S>
return false
}

// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
protected openArcanaViewModal(a: Arcana, e): void {
e.preventDefault()
MessageStream.arcanaViewStream.push(a)
}

protected setDraggable(code: string, memkey?: string | null) {
protected setDraggable(code: string, memkey?: string | null): void {
if (!this.div) {
return
}
@@ -1,7 +1,7 @@
/* eslint-disable @typescript-eslint/no-explicit-any */
import * as _ from "lodash"
import * as React from "react"

import Arcana from "../../model/Arcana"
import Party from "../../model/Party"
import PartyRepositroy, { PartyLog } from "../../model/PartyRepositroy"
import LatestInfo from "../../model/LatestInfo"
@@ -49,7 +49,7 @@ export default class EditModeView extends React.Component<EditModeViewProps, Edi
private editArea: HTMLDivElement | null = null
private partyArea: HTMLDivElement | null = null

constructor(props) {
constructor(props: Readonly<EditModeViewProps>) {
super(props)

Party.ptver = this.props.ptver
@@ -7,9 +7,11 @@ interface EditTutorialAreaState {
visible: boolean
}

// eslint-disable-next-line @typescript-eslint/ban-types
export default class EditTutorialArea extends React.Component<{}, EditTutorialAreaState> {

constructor(props) {
// eslint-disable-next-line @typescript-eslint/ban-types
constructor(props: Readonly<{}>) {
super(props)
Cookie.set({ tutorial: true })
this.state = { visible: true }
@@ -14,6 +14,7 @@ import Browser from "../../lib/BrowserProxy"

interface MemberAreaBodyProps {
party: Party
// eslint-disable-next-line @typescript-eslint/no-explicit-any
heroes: any[]
}

@@ -26,7 +27,7 @@ interface MemberAreaBodyState {

export default class MemberAreaBody extends React.Component<MemberAreaBodyProps, MemberAreaBodyState> {

constructor(props) {
constructor(props: Readonly<MemberAreaBodyProps>) {
super(props)

this.state = {
@@ -63,7 +64,7 @@ export default class MemberAreaBody extends React.Component<MemberAreaBodyProps,
)
}

private addDropHandler(div: HTMLLIElement | null, code: string): void {
private addDropHandler(div: HTMLLIElement | HTMLDivElement | null, code: string): void {
if (!div) {
return
}
@@ -23,7 +23,7 @@ interface MemberAreaHeaderState {

export default class MemberAreaHeader extends React.Component<MemberAreaHeaderProps, MemberAreaHeaderState> {

constructor(props) {
constructor(props: Readonly<MemberAreaHeaderProps>) {
super(props)

this.state = {
@@ -26,7 +26,7 @@ interface MemberControlAreaState {

export default class MemberControlArea extends React.Component<MemberControlAreaProps, MemberControlAreaState> {

constructor(props) {
constructor(props: Readonly<MemberControlAreaProps>) {
super(props)

this.state = {
@@ -1,4 +1,3 @@
import * as _ from "lodash"
import * as React from "react"

import Member from "../../model/Member"
@@ -9,13 +8,14 @@ export interface MemberRendererProps {
member: Member | null
}

// eslint-disable-next-line @typescript-eslint/ban-types
export abstract class MemberRenderer<T extends MemberRendererProps> extends ArcanaRenderer<T, {}> {

public shouldComponentUpdate(nextProps: T): boolean {
return !this.isSameMember(this.props.member, nextProps.member)
}

protected isSameMember(bm: Member | null, nm: Member | null) {
protected isSameMember(bm: Member | null, nm: Member | null): boolean {
if (bm == null && nm == null) {
return true
}
@@ -19,7 +19,7 @@ interface TargetArcanaState {

export default class TargetArcana extends ArcanaRenderer<TargetArcanaProps, TargetArcanaState> {

constructor(props) {
constructor(props: Readonly<TargetArcanaProps>) {
super(props)

const code = this.props.arcana.jobCode
@@ -37,7 +37,7 @@ export default class TargetArcana extends ArcanaRenderer<TargetArcanaProps, Targ
})
}

public shouldComponentUpdate(nextProps): boolean {
public shouldComponentUpdate(nextProps: { arcana: Arcana | null }): boolean {
return !this.isSameArcana(this.props.arcana, nextProps.arcana)
}

@@ -1,4 +1,5 @@
declare var window
// eslint-disable-next-line @typescript-eslint/no-explicit-any
declare let window: any

// NOTE: SSRするなら切り離す
import Browser from "../../browser"
@@ -54,7 +55,7 @@ export default class BrowserProxy {
}
}

public static fadeIn(el): void {
public static fadeIn(el: HTMLDivElement): void {
if (!el) {
return
}
@@ -63,15 +64,15 @@ export default class BrowserProxy {
el.style.display = ""
}

public static show(el): void {
public static show(el: HTMLDivElement): void {
if (!el) {
return
}
el.classList.remove("hide")
el.style.display = ""
}

public static hide(el): void {
public static hide(el: HTMLDivElement): void {
if (!el) {
return
}
@@ -80,13 +81,14 @@ export default class BrowserProxy {
el.style.display = ""
}

public static setDraggable(div, code: string, memkey?: string | null): void {
public static setDraggable(div: HTMLDivElement, code: string, memkey?: string | null): void {
if (BrowserProxy.isWindowDefined) {
Browser.setDraggable(div, code, memkey)
}
}

public static addDropHandler(div, code: string, callback): void {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
public static addDropHandler(div: HTMLLIElement | HTMLDivElement | null, code: string, callback: (targetKey: string, drag: any) => void): void {
if (BrowserProxy.isWindowDefined) {
Browser.addDropHandler(div, code, callback)
}
@@ -99,13 +101,14 @@ export default class BrowserProxy {
return ""
}

public static addSwipeHandler(div, callbackLeft, callbackRight): void {
if (BrowserProxy.isWindowDefined && BrowserProxy.isPhoneDevice()) {
public static addSwipeHandler(div: HTMLDivElement | null, callbackLeft: () => void, callbackRight: () => void): void {
if (BrowserProxy.isWindowDefined && BrowserProxy.isPhoneDevice() && div) {
Browser.addSwipeHandler(div, callbackLeft, callbackRight)
}
}

public static addSwitchHandler(div, state: boolean, callback, params): void {
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
public static addSwitchHandler(div: HTMLDivElement, state: boolean, callback, params): void {
if (BrowserProxy.isWindowDefined) {
Browser.addSwitchHandler(div, state, callback, params)
}
@@ -1,3 +1,5 @@
/* eslint-disable @typescript-eslint/explicit-module-boundary-types */
/* eslint-disable @typescript-eslint/no-explicit-any */
import CookieBase from "./CookieBase"

export default class Cookie {
@@ -1,3 +1,5 @@
/* eslint-disable @typescript-eslint/explicit-module-boundary-types */
/* eslint-disable @typescript-eslint/no-explicit-any */
import * as _ from "lodash"
import * as Cookies from "js-cookie"

0 comments on commit 749ce55

Please sign in to comment.