Skip to content

Commit d9a9e86

Browse files
ekratskihelstonayx
andauthored
Update imports and remove flowtypes (#49) (#54)
Co-authored-by: Elston Aw <[email protected]>
1 parent 95c2398 commit d9a9e86

File tree

116 files changed

+197
-12120
lines changed

Some content is hidden

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

116 files changed

+197
-12120
lines changed

.babelrc

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
{
22
"presets": [
33
"@babel/preset-env",
4-
"@babel/preset-flow",
54
"@babel/preset-react"
65
],
76
"plugins": [
@@ -20,7 +19,6 @@
2019
"test": {
2120
"presets": [
2221
"@babel/preset-env",
23-
"@babel/preset-flow",
2422
"@babel/preset-react"
2523
]
2624
}

.eslintrc.js

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,11 @@ const path = require('path')
33
module.exports = {
44
extends: [
55
'standard',
6-
'plugin:flowtype/recommended',
76
'plugin:react/recommended',
87
'prettier'
98
],
109
parser: 'babel-eslint',
11-
settings: {
12-
flowtype: {
13-
onlyFilesWithFlowAnnotation: true
14-
}
15-
},
16-
plugins: ['standard', 'flowtype', 'promise', 'import', 'react', 'jsx-a11y'],
10+
plugins: ['standard', 'promise', 'import', 'react', 'jsx-a11y'],
1711
env: {
1812
mocha: true,
1913
node: true,
@@ -31,7 +25,8 @@ module.exports = {
3125
'no-useless-return': 0,
3226
camelcase: 0,
3327
'prefer-const': 1,
34-
'react/prop-types': [2, { ignore: ['className'] }],
28+
// TODO(elstonayx): Set prop-types rule to 2 when we migrate to TS.
29+
'react/prop-types': [1, { ignore: ['className'] }],
3530
'no-multi-spaces': [2, { ignoreEOLComments: true }],
3631
'import/no-webpack-loader-syntax': 0,
3732
'no-use-before-define': [0],

.flowconfig

Lines changed: 0 additions & 20 deletions
This file was deleted.

.github/workflows/build-website.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@ name: Build Metronome
22

33
on:
44
push:
5-
branches: [ main ]
5+
branches: [ main, v1.1.x ]
66
pull_request:
7-
branches: [ main ]
7+
branches: [ main, v1.1.x ]
88

99
jobs:
1010
lint:

components/BaseComponent.es6.js

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
1-
/* @flow */
21
import React from 'react'
32
import { pick, isEqual } from 'lodash'
43

5-
class BaseComponent<P: Object, S: ?Object = void> extends React.Component<P, S> {
6-
propsToTrack: Array<string> = []
4+
class BaseComponent extends React.Component {
5+
propsToTrack = []
76

8-
shouldComponentUpdate (nextProps: P, nextState: S) {
7+
shouldComponentUpdate (nextProps, nextState) {
98
if (this.propsToTrack.length === 0) {
109
return true
1110
}

components/form/button-group/ButtonGroup.es6.js

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,7 @@
1-
/* @flow */
2-
31
import * as React from 'react'
42
import classnames from 'classnames'
5-
import Button from '../button/Button.es6'
6-
7-
type ButtonType = React.Element<typeof Button>
8-
9-
type Props = {
10-
className?: string | Object,
11-
vertical?: boolean,
12-
children: React.ChildrenArray<ButtonType> | ButtonType
13-
}
143

15-
function ButtonGroup ({ vertical, className, children }: Props) {
4+
function ButtonGroup ({ vertical, className, children }) {
165
return (
176
<div className={classnames({
187
'ds-button-group': true,

components/form/checkbox/Checkbox.es6.js

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,10 @@
1-
/* @flow */
21
import React from 'react'
32
import classnames from 'classnames'
4-
import type { Element } from 'react'
53

64
import { Checkmark } from '../../Icons.es6.js'
75

8-
type Props = {|
9-
label: string | Element <*>,
10-
name: string,
11-
checked: boolean,
12-
indeterminate: boolean,
13-
disabled: boolean,
14-
hasError: boolean,
15-
onChange: (val: boolean) => void
16-
|}
176

18-
function Checkbox ({ disabled, checked, indeterminate, label, name, onChange, hasError }: Props) {
7+
function Checkbox ({ disabled, checked, indeterminate, label, name, onChange, hasError }) {
198
const setCheckboxRef = checkbox => {
209
if (checkbox) {
2110
checkbox.indeterminate = indeterminate

components/form/checkbox/CheckboxSelect.es6.js

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,18 @@
1-
/* @flow */
21
import React from 'react'
3-
import type { Key } from 'react'
4-
import type { OptionValue } from '../option/Option.es6.js'
52
import { isEqual } from 'lodash'
63

74
import Checkbox from '../checkbox/Checkbox.es6.js'
85
import Option from '../option/Option.es6.js'
96
import Select from '../select/Select.es6.js'
107

11-
type SelectOption = {|
12-
label: string,
13-
value: OptionValue
14-
|}
158

16-
type Props = {|
17-
key?: Key,
18-
checked: boolean,
19-
disabled: boolean,
20-
label: string,
21-
onChange: () => void,
22-
onSelectChange: (value: number) => void,
23-
selectOptions: Array<SelectOption>,
24-
selectedOption: ?SelectOption
25-
|}
269

2710
/**
2811
* CheckboxSelect - a checkbox that when checked, reveals additional options
2912
* underneath in a Select component dropdown.
3013
*/
3114
function CheckboxSelect ({ checked, disabled, label, onChange, onSelectChange,
32-
selectOptions, selectedOption }: Props) {
15+
selectOptions, selectedOption }) {
3316
const placeholder = selectedOption ? selectedOption.label : 'Please select'
3417
const options = selectOptions.map((option, index) => {
3518
const isActive = selectedOption ? isEqual(option.value,

components/form/datetime-picker/DatePicker.es6.js

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,11 @@
1-
/* @flow */
21
import React from 'react'
32
import DatePicker from 'react-datepicker'
43

54
import Toggle from '../toggle/Toggle.es6.js'
65
import DropdownStyles from '../dropdown-styles/DropdownStyles.es6.js'
76

8-
type Props = {
9-
label?: string,
10-
onChange?: (datetime: moment$Moment) => void,
11-
onChangeRaw?: (datetimeRaw: string) => void,
12-
value?: ?moment$Moment
13-
}
147

15-
function B12DatePicker ({ onChange, value, label, ...rest }: Props) {
8+
function B12DatePicker ({ onChange, value, label, ...rest }) {
169
return (
1710
<div className="ds-form-control-select">
1811
<div className="ds-control-label">

components/form/datetime-picker/DatetimePicker.es6.js

Lines changed: 7 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,13 @@
1-
/* @flow */
21

32
import * as React from 'react'
43
import moment from 'moment'
54
import { debounce } from 'lodash'
65

76
const UPDATE_DEBOUNCE_INTERVAL = 700
87

9-
type Props = {|
10-
children: React.Node,
11-
dateOnly: boolean,
12-
fieldName?: string,
13-
timeOnly: boolean,
14-
updateDatetime: (datetime: string | null) => void,
15-
uuid?: UUID,
16-
value?: moment$Moment
17-
|}
18-
19-
type State = {|
20-
datetime: ?moment$Moment
21-
|}
22-
23-
class DatetimePicker extends React.Component<Props, State> {
8+
9+
10+
class DatetimePicker extends React.Component {
2411
state = {
2512
datetime: this.props.value
2613
}
@@ -34,15 +21,15 @@ class DatetimePicker extends React.Component<Props, State> {
3421
// text is input into the time field, the date field's datepicker also observes a change
3522
// and fires its onChange event. This boolean flag is used to prevent that extra onChange
3623
// event from firing.
37-
textInput: ?boolean
24+
textInput
3825

39-
componentDidUpdate(prevProps: Props) {
26+
componentDidUpdate(prevProps) {
4027
if(prevProps.value !== this.props.value) {
4128
this.setState({datetime: this.props.value})
4229
}
4330
}
4431

45-
handleChange = (datetime: moment$Moment): void => {
32+
handleChange = (datetime) => {
4633
const { dateOnly, timeOnly, updateDatetime } = this.props
4734

4835
if (this.textInput) {
@@ -74,7 +61,7 @@ class DatetimePicker extends React.Component<Props, State> {
7461
handleChangeDebounced = debounce(this.handleChange, UPDATE_DEBOUNCE_INTERVAL)
7562

7663
// Handles update of time picker via text input
77-
handleChangeRaw = (datetimeRaw: string): void => {
64+
handleChangeRaw = (datetimeRaw) => {
7865
const datetime = this.state.datetime || moment()
7966
const newDatetime = moment.utc(datetimeRaw, 'h:mm A', true)
8067

0 commit comments

Comments
 (0)