Closed Drarig29 closed 2 years ago
You have some eslint errors:
error: Unnecessary escape character: \- (no-useless-escape) at src/lib/sign/sign.js:5:130: 3 | 4 | function isDomain(val) { > 5 | const domain_regex = /^(?!(https:\/\/|http:\/\/|www\.|mailto:|smtp:|ftp:\/\/|ftps:\/\/))(((([a-zA-Z0-9])|([a-zA-Z0-9][a-zA-Z0-9\-]{0,86}[a-zA-Z0-9]))\.(([a-zA-Z0-9])|([a-zA-Z0-9][a-zA-Z0-9\-]{0,73}[a-zA-Z0-9]))\.(([a-zA-Z0-9]{2,12}\.[a-zA-Z0-9]{2,12})|([a-zA-Z0-9]{2,25})))|((([a-zA-Z0-9])|([a-zA-Z0-9][a-zA-Z0-9\-]{0,162}[a-zA-Z0-9]))\.(([a-zA-Z0-9]{2,12}\.[a-zA-Z0-9]{2,12})|([a-zA-Z0-9]{2,25}))))$/g; | ^ 6 | return domain_regex.test(val); 7 | } 8 | error: Unnecessary escape character: \- (no-useless-escape) at src/lib/sign/sign.js:5:191: 3 | 4 | function isDomain(val) { > 5 | const domain_regex = /^(?!(https:\/\/|http:\/\/|www\.|mailto:|smtp:|ftp:\/\/|ftps:\/\/))(((([a-zA-Z0-9])|([a-zA-Z0-9][a-zA-Z0-9\-]{0,86}[a-zA-Z0-9]))\.(([a-zA-Z0-9])|([a-zA-Z0-9][a-zA-Z0-9\-]{0,73}[a-zA-Z0-9]))\.(([a-zA-Z0-9]{2,12}\.[a-zA-Z0-9]{2,12})|([a-zA-Z0-9]{2,25})))|((([a-zA-Z0-9])|([a-zA-Z0-9][a-zA-Z0-9\-]{0,162}[a-zA-Z0-9]))\.(([a-zA-Z0-9]{2,12}\.[a-zA-Z0-9]{2,12})|([a-zA-Z0-9]{2,25}))))$/g; | ^ 6 | return domain_regex.test(val); 7 | } 8 | error: Unnecessary escape character: \- (no-useless-escape) at src/lib/sign/sign.js:5:315: 3 | 4 | function isDomain(val) { > 5 | const domain_regex = /^(?!(https:\/\/|http:\/\/|www\.|mailto:|smtp:|ftp:\/\/|ftps:\/\/))(((([a-zA-Z0-9])|([a-zA-Z0-9][a-zA-Z0-9\-]{0,86}[a-zA-Z0-9]))\.(([a-zA-Z0-9])|([a-zA-Z0-9][a-zA-Z0-9\-]{0,73}[a-zA-Z0-9]))\.(([a-zA-Z0-9]{2,12}\.[a-zA-Z0-9]{2,12})|([a-zA-Z0-9]{2,25})))|((([a-zA-Z0-9])|([a-zA-Z0-9][a-zA-Z0-9\-]{0,162}[a-zA-Z0-9]))\.(([a-zA-Z0-9]{2,12}\.[a-zA-Z0-9]{2,12})|([a-zA-Z0-9]{2,25}))))$/g; | ^ 6 | return domain_regex.test(val); 7 | } 8 | error: Unexpected negating the left operand of 'instanceof' operator (no-unsafe-negation) at src/lib/sign/sign.js:72:32: 70 | } 71 | > 72 | if(params.expiration_time && !params.expiration_time instanceof Date) { | ^ 73 | throw new Error('expiration_time must be an instance of Date'); 74 | } 75 | error: Unexpected negating the left operand of 'instanceof' operator (no-unsafe-negation) at src/lib/sign/sign.js:76:27: 74 | } 75 | > 76 | if(params.not_before && !params.expiration_time instanceof Date) { | ^ 77 | throw new Error('expiration_time must be an instance of Date'); 78 | } 79 | }; error: 'signature' is assigned a value but never used (no-unused-vars) at src/lib/verify/verify.js:69:35: 67 | export const verify = (token, params = {}) => { 68 | > 69 | const { version, address, body, signature } = decrypt(token); | ^ 70 | 71 | if(version === 1) { 72 | throw new Error('Tokens version 1 are not supported by the current version of module') error: 'Web3' is not defined (no-undef) at src/main.js:6:20: 4 | 5 | // Connection to MetaMask wallet > 6 | const web3 = new Web3(ethereum); | ^ 7 | await ethereum.request({ method: 'eth_requestAccounts'}); 8 | 9 | // getting address from which we will sign message error: 'ethereum' is not defined (no-undef) at src/main.js:6:25: 4 | 5 | // Connection to MetaMask wallet > 6 | const web3 = new Web3(ethereum); | ^ 7 | await ethereum.request({ method: 'eth_requestAccounts'}); 8 | 9 | // getting address from which we will sign message error: 'ethereum' is not defined (no-undef) at src/main.js:7:9: 5 | // Connection to MetaMask wallet 6 | const web3 = new Web3(ethereum); > 7 | await ethereum.request({ method: 'eth_requestAccounts'}); | ^ 8 | 9 | // getting address from which we will sign message 10 | const your_address = (await web3.eth.getAccounts())[0];
You have some eslint errors: