1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-12-22 17:33:23 +01:00

Enable react/no-unused-state rule for ESLint (#7609)

* eslint: Enable react/no-unused-state rule
* Fix unused state issues
* Remove now unused validFileImport localized message
This commit is contained in:
Whymarrh Whitby 2019-12-03 12:00:03 -03:30 committed by GitHub
parent e61745a821
commit 2c33ad3eb4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
56 changed files with 12 additions and 175 deletions

View File

@ -150,6 +150,7 @@
"operator-linebreak": [2, "after", { "overrides": { "?": "ignore", ":": "ignore" } }],
"padded-blocks": "off",
"quotes": [2, "single", {"avoidEscape": true, "allowTemplateLiterals": true}],
"react/no-unused-state": 2,
"react/jsx-boolean-value": 2,
"react/jsx-curly-brace-presence": [2, { "props": "never", "children": "never" }],
"react/jsx-equals-spacing": 2,

View File

@ -1332,9 +1332,6 @@
"userName": {
"message": "የተጣቃሚ ስም"
},
"validFileImport": {
"message": "የሚያስመጡትን ትክክለኛ ፋይል መምረጥ አለብዎ፡"
},
"viewAccount": {
"message": "መለያን ይመልከቱ"
},

View File

@ -1328,9 +1328,6 @@
"userName": {
"message": "اسم المستخدم"
},
"validFileImport": {
"message": "يجب عليك تحديد ملف صالح للاستيراد."
},
"viewAccount": {
"message": "عرض حساب"
},

View File

@ -1331,9 +1331,6 @@
"userName": {
"message": "Потребителско име"
},
"validFileImport": {
"message": "Трябва да изберете валиден файл, който да импортирате."
},
"viewAccount": {
"message": "Преглед на профила"
},

View File

@ -1335,9 +1335,6 @@
"userName": {
"message": "ইউজারনেম"
},
"validFileImport": {
"message": "আমদানি করার জন্য আপনাকে অবশ্যই একটি বৈধ ফাইল নির্বাচন করতে হবে।"
},
"viewAccount": {
"message": "আ্যাকাউন্ট দেখুন"
},

View File

@ -1304,9 +1304,6 @@
"userName": {
"message": "Nom d'usuari"
},
"validFileImport": {
"message": "Has de seleccionar un arxiu vàlid per a importar."
},
"viewAccount": {
"message": "Mostra el compte"
},

View File

@ -514,9 +514,6 @@
"usedByClients": {
"message": "Používána různými klienty"
},
"validFileImport": {
"message": "Musíte vybrat validní soubor k importu."
},
"viewAccount": {
"message": "Zobrazit účet"
},

View File

@ -1301,9 +1301,6 @@
"userName": {
"message": "Brugernavn"
},
"validFileImport": {
"message": "Du skal vælge en gyldig fil at importere."
},
"viewAccount": {
"message": "Vis konto"
},

View File

@ -1292,9 +1292,6 @@
"userName": {
"message": "Nutzername"
},
"validFileImport": {
"message": "Du musst eine gültige Datei für den Import auswählen."
},
"viewAccount": {
"message": " Account einsehen"
},

View File

@ -1329,9 +1329,6 @@
"userName": {
"message": "Όνομα χρήστη"
},
"validFileImport": {
"message": "Πρέπει να επιλέξετε έναν έγκυρο φάκελο για εισαγωγή."
},
"viewAccount": {
"message": "Προβολή λογαριασμού"
},

View File

@ -1472,9 +1472,6 @@
"userName": {
"message": "Username"
},
"validFileImport": {
"message": "You must select a valid file to import."
},
"viewAccount": {
"message": "View Account"
},

View File

@ -1076,9 +1076,6 @@
"usedByClients": {
"message": "Utilizado por una variedad de clientes diferentes"
},
"validFileImport": {
"message": "Debes selecionar un archivo valido para importar"
},
"viewAccount": {
"message": "Mirar cuenta"
},

View File

@ -1314,9 +1314,6 @@
"userName": {
"message": "Nombre de usuario"
},
"validFileImport": {
"message": "Selecciona un archivo válido para importar."
},
"viewAccount": {
"message": "Ver cuenta"
},

View File

@ -1325,9 +1325,6 @@
"userName": {
"message": "Kasutajanimi"
},
"validFileImport": {
"message": "Peate valima importimiseks sobiva faili."
},
"viewAccount": {
"message": "Kuva konto"
},

View File

@ -1335,9 +1335,6 @@
"userName": {
"message": "نام کاربری"
},
"validFileImport": {
"message": "شما باید یک فایل معتبر را جهت وارد سازی انتخاب کنید."
},
"viewAccount": {
"message": "مشاهده حساب"
},

View File

@ -1332,9 +1332,6 @@
"userName": {
"message": "Käyttäjätunnus"
},
"validFileImport": {
"message": "Valittava tuotavaksi kelpaava tiedosto."
},
"viewAccount": {
"message": "Näytä tili"
},

View File

@ -1223,9 +1223,6 @@
"usedByClients": {
"message": "Ginagamit ng iba't ibang client"
},
"validFileImport": {
"message": "Dapat kang pumili ng valid na file na ii-import."
},
"viewAccount": {
"message": "Tingnan ang Account"
},

View File

@ -1296,9 +1296,6 @@
"userName": {
"message": "Nom d'utilisateur"
},
"validFileImport": {
"message": "Vous devez selectionner un fichier valide à importer."
},
"viewAccount": {
"message": "Afficher le compte"
},

View File

@ -1329,9 +1329,6 @@
"userName": {
"message": "שם משתמש"
},
"validFileImport": {
"message": "עליך לבחור קובץ חוקי לייבוא."
},
"viewAccount": {
"message": "הצג חשבון"
},

View File

@ -1329,9 +1329,6 @@
"userName": {
"message": "उपयोगकर्ता नाम"
},
"validFileImport": {
"message": "आयात करने के लिए आपको एक मान्य फ़ाइल को चुनना होगा।"
},
"viewAccount": {
"message": "खाता देखें"
},

View File

@ -476,9 +476,6 @@
"usedByClients": {
"message": "विभिन्न क्लाइंट्स द्वारा उपयोग किया जाता है"
},
"validFileImport": {
"message": "आयात करने के लिए आपको एक वैध फ़ाइल चुननी होगी।"
},
"viewAccount": {
"message": "खाता देखें"
},

View File

@ -1325,9 +1325,6 @@
"userName": {
"message": "Korisničko ime"
},
"validFileImport": {
"message": "Morate odabrati valjanu datoteku za uvoz."
},
"viewAccount": {
"message": "Prikaz računa"
},

View File

@ -836,9 +836,6 @@
"usedByClients": {
"message": "Itilize pa yon varyete de kliyan diferan"
},
"validFileImport": {
"message": "Ou dwe chwazi yon dosye ki valab pou enpòte."
},
"viewAccount": {
"message": "Wè Kont"
},

View File

@ -1325,9 +1325,6 @@
"userName": {
"message": "Felhasználónév"
},
"validFileImport": {
"message": "Ki kell választanod egy érvényes fájlt az importáláshoz."
},
"viewAccount": {
"message": "Fiók megtekintése"
},

View File

@ -1304,9 +1304,6 @@
"userName": {
"message": "Nama Pengguna"
},
"validFileImport": {
"message": "Anda harus memilih berkas yang sah untuk diimpor."
},
"viewAccount": {
"message": "Lihat Akun"
},

View File

@ -1295,9 +1295,6 @@
"userName": {
"message": "Nome utente"
},
"validFileImport": {
"message": "Devi selezionare un file valido da importare."
},
"viewAccount": {
"message": "Vedi Account"
},

View File

@ -1335,9 +1335,6 @@
"userName": {
"message": "ಬಳಕೆದಾರಹೆಸರು"
},
"validFileImport": {
"message": "ನೀವು ಆಮದು ಮಾಡಲು ಮಾನ್ಯ ಫೈಲ್ ಅನ್ನು ಆಯ್ಕೆಮಾಡಬೇಕು."
},
"viewAccount": {
"message": "ಖಾತೆಯನ್ನು ವೀಕ್ಷಿಸಿ"
},

View File

@ -1326,9 +1326,6 @@
"userName": {
"message": "사용자이름"
},
"validFileImport": {
"message": "가져오기 위해 유효한 파일을 선택해야 합니다."
},
"viewAccount": {
"message": "계정 보기"
},

View File

@ -1335,9 +1335,6 @@
"userName": {
"message": "Vartotojo vardas"
},
"validFileImport": {
"message": "Turite pasirinkti galiojantį failą, kurį pageidaujate importuoti."
},
"viewAccount": {
"message": "Žiūrėti paskyrą"
},

View File

@ -1331,9 +1331,6 @@
"userName": {
"message": "Lietotājvārds"
},
"validFileImport": {
"message": "Importēšanai jāatlasa derīga datne."
},
"viewAccount": {
"message": "Skatīt kontu"
},

View File

@ -1303,9 +1303,6 @@
"userName": {
"message": "Nama pengguna"
},
"validFileImport": {
"message": "Anda mesti pilih fail yang sah untuk diimport."
},
"viewAccount": {
"message": "Paparkan Akaun"
},

View File

@ -463,9 +463,6 @@
"usedByClients": {
"message": "Gebruikt door verschillende klanten"
},
"validFileImport": {
"message": "U moet een geldig bestand selecteren om te importeren."
},
"viewAccount": {
"message": "Bekijk account"
},

View File

@ -1307,9 +1307,6 @@
"userName": {
"message": "Brukernavn"
},
"validFileImport": {
"message": "Du må velge en gyldig fil å importere"
},
"viewAccount": {
"message": "Se konto"
},

View File

@ -1320,9 +1320,6 @@
"userName": {
"message": "Nazwa użytkownika"
},
"validFileImport": {
"message": "Należy wybrać prawidłowy plik do zaimportowania."
},
"viewAccount": {
"message": "Zobacz konto"
},

View File

@ -473,9 +473,6 @@
"usedByClients": {
"message": "Utilizado por vários tipos de clientes"
},
"validFileImport": {
"message": "Deve selecionar um ficheiro válido para importar."
},
"viewAccount": {
"message": "Ver Conta"
},

View File

@ -1314,9 +1314,6 @@
"userName": {
"message": "Nome de usuário"
},
"validFileImport": {
"message": "Você precisa selecionar um arquivo válido para importar."
},
"viewAccount": {
"message": "Visualizar conta"
},

View File

@ -1316,9 +1316,6 @@
"userName": {
"message": "Nume utilizator"
},
"validFileImport": {
"message": "Trebuie să selectați un fișier valabil pentru importare."
},
"viewAccount": {
"message": "Afișați contul"
},

View File

@ -527,9 +527,6 @@
"usedByClients": {
"message": "Используется различными клиентами"
},
"validFileImport": {
"message": "Вам нужно выбрать правильный файл для импорта."
},
"viewAccount": {
"message": "Посмотреть счет"
},

View File

@ -1289,9 +1289,6 @@
"userName": {
"message": "Meno používateľa"
},
"validFileImport": {
"message": "Musíte vybrat validní soubor k importu."
},
"viewAccount": {
"message": "Zobrazit účet"
},

View File

@ -1317,9 +1317,6 @@
"userName": {
"message": "Uporabniško ime"
},
"validFileImport": {
"message": "Za uvoz morate izbrati pravilno datoteko."
},
"viewAccount": {
"message": "Poglej račun"
},

View File

@ -1320,9 +1320,6 @@
"userName": {
"message": "Корисничко име"
},
"validFileImport": {
"message": "Morate odabrati važeću datoteku da biste ih uvezli."
},
"viewAccount": {
"message": "Прикажи налог"
},

View File

@ -1310,9 +1310,6 @@
"userName": {
"message": "Användarnamn"
},
"validFileImport": {
"message": "Du måste välja en giltig fil för att importera."
},
"viewAccount": {
"message": "Visa konto"
},

View File

@ -1313,9 +1313,6 @@
"userName": {
"message": "Jina la mtumiaji"
},
"validFileImport": {
"message": "Ni lazima uchague faili halali ili uhamishe."
},
"viewAccount": {
"message": "Angalia Akaunti"
},

View File

@ -539,9 +539,6 @@
"usedByClients": {
"message": "பல்வேறு வாடிக்கையாளர்கள் பல்வேறு பயன்படுத்திய"
},
"validFileImport": {
"message": "இறக்குமதி செய்ய சரியான கோப்பு தேர்ந்தெடுக்க வேண்டும்."
},
"viewAccount": {
"message": "கணக்கைப் பார்"
},

View File

@ -641,9 +641,6 @@
"usedByClients": {
"message": "ถูกใช้งานโดยหลายไคลเอนท์"
},
"validFileImport": {
"message": "คุณต้องเลือกไฟล์ที่ถูกต้องเพื่อนำเข้า"
},
"viewAccount": {
"message": "ดูบัญชี"
},

View File

@ -536,9 +536,6 @@
"usedByClients": {
"message": "Farklı istemciler tarafından kullanılmakta"
},
"validFileImport": {
"message": "Almak için geçerli bir dosya seçmelisiniz"
},
"viewAccount": {
"message": "Hesabı İncele"
},

View File

@ -1335,9 +1335,6 @@
"userName": {
"message": "Ім’я користувача"
},
"validFileImport": {
"message": "Потрібно вибрати дійсний файл для імпорту."
},
"viewAccount": {
"message": "Переглянути обліковий запис"
},

View File

@ -1314,9 +1314,6 @@
"userName": {
"message": "用户名"
},
"validFileImport": {
"message": "您必须选择一个有效的文件进行导入."
},
"viewAccount": {
"message": "查看账户"
},

View File

@ -1308,9 +1308,6 @@
"userName": {
"message": "使用者名稱"
},
"validFileImport": {
"message": "您必須選擇一個合法的檔案來匯入."
},
"viewAccount": {
"message": "查看帳戶"
},

View File

@ -39,7 +39,6 @@ export default class TransactionListItemDetails extends PureComponent {
state = {
justCopied: false,
cancelDisabled: false,
}
handleEtherscanClick = () => {

View File

@ -39,7 +39,6 @@ export default class SenderToRecipient extends PureComponent {
state = {
senderAddressCopied: false,
recipientAddressCopied: false,
}
renderSenderIdenticon () {
@ -112,7 +111,6 @@ export default class SenderToRecipient extends PureComponent {
<div
className="sender-to-recipient__party sender-to-recipient__party--recipient sender-to-recipient__party--recipient-with-address"
onClick={() => {
this.setState({ recipientAddressCopied: true })
copyToClipboard(checksummedRecipientAddress)
if (onRecipientClick) {
onRecipientClick()
@ -136,7 +134,6 @@ export default class SenderToRecipient extends PureComponent {
}
wrapperClassName="sender-to-recipient__tooltip-wrapper"
containerClassName="sender-to-recipient__tooltip-container"
onHidden={() => this.setState({ recipientAddressCopied: false })}
>
<div className="sender-to-recipient__name">
<span>{ addressOnly ? `${t('to')}: ` : '' }</span>

View File

@ -11,8 +11,6 @@ import PageContainer from '../../components/ui/page-container'
import { Tabs, Tab } from '../../components/ui/tabs'
const emptyAddr = '0x0000000000000000000000000000000000000000'
const SEARCH_TAB = 'SEARCH'
const CUSTOM_TOKEN_TAB = 'CUSTOM_TOKEN'
class AddToken extends Component {
static contextTypes = {
@ -42,7 +40,6 @@ class AddToken extends Component {
customSymbolError: null,
customDecimalsError: null,
autoFilled: false,
displayedTab: SEARCH_TAB,
forceEditSymbol: false,
}
}
@ -73,8 +70,7 @@ class AddToken extends Component {
decimals: customDecimals = 0,
} = customToken
const displayedTab = Object.keys(selectedTokens).length > 0 ? SEARCH_TAB : CUSTOM_TOKEN_TAB
this.setState({ selectedTokens, customAddress, customSymbol, customDecimals, displayedTab })
this.setState({ selectedTokens, customAddress, customSymbol, customDecimals })
}
}

View File

@ -12,13 +12,8 @@ import Button from '../../../components/ui/button'
const HELP_LINK = 'https://metamask.zendesk.com/hc/en-us/articles/360015489351-Importing-Accounts'
class JsonImportSubview extends Component {
constructor (props) {
super(props)
this.state = {
file: null,
fileContents: '',
}
state = {
fileContents: '',
}
render () {
@ -73,8 +68,10 @@ class JsonImportSubview extends Component {
)
}
onLoad (event, file) {
this.setState({file: file, fileContents: event.target.result})
onLoad (event) {
this.setState({
fileContents: event.target.result,
})
}
createKeyringOnEnter (event) {
@ -86,14 +83,7 @@ class JsonImportSubview extends Component {
createNewKeychain () {
const { firstAddress, displayWarning, importNewJsonAccount, setSelectedAddress, history } = this.props
const state = this.state
if (!state) {
const message = this.context.t('validFileImport')
return displayWarning(message)
}
const { fileContents } = state
const { fileContents } = this.state
if (!fileContents) {
const message = this.context.t('needImportFile')

View File

@ -64,7 +64,6 @@ export default class AddRecipient extends Component {
state = {
isShowingTransfer: false,
isShowingAllRecent: false,
}
selectRecipient = (to, nickname = '') => {

View File

@ -37,10 +37,9 @@ export default class EnsInput extends Component {
}
state = {
recipient: null,
input: '',
toError: null,
toWarning: null,
ensResolution: undefined,
}
componentDidMount () {
@ -234,7 +233,7 @@ export default class EnsInput extends Component {
}
ensIconContents () {
const { loadingEns, ensFailure, ensResolution, toError } = this.state || { ensResolution: ZERO_ADDRESS }
const { loadingEns, ensFailure, ensResolution, toError } = this.state
if (toError) {
return

View File

@ -23,7 +23,7 @@ export default class AddContact extends PureComponent {
}
state = {
nickname: '',
newName: '',
ethAddress: '',
ensAddress: '',
error: '',