Skip to content
This repository has been archived by the owner on Apr 3, 2019. It is now read-only.

Commit

Permalink
fix(deprecation): #2343 Check for deprecated APIs
Browse files Browse the repository at this point in the history
  • Loading branch information
deeptibaghel committed Mar 14, 2018
1 parent ab7ba5a commit 91c48e5
Show file tree
Hide file tree
Showing 7 changed files with 25 additions and 13 deletions.
17 changes: 14 additions & 3 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -1,7 +1,18 @@
extends:
- plugin:fxa/server
- plugin:node/recommended

plugins:
- fxa
extends: plugin:fxa/server
- node

root: true

rules:
handle-callback-err: 0
strict: 2
node/no-missing-require: off
node/no-unpublished-require: off
node/shebang: off

handle-callback-err: off
no-process-exit: off
strict: error
4 changes: 2 additions & 2 deletions lib/crypto/butil.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

'use strict'

module.exports.ONES = Buffer('ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff', 'hex')
module.exports.ONES = Buffer.from('ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff', 'hex')

module.exports.buffersAreEqual = function buffersAreEqual(buffer1, buffer2) {
buffer1 = Buffer.from(buffer1, 'hex')
Expand All @@ -29,7 +29,7 @@ module.exports.xorBuffers = function xorBuffers(buffer1, buffer2) {
buffer2.length
)
}
var result = Buffer(buffer1.length)
var result = Buffer.alloc(buffer1.length)
for (var i = 0; i < buffer1.length; i++) {
result[i] = buffer1[i] ^ buffer2[i]
}
Expand Down
1 change: 1 addition & 0 deletions lib/routes/validators.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
'use strict'

var url = require('url')
// eslint-disable-next-line node/no-deprecated-api
var punycode = require('punycode')
var isA = require('joi')

Expand Down
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@
"otplib": "7.0.0",
"po2json": "0.4.5",
"poolee": "1.0.1",
"punycode": "^2.1.0",
"qrcode": "1.2.0",
"raven": "2.1.2",
"redis": "2.7.1",
Expand All @@ -86,6 +87,7 @@
"acorn": "5.0.3",
"commander": "2.9.0",
"eslint-plugin-fxa": "git+https://github.com/mozilla/eslint-plugin-fxa#master",
"eslint-plugin-node": "^6.0.1",
"fxa-auth-db-mysql": "git+https://github.com/mozilla/fxa-auth-db-mysql.git#master",
"fxa-conventional-changelog": "1.1.0",
"grunt": "1.0.1",
Expand Down
4 changes: 2 additions & 2 deletions test/local/crypto/butil.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ describe('butil', () => {
it(
'returns true if buffers have same bytes',
() => {
const b1 = Buffer('abcd', 'hex')
const b2 = Buffer('abcd', 'hex')
const b1 = Buffer.from('abcd', 'hex')
const b2 = Buffer.from('abcd', 'hex')
assert.equal(butil.buffersAreEqual(b1, b2), true)
}
)
Expand Down
7 changes: 3 additions & 4 deletions test/local/senders/email.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
const ROOT_DIR = '../../..'

const assert = require('insist')
const extend = require('util')._extend
const sinon = require('sinon')
const P = require('bluebird')

Expand Down Expand Up @@ -439,7 +438,7 @@ describe(
it(
'location is correct with city, country for ' + type,
function () {
var location = extend({}, defaultLocation)
var location = Object.assign({}, defaultLocation)
delete location.stateCode
var message = getLocationMessage(location)

Expand All @@ -455,7 +454,7 @@ describe(
it(
'location is correct with stateCode, country for ' + type,
function () {
var location = extend({}, defaultLocation)
var location = Object.assign({}, defaultLocation)
delete location.city
var message = getLocationMessage(location)

Expand All @@ -470,7 +469,7 @@ describe(
it(
'location is correct with country for ' + type,
function () {
var location = extend({}, defaultLocation)
var location = Object.assign({}, defaultLocation)
delete location.city
delete location.stateCode
var message = getLocationMessage(location)
Expand Down
3 changes: 1 addition & 2 deletions test/mocks.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@

const assert = require('assert')
const sinon = require('sinon')
const extend = require('util')._extend
const P = require('../lib/promise')
const crypto = require('crypto')
const config = require('../config').getProperties()
Expand Down Expand Up @@ -373,7 +372,7 @@ function mockObject (methodNames) {
}

function mockPush (methods) {
const push = extend({}, methods)
const push = Object.assign({}, methods)
// So far every push method has a uid for first argument, let's keep it simple.
PUSH_METHOD_NAMES.forEach((name) => {
if (! push[name]) {
Expand Down

0 comments on commit 91c48e5

Please sign in to comment.