From 2e7006ce24c42ec2b6642346d153429338e7334e Mon Sep 17 00:00:00 2001 From: Shin'ya Ueoka Date: Sun, 22 Dec 2019 10:01:24 +0900 Subject: npm run lint:fix --- src/settings/components/form/BlacklistForm.tsx | 6 +++--- src/settings/components/form/KeymapsForm.tsx | 4 ++-- src/settings/components/form/PartialBlacklistForm.tsx | 10 +++++----- src/settings/components/form/PropertiesForm.tsx | 10 +++++----- src/settings/components/form/SearchForm.tsx | 12 ++++++------ src/settings/components/index.tsx | 18 +++++++++--------- src/settings/components/ui/Input.tsx | 14 +++++++------- 7 files changed, 37 insertions(+), 37 deletions(-) (limited to 'src/settings/components') 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 { } 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 { }; render() { - let values = this.props.value.toJSON(); + const values = this.props.value.toJSON(); return
{ keymaps.fields.map((group, index) => { return
{ group.map(([name, label]) => { - let value = values[name] || ''; + const value = values[name] || ''; return { } 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 { }; render() { - let types = this.props.types; - let values = this.props.value; + const types = this.props.types; + const values = this.props.value; return
{ 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 { } bindValue(e: React.ChangeEvent) { - 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 { }; render() { - let value = this.props.value.toJSON(); + const value = this.props.value.toJSON(); return
Name
@@ -56,10 +56,10 @@ class SearchForm extends React.Component { // 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 { } 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 { 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 { } 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 { } 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 { } 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 { } 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 { } 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 { } 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 { } 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 { class Input extends React.Component { 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
@@ -26,8 +26,8 @@ class Input extends React.Component { } 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