Skip to content

Commit cf95652

Browse files
author
Kristján Oddsson
authored
Update eslint packages (#375)
* chore: update the eslint packages * chore: run eslint --fix * chore: ignore new eslint rules * fix: move `eslint-disable` comments into scope * chore: empty commit to trigger build
1 parent 61dcd62 commit cf95652

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

67 files changed

+289
-208
lines changed

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ To run the project locally, first clone this repository...
2424
$ git clone https://github.com/apis-is/apis.git
2525
```
2626

27-
... install the dependencies and run the project.
27+
.... install the dependencies and run the project.
2828

2929
```sh
3030
$ npm install

config/index.js

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
/* eslint-disable import/no-dynamic-require */
2+
/* eslint-disable global-require */
13
import _ from 'lodash'
24
import makeDebug from 'debug'
35
import defaultConfig from './default.json'

endpoints/address/graphql_schema.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,6 @@ export default {
4444
},
4545
resolve: (_, args) => {
4646
const address = args.address.replace(' ', '+')
47-
return lookupAddresses(address).then((data) => data, (error) => error)
47+
return lookupAddresses(address).then(data => data, error => error)
4848
},
4949
}

endpoints/address/index.js

+6-7
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
1+
/* eslint-disable import/first */
12
import request from 'request'
23
import h from 'apis-helpers'
34
import app from '../../server'
45
import _ from 'lodash'
56

