Fix node/no-deprecated-api issues (#9670)

Refs #9663

See [`node/no-deprecated-api`][1] for more information.

This change enables `node/no-deprecated-api` and fixes the issues raised by the rule.

  [1]:https://github.com/mysticatea/eslint-plugin-node/blob/v11.1.0/docs/rules/no-deprecated-api.md

The change to the way that `punycode` is imported is to address the fact that
third-party module is hidden by the built-in. This is a silly hack but it works.
feature/default_network_editable
Whymarrh Whitby 4 years ago committed by GitHub
parent 07cffe92c6
commit 362e717eef
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 1
      .eslintrc.js
  2. 2
      app/scripts/controllers/ens/index.js
  3. 4
      app/scripts/lib/ens-ipfs/setup.js
  4. 3
      test/e2e/mock-3box/server.js
  5. 2
      ui/app/helpers/utils/util.js

@ -91,7 +91,6 @@ module.exports = {
// TODO: re-enable these rules
'accessor-pairs': 'off',
'node/no-sync': 'off',
'node/no-deprecated-api': 'off',
'node/no-unpublished-import': 'off',
'node/no-unpublished-require': 'off',
'node/no-unsupported-features/node-builtins': 'off',

@ -1,4 +1,4 @@
import punycode from 'punycode'
import punycode from 'punycode/punycode'
import ethUtil from 'ethereumjs-util'
import ObservableStore from 'obs-store'
import log from 'loglevel'

@ -1,4 +1,3 @@
import urlUtil from 'url'
import extension from 'extensionizer'
import resolveEnsToIpfsContentId from './resolver'
@ -26,8 +25,7 @@ export default function setupEnsIpfsResolver ({ provider, getCurrentNetwork, get
return
}
// parse ens name
const urlData = urlUtil.parse(url)
const { hostname: name, pathname, search, hash: fragment } = urlData
const { hostname: name, pathname, search, hash: fragment } = new URL(url)
const domainParts = name.split('.')
const topLevelDomain = domainParts[domainParts.length - 1]
// if unsupported TLD, abort

@ -1,5 +1,4 @@
const http = require('http')
const url = require('url')
const port = 8889
@ -20,7 +19,7 @@ const requestHandler = (request, response) => {
response.end('ok')
})
} else if (request.method === 'GET') {
const { key } = url.parse(request.url, true).query
const key = (new URL(request.url, 'https://example.org/')).searchParams.get('key')
response.setHeader('Access-Control-Allow-Headers', '*')
response.end(JSON.stringify(database[key] || ''))
} else {

@ -1,4 +1,4 @@
import punycode from 'punycode'
import punycode from 'punycode/punycode'
import abi from 'human-standard-token-abi'
import BigNumber from 'bignumber.js'
import ethUtil from 'ethereumjs-util'

Loading…
Cancel
Save