Skip to content

Commit

Permalink
eslint fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
daveslusher-lm committed Aug 24, 2022
1 parent 7cdd3fb commit 2fc7fbf
Show file tree
Hide file tree
Showing 23 changed files with 84 additions and 81 deletions.
32 changes: 32 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{
"env": {
"browser": true,
"commonjs": true,
"es2021": true,
"node": true
},
"extends": "eslint:recommended",
"overrides": [
],
"parserOptions": {
"ecmaVersion": "latest"
},
"rules": {
"indent": [
"error",
4
],
"linebreak-style": [
"error",
"unix"
],
"quotes": [
"error",
"single"
],
"semi": [
"error",
"always"
]
}
}
2 changes: 1 addition & 1 deletion src/access_token_utils.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const storage = require('node-persist');
const { ClientCredentials, ResourceOwnerPassword, AuthorizationCode } = require('simple-oauth2');
const { ClientCredentials } = require('simple-oauth2');
const TOKEN_KEY = 'accesstoken'
const debug = require('debug')('auth')
const path = require('path');
Expand Down
4 changes: 2 additions & 2 deletions src/base_lm_request.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ module.exports = class BaseLexMachinaRequest {

async requestURL(config) {
const rax = await import('retry-axios');
const interceptorId = rax.attach();
rax.attach();

var returnValue = null
var urlParams = null
Expand All @@ -29,7 +29,7 @@ module.exports = class BaseLexMachinaRequest {
var token = await this.atu.getAccessToken();
if (config.params) {
urlParams = new URLSearchParams();
var key = Object.keys(config.params).forEach(key => {
Object.keys(config.params).forEach(key => {
if (Array.isArray(config.params[key])) {
config.params[key].forEach(value => {
urlParams.append(key, value)
Expand Down
2 changes: 1 addition & 1 deletion src/query_district_cases.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ module.exports = class QueryDistrictCases {
}

async queryOnePage(query, options) {
var config = {}
var config = options;
config.endpoint = '/query-district-cases'
config.method = 'post'
config.data = query.getPostBody()
Expand Down
7 changes: 4 additions & 3 deletions test/test_access_token_utils.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
var chai = require('chai');
chai.use(require('chai-things'));
chai.use(require('chai-as-promised'))
const assert = chai.assert;
const expect = chai.expect;
chai.should();

Expand Down Expand Up @@ -33,13 +32,15 @@ describe("Access Token Utility Functions", () => {
it("should throw error with nonexistent file constructor", () => {
function badConfigFile() {
var atu = new AccessTokenUtils("../config/nonexistent.json");
atu;
}
expect(badConfigFile).to.throw()
})

it("should throw error with nonexistent file constructor", () => {
function badConfigFile() {
var atu = new AccessTokenUtils("../config/nonexistent.json");
atu;
}
expect(badConfigFile).to.throw()
})
Expand All @@ -49,8 +50,8 @@ describe("Access Token Utility Functions", () => {
it("should get token from API and store via node-persist", async () => {
var atu = new AccessTokenUtils();
nock.enableNetConnect();
doFetch = atu.fetchTokenIntoStorage();
const { nockDone, context } = await nockBack('access-token-success.json');
const doFetch = atu.fetchTokenIntoStorage();
const { nockDone} = await nockBack('access-token-success.json');
await expect(doFetch).to.be.fulfilled;
nockDone();
})
Expand Down
7 changes: 3 additions & 4 deletions test/test_attorneys.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
var chai = require('chai');
chai.use(require('chai-things'));
chai.use(require('chai-as-promised'))
const assert = chai.assert;
const expect = chai.expect;
chai.should();

Expand All @@ -18,7 +17,7 @@ describe("Attorney Endpoints", () => {

describe('Lookup Attorney', () => {
it('should contain single attorney information', async () => {
const { nockDone, context } = await nockBack('attorneys-single-data.json');
const { nockDone} = await nockBack('attorneys-single-data.json');
nock.enableNetConnect();
const client = new LexMachinaClient();
var attorney = await client.attorneys(attorneyId);
Expand All @@ -31,7 +30,7 @@ describe("Attorney Endpoints", () => {
describe('Lookup Attorneys', () => {

it('should contain multiple attorney information', async () => {
const { nockDone, context } = await nockBack('attorneys-multiple-data.json');
const { nockDone} = await nockBack('attorneys-multiple-data.json');
nock.enableNetConnect();
const client = new LexMachinaClient();
var attorneys = await client.attorneys(attorneyIds);
Expand All @@ -51,7 +50,7 @@ describe("Attorney Endpoints", () => {
var attorneyBadInput;
it("bad input throws error", async () => {
const client = new LexMachinaClient();
const { nockDone, context } = await nockBack('attorneys-single-data.json');
const { nockDone} = await nockBack('attorneys-single-data.json');
nock.enableNetConnect();
attorneysNoInput = client.attorneys();
attorneyBadInput = client.attorneys("Invalid String Input");
Expand Down
19 changes: 3 additions & 16 deletions test/test_case_query.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
const CasesQueryRequest = require('../src/case_query_request.js')
var chai = require('chai');
const assert = require('chai').assert;
const expect = require('chai').expect;
const expect = chai.expect;
chai.should();
chai.use(require('chai-things'));

Expand Down Expand Up @@ -269,7 +268,6 @@ describe('Add and Remove Query Statements', () => {
caseQuery.clear();

// Awarded Against Parties
var caseQuery = new CasesQueryRequest();
caseQuery.addFindingsIncludeAwardedAgainstParties(1234)
expect(caseQuery.queryObject.Findings.Include.AwardedAgainstParties).to.have.lengthOf(1);
caseQuery.addFindingsIncludeAwardedAgainstParties(1234)
Expand All @@ -287,7 +285,6 @@ describe('Add and Remove Query Statements', () => {
caseQuery.clear();

// Judgment Sources
var caseQuery = new CasesQueryRequest();
caseQuery.addFindingsIncludeJudgmentSource(1234)
expect(caseQuery.queryObject.Findings.Include.JudgmentSource).to.have.lengthOf(1);
caseQuery.addFindingsIncludeJudgmentSource(1234)
Expand All @@ -303,7 +300,6 @@ describe('Add and Remove Query Statements', () => {
caseQuery.clear();

// Patent Invalidity Reasons
var caseQuery = new CasesQueryRequest();
caseQuery.addFindingsIncludePatentInvalidityReasons(1234)
expect(caseQuery.queryObject.Findings.Include.PatentInvalidityReasons).to.have.lengthOf(1);
caseQuery.addFindingsIncludePatentInvalidityReasons(1234)
Expand Down Expand Up @@ -378,7 +374,6 @@ describe('Add and Remove Query Statements', () => {
caseQuery.clear();

// Awarded Against Parties
var caseQuery = new CasesQueryRequest();
caseQuery.addRemediesIncludeAwardedAgainstParties(1234)
expect(caseQuery.queryObject.Remedies.Include.AwardedAgainstParties).to.have.lengthOf(1);
caseQuery.addRemediesIncludeAwardedAgainstParties(1234)
Expand All @@ -394,7 +389,6 @@ describe('Add and Remove Query Statements', () => {
caseQuery.clear();

// Judgment Sources
var caseQuery = new CasesQueryRequest();
caseQuery.addRemediesIncludeJudgmentSource(1234)
expect(caseQuery.queryObject.Remedies.Include.JudgmentSource).to.have.lengthOf(1);
caseQuery.addRemediesIncludeJudgmentSource(1234)
Expand Down Expand Up @@ -481,7 +475,6 @@ describe('Add and Remove Query Statements', () => {
caseQuery.clear();

// Awarded Against Parties
var caseQuery = new CasesQueryRequest();
caseQuery.addDamagesIncludeAwardedAgainstParties(1234)
expect(caseQuery.queryObject.Damages.Include.AwardedAgainstParties).to.have.lengthOf(1);
caseQuery.addDamagesIncludeAwardedAgainstParties(1234)
Expand All @@ -497,7 +490,6 @@ describe('Add and Remove Query Statements', () => {
caseQuery.clear();

// Judgment Sources
var caseQuery = new CasesQueryRequest();
caseQuery.addDamagesIncludeJudgmentSource(1234)
expect(caseQuery.queryObject.Damages.Include.JudgmentSource).to.have.lengthOf(1);
caseQuery.addDamagesIncludeJudgmentSource(1234)
Expand All @@ -513,7 +505,6 @@ describe('Add and Remove Query Statements', () => {
caseQuery.clear();

// Name
var caseQuery = new CasesQueryRequest();
caseQuery.addDamagesIncludeName(1234)
expect(caseQuery.queryObject.Damages.Include.Name).to.have.lengthOf(1);
caseQuery.addDamagesIncludeName(1234)
Expand All @@ -531,7 +522,6 @@ describe('Add and Remove Query Statements', () => {
caseQuery.clear();

// Type
var caseQuery = new CasesQueryRequest();
caseQuery.addDamagesIncludeType(1234)
expect(caseQuery.queryObject.Damages.Include.Type).to.have.lengthOf(1);
caseQuery.addDamagesIncludeType(1234)
Expand Down Expand Up @@ -734,7 +724,6 @@ describe('Add and Remove Query Statements', () => {
describe('Courts', () => {
var court = "njd"
var array1 = ["njd", "dcd", "ord"]
var array2 = ["dcd", "ord", "alsd"]

it('should be able to add and remove courts includes and excludes', () => {
var caseQuery = new CasesQueryRequest();
Expand Down Expand Up @@ -799,8 +788,7 @@ describe('Add and Remove Query Statements', () => {

describe('Law Firms', () => {
var lawFirm = 1234
var array1 = [1234, 2345, 3456,]
var array2 = [2345, 3456, 4567]
var array1 = [1234, 2345, 3456]

it('should be able to add and remove lawFirms includes and excludes', () => {
var caseQuery = new CasesQueryRequest();
Expand Down Expand Up @@ -1012,8 +1000,7 @@ describe('Add and Remove Query Statements', () => {

describe('Parties', () => {
var party = 1234
var array1 = [1234, 2345, 3456,]
var array2 = [2345, 3456, 4567]
var array1 = [1234, 2345, 3456]

it('should be able to add and remove parties includes and excludes', () => {
var caseQuery = new CasesQueryRequest();
Expand Down
5 changes: 2 additions & 3 deletions test/test_case_resolutions.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
var chai = require('chai');
const assert = require('chai').assert;
const expect = require('chai').expect;
const expect = chai.expect;
chai.should();
chai.use(require('chai-things'));
const nock = require('nock');
Expand All @@ -12,7 +11,7 @@ nockBack.setMode('record');
describe('List Case Resolutions', () => {

it('should contain case resolutions', async () => {
const { nockDone, context } = await nockBack('list-case-resolutions-data.json');
const { nockDone} = await nockBack('list-case-resolutions-data.json');
nock.enableNetConnect();
const client = new LexMachinaClient();
var caseResolutions = await client.listCaseResolutions();
Expand Down
5 changes: 2 additions & 3 deletions test/test_case_tags.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
var chai = require('chai');
const assert = require('chai').assert;
const expect = require('chai').expect;
const expect = chai.expect;
chai.should();
chai.use(require('chai-things'));
const nock = require('nock');
Expand All @@ -12,7 +11,7 @@ nockBack.setMode('record');
describe('List Case Tags', () => {

it('should contain case tags', async () => {
const { nockDone, context } = await nockBack('list-case-tags-data.json');
const { nockDone} = await nockBack('list-case-tags-data.json');
nock.enableNetConnect();
const client = new LexMachinaClient();
var caseTypes = await client.listCaseTags();
Expand Down
5 changes: 2 additions & 3 deletions test/test_case_types.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
var chai = require('chai');
const assert = require('chai').assert;
const expect = require('chai').expect;
const expect = chai.expect;
chai.should();
chai.use(require('chai-things'));
const nock = require('nock');
Expand All @@ -12,7 +11,7 @@ nockBack.setMode('record');
describe('List Case Types', () => {

it('should contain case types', async () => {
const { nockDone, context } = await nockBack('list-case-types-data.json');
const { nockDone} = await nockBack('list-case-types-data.json');
nock.enableNetConnect();
const client = new LexMachinaClient();
var caseTypes = await client.listCaseTypes();
Expand Down
5 changes: 2 additions & 3 deletions test/test_courts.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
var chai = require('chai');
const assert = require('chai').assert;
const expect = require('chai').expect;
const expect = chai.expect;
chai.should();
chai.use(require('chai-things'));
const nock = require('nock');
Expand All @@ -12,7 +11,7 @@ nockBack.setMode('record');
describe('List Courts', () => {

it('should contain courts', async () => {
const { nockDone, context } = await nockBack('list-courts-data.json');
const { nockDone} = await nockBack('list-courts-data.json');
nock.enableNetConnect();
const client = new LexMachinaClient();
var courts = await client.listCourts();
Expand Down
5 changes: 2 additions & 3 deletions test/test_damages.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
var chai = require('chai');
const assert = require('chai').assert;
const expect = require('chai').expect;
const expect = chai.expect;
chai.should();
chai.use(require('chai-things'));
const nock = require('nock');
Expand All @@ -12,7 +11,7 @@ nockBack.setMode('record');
describe('List Damages', () => {

it('should contain damages', async () => {
const { nockDone, context } = await nockBack('list-damages-data.json');
const { nockDone} = await nockBack('list-damages-data.json');
nock.enableNetConnect();
const client = new LexMachinaClient();
var damages = await client.listDamages();
Expand Down
5 changes: 2 additions & 3 deletions test/test_district_cases.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
var chai = require('chai');
chai.use(require('chai-things'));
chai.use(require('chai-as-promised'))
const assert = chai.assert;
const expect = chai.expect;
chai.should();
const nock = require('nock');
Expand All @@ -15,7 +14,7 @@ describe("District Case Endpoint", () => {
describe('Lookup District Case', () => {

it('should contain case information', async () => {
const { nockDone, context } = await nockBack('district-case-data.json');
const { nockDone} = await nockBack('district-case-data.json');
nock.enableNetConnect();
const client = new LexMachinaClient();
var districtCase = await client.districtCases(caseId);
Expand All @@ -29,7 +28,7 @@ describe("District Case Endpoint", () => {
describe('Error Handling', () => {
it("bad input throws error", async () => {
const client = new LexMachinaClient();
const { nockDone, context } = await nockBack('district-case-data.json');
const { nockDone} = await nockBack('district-case-data.json');
nock.enableNetConnect();
var caseNoInput = client.districtCases();
var caseBadInput = client.districtCases("This is invalid input");
Expand Down
5 changes: 2 additions & 3 deletions test/test_health.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
var chai = require('chai');
const assert = require('chai').assert;
const expect = require('chai').expect;
const expect = chai.expect;
chai.should();
const nock = require('nock');
const nockBack = require('nock').back;
Expand All @@ -11,7 +10,7 @@ nockBack.setMode('record');
describe('Health Check', () => {

it('should register health', async () => {
const { nockDone, context } = await nockBack('health-data.json');
const { nockDone} = await nockBack('health-data.json');
nock.enableNetConnect();
const client = new LexMachinaClient();
var health = await client.health();
Expand Down
Loading

0 comments on commit 2fc7fbf

Please sign in to comment.