6-
const lookupAddresses = (address) => new Promise((resolve, reject) => {
7+
const lookupAddresses = address => new Promise((resolve, reject) => {
78
request.get({
89
headers: { 'User-Agent': h.browser() },
910
url: `https://api.postur.is/PosturIs/ws.asmx/GetPostals?address=${address}`,
@@ -13,11 +14,9 @@ const lookupAddresses = (address) => new Promise((resolve, reject) => {
1314
}
1415

1516
// There is a enclosing () in the response
16-
const data = _.flatten(
17-
JSON.parse(body.replace(/[()]/g, ''))
18-
)
17+
const data = _.flatten(JSON.parse(body.replace(/[()]/g, '')))
1918

20-
const results = _.map(data, (elem) => ({
19+
const results = _.map(data, elem => ({
2120
street: elem.Gata,
2221
house: elem.Husnumer,
2322
zip: elem.Postnumer,
@@ -41,8 +40,8 @@ app.get('/address/:address?', (req, res) => {
4140
}
4241

4342
lookupAddresses(address).then(
44-
(results) => res.cache().json({ results }),
45-
() => res.status(500).json({ error: 'www.postur.is refuses to respond or give back data' })
43+
results => res.cache().json({ results }),
44+
() => res.status(500).json({ error: 'www.postur.is refuses to respond or give back data' }),
4645
)
4746
})
4847

endpoints/aur/index.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -31,15 +31,15 @@ function queryHistory(callback) {
3131
// default is "1mon", "ytd" is from last new years eve to present
3232
queryGzipJson(
3333
'https://isx.is/api/historical-prices?currency=isk&market=aur&timeframe=1year',
34-
callback
34+
callback,
3535
)
3636
}
3737

3838
function queryTransactions(callback) {
3939
// set limit to OVER 9000
4040
queryGzipJson(
4141
'https://isx.is/api/transactions?currency=isk&market=aur&limit=9001',
42-
callback
42+
callback,
4343
)
4444
}
4545

endpoints/aur/tests/integration_test.js

+13-10
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
/* eslint-disable no-bitwise */
2+
/* eslint-disable import/first */
3+
/* eslint-disable import/extensions */
14
import request from 'request'
25
import helpers from '../../../lib/test_helpers.js'
36
import assert from 'assert'
@@ -44,11 +47,11 @@ describe('stats', function () {
4447
helpers.assertTypesOfFields(statsFieldsType, [json])
4548
assert(
4649
~transactionTypes.indexOf(json.last_transaction_type),
47-
`Unexpected transaction type '${json.last_transaction_type}'`
50+
`Unexpected transaction type '${json.last_transaction_type}'`,
4851
)
4952
assert(
5053
moment(json.timestampApis, timestampFormat, true).isValid(),
51-
`Unexpected timestamp format, ${json.timestampApis}' does not match ${timestampFormat}`
54+
`Unexpected timestamp format, ${json.timestampApis}' does not match ${timestampFormat}`,
5255
)
5356
done()
5457
})
@@ -81,21 +84,21 @@ describe('history', function () {
8184
helpers.assertTypesOfFields(historyFieldsType, json.results)
8285
assert(
8386
json.currency.constructor === String,
84-
'Unexpected currency type, should be String'
87+
'Unexpected currency type, should be String',
8588
)
8689
assert(
8790
json.market.constructor === String,
88-
'Unexpected market type, should be String'
91+
'Unexpected market type, should be String',
8992
)
9093
assert(
9194
moment(json.timestampApis, timestampFormat, true).isValid(),
92-
`Unexpected timestamp format, '${json.timestampApis}' does not match ${timestampFormat}`
95+
`Unexpected timestamp format, '${json.timestampApis}' does not match ${timestampFormat}`,
9396
)
9497
json.results.forEach((result, i) => {
9598
assert(
9699
moment(result.date, dateFormat, true).isValid(),
97100
(`Unexpected date format in result #${i};` +
98-
` '${result.date}' does not match ${dateFormat}`)
101+
` '${result.date}' does not match ${dateFormat}`),
99102
)
100103
})
101104
done()
@@ -131,12 +134,12 @@ describe('transactions', function () {
131134
json.results.forEach((result, i) => {
132135
assert(
133136
~transactionTypes.indexOf(result.type),
134-
`Unexpected transaction type '${result.type}' in result #${i}`
137+
`Unexpected transaction type '${result.type}' in result #${i}`,
135138
)
136139
assert(
137140
moment(result.timestamp, timestampFormat, true).isValid(),
138141
(`Unexpected timestamp format in result #${i};` +
139-
` '${result.timestamp}' does not match ${timestampFormat}`)
142+
` '${result.timestamp}' does not match ${timestampFormat}`),
140143
)
141144
})
142145
done()
@@ -171,7 +174,7 @@ describe('order-book', function () {
171174
assert(
172175
moment(result.timestamp, timestampFormat, true).isValid(),
173176
(`Unexpected timestamp format in ask result #${i};` +
174-
` '${result.timestamp}' does not match ${timestampFormat}`)
177+
` '${result.timestamp}' does not match ${timestampFormat}`),
175178
)
176179
})
177180
assert(json.bid, 'Does not contain a \'bid\' field')
@@ -181,7 +184,7 @@ describe('order-book', function () {
181184
assert(
182185
moment(result.timestamp, timestampFormat, true).isValid(),
183186
(`Unexpected timestamp format in bid result #${i};` +
184-
` "${result.timestamp}" does not match ${timestampFormat}`)
187+
` "${result.timestamp}" does not match ${timestampFormat}`),
185188
)
186189
})
187190
done()

endpoints/bus/graphql_schema.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,6 @@ export default {
3333
busses: { type: GraphQLString },
3434
},
3535
resolve: (_, args) => {
36-
return getBusRoutes(args).then((data) => data.results, (error) => error)
36+
return getBusRoutes(args).then(data => data.results, error => error)
3737
},
3838
}

endpoints/calendar/index.js

+12-8
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
1+
/* eslint-disable prefer-promise-reject-errors */
2+
/* eslint-disable import/first */
13
import app from '../../server'
24
import fridagar from 'fridagar'
35
import makeDebug from 'debug'
46
import { range, isString } from 'lodash'
57

68
const debug = makeDebug('endpoint:calendar')
79

8-
const canBeInt = intLike => {
10+
const canBeInt = (intLike) => {
911
const num = Number.parseInt(intLike, 10)
1012
return !Number.isNaN(num)
1113
}
@@ -20,7 +22,9 @@ export const normalizeParams = (year, month, day) => {
2022
}
2123

2224
const lookupHolidays = (yearStr, monthStr, dayStr) => new Promise((resolve, reject) => {
23-
const { year, month, day, error } = normalizeParams(yearStr, monthStr, dayStr)
25+
const {
26+
year, month, day, error,
27+
} = normalizeParams(yearStr, monthStr, dayStr)
2428

2529
// Reject promise with relevant error when in error states
2630
if (error) reject({ error })
@@ -68,24 +72,24 @@ app.get('/calendar/:year', (req, res) => {
6872
const { year } = req.params
6973

7074
lookupHolidays(year)
71-
.then((holidays) => res.json({ results: holidays }))
72-
.catch((error) => res.status(400).json(error))
75+
.then(holidays => res.json({ results: holidays }))
76+
.catch(error => res.status(400).json(error))
7377
})
7478

7579
app.get('/calendar/:year/:month', (req, res) => {
7680
const { year, month } = req.params
7781

7882
lookupHolidays(year, month)
79-
.then((holidays) => res.json({ results: holidays }))
80-
.catch((error) => res.status(400).json(error))
83+
.then(holidays => res.json({ results: holidays }))
84+
.catch(error => res.status(400).json(error))
8185
})
8286

8387
app.get('/calendar/:year/:month/:day', (req, res) => {
8488
const { year, month, day } = req.params
8589

8690
lookupHolidays(year, month, day)
87-
.then((holiday) => res.json({ results: holiday }))
88-
.catch((error) => res.status(400).json(error))
91+
.then(holiday => res.json({ results: holiday }))
92+
.catch(error => res.status(400).json(error))
8993
})
9094

9195
export default lookupHolidays

endpoints/car/graphql_schema.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -66,5 +66,5 @@ export default {
6666
},
6767
resolve: (_, { carPlate }) => lookupCar(carPlate)
6868
.then(data => data)
69-
.catch(error => { throw new Error(error) }),
69+
.catch((error) => { throw new Error(error) }),
7070
}

endpoints/car/index.js

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
/* eslint-disable prefer-promise-reject-errors */
12
import request from 'request'
23
import $ from 'cheerio'
34
import h from 'apis-helpers'

endpoints/car/tests/integration_test.js

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
/* eslint-disable import/extensions */
12
import request from 'request'
23
import helpers from '../../../lib/test_helpers.js'
34

endpoints/carparks/index.js

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
/* eslint-disable no-restricted-globals */
2+
/* eslint-disable no-plusplus */
13
import request from 'request'
24
import $ from 'cheerio'
35
import h from 'apis-helpers'

endpoints/carparks/tests/integration_test.js

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
/* eslint-disable import/extensions */
12
import request from 'request'
23
import helpers from '../../../lib/test_helpers.js'
34

endpoints/company/tests/integration_test.js

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
/* eslint-disable import/extensions */
12
import request from 'request'
23
import helpers from '../../../lib/test_helpers.js'
34

endpoints/concerts/index.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,15 @@ app.get('/concerts', (req, res) => {
1313
})
1414
}
1515
const events = JSON.parse(body)
16-
const filtered = _.map(events, (event) => (
16+
const filtered = _.map(events, event => (
1717
_.pick(
1818
event,
1919
'eventDateName',
2020
'name',
2121
'dateOfShow',
2222
'userGroupName',
2323
'eventHallName',
24-
'imageSource'
24+
'imageSource',
2525
)
2626
))
2727
return res.json({ results: filtered })

endpoints/concerts/tests/integration_test.js

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
/* eslint-disable import/extensions */
12
import request from 'request'
23
import helpers from '../../../lib/test_helpers.js'
34

endpoints/currency/borgun.js

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
1+
/* eslint-disable no-plusplus */
2+
/* eslint-disable prefer-destructuring */
13
import request from 'request'
24
import xml2js from 'xml2js'
35
import app from '../../server'
6+
47
const parseString = xml2js.parseString
58

69
app.get('/currency/borgun', (req, res) => {
@@ -31,6 +34,6 @@ app.get('/currency/borgun', (req, res) => {
3134
}
3235
return res.json({ results: currencies })
3336
})
34-
}
37+
},
3538
)
3639
})

endpoints/currency/lb.js

+4-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
1+
/* eslint-disable no-plusplus */
2+
/* eslint-disable prefer-destructuring */
13
import request from 'request'
24
import xml2js from 'xml2js'
35
import app from '../../server'
6+
47
const parseString = xml2js.parseString
58

69
app.get('/currency/lb/:type?', (req, res) => {
@@ -30,6 +33,5 @@ app.get('/currency/lb/:type?', (req, res) => {
3033
}
3134
return res.json({ results: currencies })
3235
})
33-
}
34-
)
36+
})
3537
})

endpoints/currency/m5.js

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
/* eslint-disable import/first */
12
import request from 'request'
23
import h from 'apis-helpers'
34
import app from '../../server'

endpoints/currency/tests/integration_test.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
1+
/* eslint-disable import/extensions */
12
import request from 'request'
23
import helpers from '../../../lib/test_helpers.js'
34

45
describe('currency', () => {
5-
// The only thing that changes is the form attribute, so why not just re-use the object
6+
// The only thing that changes is the form attribute, so why not just re-use the object
67
const fieldsToCheckFor = ['shortName', 'longName', 'value', 'askValue', 'bidValue', 'changeCur', 'changePer']
78

89
describe('searching using provider "m5"', () => {

endpoints/cyclecounter/index.js

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
1+
/* eslint-disable prefer-destructuring */
12
import request from 'request'
23
import xml2js from 'xml2js'
34
import app from '../../server'
5+
46
const parseString = xml2js.parseString
57

68
app.get('/cyclecounter', (req, res) => {
@@ -22,6 +24,5 @@ app.get('/cyclecounter', (req, res) => {
2224

2325
return res.json({ results: cyclecounter })
2426
})
25-
}
26-
)
27+
})
2728
})

endpoints/cyclecounter/tests/integration_test.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
1+
/* eslint-disable import/extensions */
12
import request from 'request'
23
import helpers from '../../../lib/test_helpers.js'
34

45
describe('cyclecounter', () => {
5-
// The only thing that changes is the form attribute, so why not just re-use the object
6+
// The only thing that changes is the form attribute, so why not just re-use the object
67
const fieldsToCheckFor = ['DayCount', 'YearCount', 'Time', 'Date']
78

89
it('should return an array of objects containing correct fields', (done) => {

endpoints/declension/index.js

+3
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
/* eslint-disable prefer-destructuring */
2+
/* eslint-disable no-mixed-operators */
3+
/* eslint-disable import/first */
14
import app from '../../server'
25
import request from 'request'
36
import helper from 'apis-helpers'

endpoints/declension/tests/integration_test.js

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
/* eslint-disable import/extensions */
12
import request from 'request'
23
import helpers from '../../../lib/test_helpers.js'
34

0 commit comments

Comments
 (0)