Skip to content

Commit

Permalink
fix: require to import
Browse files Browse the repository at this point in the history
  • Loading branch information
Justintime50 committed Sep 5, 2024
1 parent 7c34125 commit 0d25880
Show file tree
Hide file tree
Showing 8 changed files with 16 additions and 17 deletions.
3 changes: 1 addition & 2 deletions src/easypost.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import os from 'os';
import superagent from 'superagent';
import util from 'util';
import { v4 as uuid } from 'uuid';

import pkg from '../package.json';
Expand Down Expand Up @@ -36,8 +37,6 @@ import UserService from './services/user_service';
import WebhookService from './services/webhook_service';
import Utils from './utils/util';

const util = require('util');

/**
* How many milliseconds in a second.
* @type {number}
Expand Down
6 changes: 3 additions & 3 deletions src/services/api_key_service.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import baseService from './base_service';
import util from 'util';

import Constants from '../constants';
import FilteringError from '../errors/general/filtering_error';

const util = require('util');
import baseService from './base_service';

export default (easypostClient) =>
/**
Expand Down
6 changes: 3 additions & 3 deletions src/services/carrier_account_service.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import baseService from './base_service';
import util from 'util';

import Constants from '../constants';
import InvalidParameterError from '../errors/general/invalid_parameter_error';

const util = require('util');
import baseService from './base_service';

export default (easypostClient) =>
/**
Expand Down
3 changes: 1 addition & 2 deletions src/services/referral_customer_service.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
import superagent from 'superagent';
import util from 'util';

import Constants from '../constants';
import EasyPostClient from '../easypost';
import ExternalApiError from '../errors/api/external_api_error';
import baseService from './base_service';

const util = require('util');

/**
* Get an instance of the EasyPostClient using the referral user's API key.
* @private
Expand Down
6 changes: 3 additions & 3 deletions src/utils/util.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import crypto from 'crypto';
import util from 'util';

import Constants from '../constants';
import FilteringError from '../errors/general/filtering_error';
import InvalidParameterError from '../errors/general/invalid_parameter_error';
import SignatureVerificationError from '../errors/general/signature_verification_error';

const crypto = require('crypto');
const util = require('util');

/**
* Utility class of various publicly-available helper functions.
* @public
Expand Down
3 changes: 2 additions & 1 deletion test/helpers/common.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
import 'core-js/stable';

import chai from 'chai';
import chaiAsPromised from 'chai-as-promised';

/* eslint-disable no-console */
process.on('unhandledRejection', (err) => {
console.error(err, err.stack);
});

chai.should();
chai.use(require('chai-as-promised'));
chai.use(chaiAsPromised);
chai.config.truncateThreshold = 0;

global.expect = chai.expect;
Expand Down
2 changes: 1 addition & 1 deletion test/helpers/fixture.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const fs = require('fs');
import fs from 'fs';

export default class Fixture {
// Read fixture data from the fixtures JSON file
Expand Down
4 changes: 2 additions & 2 deletions webpack.config.babel.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const path = require('path');
const nodeExternals = require('webpack-node-externals');
import path from 'path';
import nodeExternals from 'webpack-node-externals';

const mode = process.env.NODE_ENV || 'development';
const isDev = mode === 'development';
Expand Down

0 comments on commit 0d25880

Please sign in to comment.