diff options
author | Shin'ya Ueoka <ueokande@i-beam.org> | 2019-12-22 10:01:24 +0900 |
---|---|---|
committer | Shin'ya Ueoka <ueokande@i-beam.org> | 2019-12-22 10:48:39 +0900 |
commit | 2e7006ce24c42ec2b6642346d153429338e7334e (patch) | |
tree | f1eb9e843ab4ec5d7d3f08fff8c858174b6f1284 /src/settings/components | |
parent | 0881f92d20cb7b4f5a75671df739c3eaa3cd0ff0 (diff) |
npm run lint:fix
Diffstat (limited to 'src/settings/components')
-rw-r--r-- | src/settings/components/form/BlacklistForm.tsx | 6 | ||||
-rw-r--r-- | src/settings/components/form/KeymapsForm.tsx | 4 | ||||
-rw-r--r-- | src/settings/components/form/PartialBlacklistForm.tsx | 10 | ||||
-rw-r--r-- | src/settings/components/form/PropertiesForm.tsx | 10 | ||||
-rw-r--r-- | src/settings/components/form/SearchForm.tsx | 12 | ||||
-rw-r--r-- | src/settings/components/index.tsx | 18 | ||||
-rw-r--r-- | src/settings/components/ui/Input.tsx | 14 |
7 files changed, 37 insertions, 37 deletions
diff --git a/src/settings/components/form/BlacklistForm.tsx b/src/settings/components/form/BlacklistForm.tsx index 4e96cbf..51c32f4 100644 --- a/src/settings/components/form/BlacklistForm.tsx +++ b/src/settings/components/form/BlacklistForm.tsx @@ -43,9 +43,9 @@ class BlacklistForm extends React.Component<Props> { } bindValue(e: any) { - let name = e.target.name; - let index = e.target.getAttribute('data-index'); - let items = this.props.value.items; + const name = e.target.name; + const index = e.target.getAttribute('data-index'); + const items = this.props.value.items; if (name === 'url') { items[index] = new BlacklistItem(e.target.value, false, []); diff --git a/src/settings/components/form/KeymapsForm.tsx b/src/settings/components/form/KeymapsForm.tsx index 94934ae..dc74de3 100644 --- a/src/settings/components/form/KeymapsForm.tsx +++ b/src/settings/components/form/KeymapsForm.tsx @@ -18,14 +18,14 @@ class KeymapsForm extends React.Component<Props> { }; render() { - let values = this.props.value.toJSON(); + const values = this.props.value.toJSON(); return <div className='form-keymaps-form'> { keymaps.fields.map((group, index) => { return <div key={index} className='form-keymaps-form-field-group'> { group.map(([name, label]) => { - let value = values[name] || ''; + const value = values[name] || ''; return <Input type='text' id={name} name={name} key={name} label={label} value={value} diff --git a/src/settings/components/form/PartialBlacklistForm.tsx b/src/settings/components/form/PartialBlacklistForm.tsx index 0702913..1807e28 100644 --- a/src/settings/components/form/PartialBlacklistForm.tsx +++ b/src/settings/components/form/PartialBlacklistForm.tsx @@ -52,15 +52,15 @@ class PartialBlacklistForm extends React.Component<Props> { } bindValue(e: any) { - let name = e.target.name; - let index = e.target.getAttribute('data-index'); - let items = this.props.value.items; + const name = e.target.name; + const index = e.target.getAttribute('data-index'); + const items = this.props.value.items; if (name === 'url') { - let current = items[index]; + const current = items[index]; items[index] = new BlacklistItem(e.target.value, true, current.keys); } else if (name === 'keys') { - let current = items[index]; + const current = items[index]; items[index] = new BlacklistItem( current.pattern, true, e.target.value.split(',')); } else if (name === 'add') { diff --git a/src/settings/components/form/PropertiesForm.tsx b/src/settings/components/form/PropertiesForm.tsx index db8c8e5..e648971 100644 --- a/src/settings/components/form/PropertiesForm.tsx +++ b/src/settings/components/form/PropertiesForm.tsx @@ -17,13 +17,13 @@ class PropertiesForm extends React.Component<Props> { }; render() { - let types = this.props.types; - let values = this.props.value; + const types = this.props.types; + const values = this.props.value; return <div className='form-properties-form'> { Object.keys(types).map((name) => { - let type = types[name]; + const type = types[name]; let inputType = ''; let onChange = this.bindValue.bind(this); if (type === 'string') { @@ -59,8 +59,8 @@ class PropertiesForm extends React.Component<Props> { } bindValue(e: React.ChangeEvent<HTMLInputElement>) { - let name = e.target.name; - let next = { ...this.props.value }; + const name = e.target.name; + const next = { ...this.props.value }; if (e.target.type.toLowerCase() === 'checkbox') { next[name] = e.target.checked; } else if (e.target.type.toLowerCase() === 'number') { diff --git a/src/settings/components/form/SearchForm.tsx b/src/settings/components/form/SearchForm.tsx index 0aaf6fd..5dc786b 100644 --- a/src/settings/components/form/SearchForm.tsx +++ b/src/settings/components/form/SearchForm.tsx @@ -18,7 +18,7 @@ class SearchForm extends React.Component<Props> { }; render() { - let value = this.props.value.toJSON(); + const value = this.props.value.toJSON(); return <div className='form-search-form'> <div className='form-search-form-header'> <div className='column-name'>Name</div> @@ -56,10 +56,10 @@ class SearchForm extends React.Component<Props> { // eslint-disable-next-line max-statements bindValue(e: any) { - let value = this.props.value.toJSON(); - let name = e.target.name; - let index = Number(e.target.getAttribute('data-index')); - let next: typeof value = { + const value = this.props.value.toJSON(); + const name = e.target.name; + const index = Number(e.target.getAttribute('data-index')); + const next: typeof value = { default: value.default, engines: value.engines.slice(), }; @@ -76,7 +76,7 @@ class SearchForm extends React.Component<Props> { } else if (name === 'delete' && value.engines.length > 1) { next.engines.splice(index, 1); if (value.engines[index][0] === value.default) { - let nextIndex = Math.min(index, next.engines.length - 1); + const nextIndex = Math.min(index, next.engines.length - 1); next.default = next.engines[nextIndex][0]; } } diff --git a/src/settings/components/index.tsx b/src/settings/components/index.tsx index 3eb2dbe..f4f0326 100644 --- a/src/settings/components/index.tsx +++ b/src/settings/components/index.tsx @@ -96,7 +96,7 @@ class SettingsComponent extends React.Component<Props> { render() { let fields = null; - let disabled = this.props.error.length > 0; + const disabled = this.props.error.length > 0; if (this.props.source === 'form') { fields = this.renderFormFields(this.props.form!!); } else if (this.props.source === 'json') { @@ -131,7 +131,7 @@ class SettingsComponent extends React.Component<Props> { } bindKeymapsForm(value: FormKeymaps) { - let data = new SettingData({ + const data = new SettingData({ source: this.props.source, form: (this.props.form as FormSettings).buildWithKeymaps(value), }); @@ -139,7 +139,7 @@ class SettingsComponent extends React.Component<Props> { } bindSearchForm(value: any) { - let data = new SettingData({ + const data = new SettingData({ source: this.props.source, form: (this.props.form as FormSettings).buildWithSearch( FormSearch.fromJSON(value)), @@ -148,7 +148,7 @@ class SettingsComponent extends React.Component<Props> { } bindBlacklistForm(blacklist: Blacklist) { - let data = new SettingData({ + const data = new SettingData({ source: this.props.source, form: (this.props.form as FormSettings).buildWithBlacklist(blacklist), }); @@ -156,7 +156,7 @@ class SettingsComponent extends React.Component<Props> { } bindPropertiesForm(value: any) { - let data = new SettingData({ + const data = new SettingData({ source: this.props.source, form: (this.props.form as FormSettings).buildWithProperties( Properties.fromJSON(value)) @@ -165,7 +165,7 @@ class SettingsComponent extends React.Component<Props> { } bindJson(_name: string, value: string) { - let data = new SettingData({ + const data = new SettingData({ source: this.props.source, json: JSONTextSettings.fromText(value), }); @@ -173,13 +173,13 @@ class SettingsComponent extends React.Component<Props> { } bindSource(_name: string, value: string) { - let from = this.props.source; + const from = this.props.source; if (from === 'form' && value === 'json') { this.props.dispatch(settingActions.switchToJson( this.props.form as FormSettings)); this.save(); } else if (from === 'json' && value === 'form') { - let b = window.confirm(DO_YOU_WANT_TO_CONTINUE); + const b = window.confirm(DO_YOU_WANT_TO_CONTINUE); if (!b) { this.forceUpdate(); return; @@ -191,7 +191,7 @@ class SettingsComponent extends React.Component<Props> { } save() { - let { source, json, form } = this.props.store.getState(); + const { source, json, form } = this.props.store.getState(); this.props.dispatch(settingActions.save( new SettingData({ source, json, form }), )); diff --git a/src/settings/components/ui/Input.tsx b/src/settings/components/ui/Input.tsx index b7593b9..69c14b3 100644 --- a/src/settings/components/ui/Input.tsx +++ b/src/settings/components/ui/Input.tsx @@ -13,8 +13,8 @@ interface Props extends React.AllHTMLAttributes<HTMLElement> { class Input extends React.Component<Props> { renderText(props: Props) { - let inputClassName = props.error ? 'input-error' : ''; - let pp = { ...props }; + const inputClassName = props.error ? 'input-error' : ''; + const pp = { ...props }; delete pp.onValueChange; return <div className='settings-ui-input'> <label htmlFor={props.id}>{ props.label }</label> @@ -26,8 +26,8 @@ class Input extends React.Component<Props> { } renderRadio(props: Props) { - let inputClassName = props.error ? 'input-error' : ''; - let pp = { ...props }; + const inputClassName = props.error ? 'input-error' : ''; + const pp = { ...props }; delete pp.onValueChange; return <div className='settings-ui-input'> <label> @@ -41,8 +41,8 @@ class Input extends React.Component<Props> { } renderTextArea(props: Props) { - let inputClassName = props.error ? 'input-error' : ''; - let pp = { ...props }; + const inputClassName = props.error ? 'input-error' : ''; + const pp = { ...props }; delete pp.onValueChange; return <div className='settings-ui-input'> <label @@ -57,7 +57,7 @@ class Input extends React.Component<Props> { } render() { - let { type } = this.props; + const { type } = this.props; switch (this.props.type) { case 'text': |