Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP Typescript #202

Open
wants to merge 25 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
4e581db
refactor(typescript): components
akameco Mar 5, 2019
84350ed
refactor(types,services): refactor to typescript
akameco Mar 6, 2019
b18420b
chore(eslint): disable @typescript-eslint/no-explicit-any
akameco Mar 6, 2019
92235a7
refactor(utils): typescript
akameco Mar 6, 2019
5fb32d5
chore(eslint): disable @typescript-eslint/explicit-function-return-type
akameco Mar 6, 2019
e62d18e
chore(deps): add types
akameco Mar 6, 2019
79eb769
refactor(components): ts LazyLoadImg
akameco Mar 6, 2019
3892cd0
chore(deps): add @types/styled-components
akameco Mar 6, 2019
017f38b
refactor(reducer,action): typescript
akameco Mar 6, 2019
30d921b
refactor(messages,selectors): typescript
akameco Mar 6, 2019
27f72eb
refactor(typescript): sagas
akameco Mar 9, 2019
1923a47
refactor(types): use reference
akameco Mar 9, 2019
e45c50e
refactor(typescript): app
akameco Mar 9, 2019
b3592fc
refactor(typescript): styles
akameco Mar 9, 2019
82e083f
refactor(typescript): i18n
akameco Mar 9, 2019
36b219a
refactor(typescript): selector
akameco Mar 9, 2019
35b50b8
refactor(typescript): tests
akameco Mar 9, 2019
7e52992
refactor(typescript): tests
akameco Mar 9, 2019
a2f7fd8
chore(flow): remove flow-typed
akameco Mar 10, 2019
b8f9b7d
refactor(typescript): containers
akameco Mar 11, 2019
91fe19e
chore(scripts): ts.js
akameco Mar 11, 2019
f62ec90
chore: rm .storybook
akameco Aug 25, 2019
ec62ab7
refactor: rm flow
akameco Aug 25, 2019
7fbb9b7
chore: remove flow-to-typescript
akameco Aug 25, 2019
7166cca
wip
akameco Nov 28, 2019
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
1 change: 0 additions & 1 deletion .eslintignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
release/*
dist/*
flow-typed/*
main.js
app/node_modules/*
node_modules/*
Expand Down
11 changes: 6 additions & 5 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
{
"extends": [
"precure/oss",
"precure/react"
"precure/auto"
],
"env": {
"node": true,
Expand All @@ -15,11 +14,14 @@
]
},
"rules": {
"@typescript-eslint/no-explicit-any": 0,
"@typescript-eslint/explicit-function-return-type": 0,
"@typescript-eslint/promise-function-async": 0,
"import/named": 0,
"no-constant-condition": 0,
"import/no-extraneous-dependencies": 0,
"import/exports-last": 0,
"import/no-unresolved": 0,
"flowtype/no-weak-types": 0,
"no-duplicate-imports": 0,
"no-invalid-this": 0,
"no-warning-comments": 0,
Expand All @@ -29,7 +31,6 @@
"max-lines-per-function": 0,
"no-shadow": 0,
"react/no-deprecated": 0,
"react/no-find-dom-node": 0,
"flowtype/require-compound-type-alias": 0
"react/no-find-dom-node": 0
}
}
49 changes: 0 additions & 49 deletions .flowconfig

This file was deleted.

2 changes: 0 additions & 2 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
flow-typed/npm
lib
dist
node_modules
app/main.js
coverage
dll
flow-typed
release
package.json
.github
Expand Down
1 change: 0 additions & 1 deletion .storybook/addons.js

This file was deleted.

39 changes: 0 additions & 39 deletions .storybook/config.js

This file was deleted.

25 changes: 0 additions & 25 deletions .storybook/webpack.config.js

This file was deleted.

58 changes: 0 additions & 58 deletions app/action.js

This file was deleted.

54 changes: 54 additions & 0 deletions app/action.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
import { Action as BookmarkButtonAction } from './containers/BookmarkButton/actionTypes'
import { Action as BoxContainerAction } from './containers/BoxContainer/actionTypes'
import { Action as ColumnBookmarkAction } from './containers/ColumnBookmark/actionTypes'
import { Action as ColumnFollowAction } from './containers/ColumnFollow/actionTypes'
import { Action as ColumnHistoryAction } from './containers/ColumnHistory/actionTypes'
import { Action as ColumnManagerAction } from './containers/ColumnManager/actionTypes'
import { Action as ColumnRankingAction } from './containers/ColumnRanking/actionTypes'
import { Action as ColumnRankingR18Action } from './containers/ColumnRankingR18/actionTypes'
import { Action as ColumnSearchAction } from './containers/ColumnSearch/actionTypes'
import { Action as ColumnUserIllustAction } from './containers/ColumnUserIllust/actionTypes'
import { Action as DrawerManagerAction } from './containers/DrawerManager/actionTypes'
import { Action as FollowButtonAction } from './containers/FollowButton/actionTypes'
import { Action as HeaderContainerAction } from './containers/HeaderContainer/actionTypes'
import { Action as IllustPreviewAction } from './containers/IllustPreview/actionTypes'
import { Action as LanguageAction } from './containers/Language/actionTypes'
import { Action as LoginModalAction } from './containers/LoginModal/actionTypes'
import { Action as MangaPreviewAction } from './containers/MangaPreview/actionTypes'
import { Action as ModalManegerAction } from './containers/ModalManeger/actionTypes'
import { Action as SearchFieldAction } from './containers/SearchField/actionTypes'
import { Action as SettingModalAction } from './containers/SettingModal/actionTypes'
import { Action as TableAction } from './containers/Table/actionTypes'
import { Action as UserDrawerContainerAction } from './containers/UserDrawerContainer/actionTypes'
import { Action as UserPopoverContainerAction } from './containers/UserPopoverContainer/actionTypes'
import { Action as NotifyAction } from './containers/Notify/actionTypes'
import { Action as ApiAction } from './containers/Api/actionTypes'
import { Action as ColumnRecommendedAction } from './containers/ColumnRecommended/actionTypes'

export type Action =
| BookmarkButtonAction
| BoxContainerAction
| ColumnBookmarkAction
| ColumnFollowAction
| ColumnHistoryAction
| ColumnManagerAction
| ColumnRankingAction
| ColumnRankingR18Action
| ColumnSearchAction
| ColumnUserIllustAction
| DrawerManagerAction
| FollowButtonAction
| HeaderContainerAction
| IllustPreviewAction
| LanguageAction
| LoginModalAction
| MangaPreviewAction
| ModalManegerAction
| SearchFieldAction
| SettingModalAction
| TableAction
| UserDrawerContainerAction
| UserPopoverContainerAction
| NotifyAction
| ApiAction
| ColumnRecommendedAction
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// @flow
import * as React from 'react'
import { storiesOf } from '@storybook/react'
import A from '.'
Expand Down
2 changes: 0 additions & 2 deletions app/components/A/index.js → app/components/A/index.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// @flow
import styled from 'styled-components'
import { key } from 'styles/styleTheme'

Expand All @@ -10,5 +9,4 @@ const A = styled.a`
text-decoration: underline;
}
`

export default A
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
// @flow
import * as React from 'react'
import { mount } from 'enzyme'
import { mount } from 'enzyme' // eslint-disable-next-line import/no-unassigned-import

// eslint-disable-next-line import/no-unassigned-import
import 'jest-styled-components'

import A from '..'

const href = 'https://akameco.github.io'
Expand All @@ -20,26 +19,28 @@ test('have an href attribute', () => {
const c = renderComponent()
expect(c.prop('href')).toStrictEqual(href)
})

test('have children', () => {
const c = renderComponent()
expect(c.contains(children)).toStrictEqual(true)
})

test('have a className attribute', () => {
const className = 'test'
const c = renderComponent({ className })
const c = renderComponent({
className,
})
expect(c.find('a').hasClass(className)).toStrictEqual(true)
})

test('adopt a target', () => {
const target = '_blank'
const c = renderComponent({ target })
const c = renderComponent({
target,
})
expect(c.prop('target')).toStrictEqual(target)
})

test('adopt a type attribute', () => {
const type = 'text/html'
const c = renderComponent({ type })
const c = renderComponent({
type,
})
expect(c.prop('type')).toStrictEqual(type)
})
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
// @flow
import * as React from 'react'

type Props = {
lock: boolean,
interface Props {
lock: boolean
}

let lockingCounter: number = 1
let lockingCounter = 1
let originalBodyOverflow = null

function getElementBody() {
return document.querySelectorAll('body')[0]
}

class AutoLockScroll extends React.Component<Props> {
locked: boolean = false

componentDidMount() {
if (this.props.lock === true) {
this.preventScrolling()
Expand All @@ -35,15 +35,12 @@ class AutoLockScroll extends React.Component<Props> {
this.allowScrolling()
}

locked: boolean = false

preventScrolling() {
if (this.locked) {
return
}

lockingCounter += 1

this.locked = true

if (lockingCounter === 1) {
Expand Down
Loading