Skip to content

Commit 3248851

Browse files
committed
Good bye babel
RIP
1 parent 03df423 commit 3248851

File tree

85 files changed

+257
-266
lines changed

Some content is hidden

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

85 files changed

+257
-266
lines changed

.babelrc

-3
This file was deleted.

.eslintrc

-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
{
2-
"parser": "babel-eslint",
32
"extends": "airbnb/base",
43
"rules": {
54
"arrow-body-style": ["off"],

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ for more info.
6464
3. The file will be loaded automatically. Remember to require the server. Bare minimum example endpoint:
6565

6666
```javascript
67-
import app from '../../server';
67+
const app = require('../../server');
6868

6969
app.get('/path', (req,res) => {
7070
//Sends out empty json object

config/index.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
/* eslint-disable import/no-dynamic-require */
22
/* eslint-disable global-require */
3-
import _ from 'lodash'
4-
import makeDebug from 'debug'
5-
import defaultConfig from './default.json'
3+
const _ = require('lodash')
4+
const makeDebug = require('debug')
5+
const defaultConfig = require('./default.json')
66

77
const debug = makeDebug('config')
88

endpoints/address/graphql_schema.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
import {
1+
const {
22
GraphQLObjectType,
33
GraphQLList,
44
GraphQLString,
5-
} from 'graphql'
5+
} = require('graphql')
66

7-
import lookupAddresses from './index'
7+
const lookupAddresses = require('./index')
88

99
const addressType = new GraphQLObjectType({
1010
name: 'Address',
@@ -37,7 +37,7 @@ const addressType = new GraphQLObjectType({
3737

3838
const addressesType = new GraphQLList(addressType)
3939

40-
export default {
40+
module.exports = {
4141
type: addressesType,
4242
args: {
4343
address: { type: GraphQLString },

endpoints/address/index.js

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
/* eslint-disable import/first */
2-
import request from 'request'
3-
import h from 'apis-helpers'
4-
import app from '../../server'
5-
import _ from 'lodash'
2+
const request = require('request')
3+
const h = require('apis-helpers')
4+
const app = require('../../server')
5+
const _ = require('lodash')
66

77
const lookupAddresses = address => new Promise((resolve, reject) => {
88
request.get({
@@ -45,4 +45,4 @@ app.get('/address/:address?', (req, res) => {
4545
)
4646
})
4747

48-
export default lookupAddresses
48+
module.exports = lookupAddresses

endpoints/address/tests/integration_test.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import request from 'request'
2-
import helpers from '../../../lib/test_helpers'
1+
const request = require('request')
2+
const helpers = require('../../../lib/test_helpers')
33

44
describe('zip', () => {
55
it('should return an array of objects containing correct fields', (done) => {

endpoints/aur/index.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
import request from 'request'
2-
import moment from 'moment'
3-
import app from '../../server'
1+
const request = require('request')
2+
const moment = require('moment')
3+
const app = require('../../server')
44

55
// set cache time to 2 minutes
66
const cacheTime = 120

endpoints/aur/tests/integration_test.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
/* eslint-disable no-bitwise */
22
/* eslint-disable import/first */
33
/* eslint-disable import/extensions */
4-
import request from 'request'
5-
import helpers from '../../../lib/test_helpers.js'
6-
import assert from 'assert'
7-
import moment from 'moment'
4+
const request = require('request')
5+
const helpers = require('../../../lib/test_helpers.js')
6+
const assert = require('assert')
7+
const moment = require('moment')
88

99
const transactionTypes = ['buy', 'sell']
1010

endpoints/bus/graphql_schema.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
import {
1+
const {
22
GraphQLObjectType,
33
GraphQLList,
44
GraphQLString,
5-
} from 'graphql'
5+
} = require('graphql')
66

7-
import getBusRoutes from './realtime'
7+
const getBusRoutes = require('./realtime')
88

99
const busInfoType = new GraphQLObjectType({
1010
name: 'BusInfo',
@@ -27,7 +27,7 @@ const busRouteType = new GraphQLObjectType({
2727

2828
const busRoutesType = new GraphQLList(busRouteType)
2929

30-
export default {
30+
module.exports = {
3131
type: busRoutesType,
3232
args: {
3333
busses: { type: GraphQLString },

endpoints/bus/realtime.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -100,4 +100,4 @@ app.get('/bus/realtime', function (req, res) {
100100
)
101101
})
102102

103-
export default getBusRoutes
103+
module.exports = getBusRoutes

endpoints/bus/tests/integration_test.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ var request = require('request');
44
var assert = require('assert');
55
var helpers = require('../../../lib/test_helpers.js');
66
var sinon = require('sinon');
7-
var getBusRoutes = require('../realtime.js').default;
7+
var getBusRoutes = require('../realtime.js');
88

99
describe('bus', function() {
1010
var fieldsToCheckFor = ['busNr', 'busses'];

endpoints/calendar/graphql_schema.js

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
import {
1+
const {
22
GraphQLObjectType,
33
GraphQLList,
44
GraphQLString,
55
GraphQLBoolean,
6-
} from 'graphql'
7-
import { GraphQLDate } from '../../graphql/types/GraphQLDate'
6+
} = require('graphql')
7+
const { GraphQLDate } = require('../../graphql/types/GraphQLDate')
88

9-
import lookupHolidays from './index'
9+
const lookupHolidays = require('./index')
1010

1111
const holiday = new GraphQLObjectType({
1212
name: 'Holiday',
@@ -29,7 +29,7 @@ const holiday = new GraphQLObjectType({
2929

3030
const holidays = new GraphQLList(holiday)
3131

32-
export default {
32+
module.exports = {
3333
type: holidays,
3434
args: {
3535
year: { type: GraphQLString },

endpoints/calendar/index.js

+7-6
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
/* eslint-disable prefer-promise-reject-errors */
22
/* eslint-disable import/first */
3-
import app from '../../server'
4-
import fridagar from 'fridagar'
5-
import makeDebug from 'debug'
6-
import { range, isString } from 'lodash'
3+
const app = require('../../server')
4+
const fridagar = require('fridagar')
5+
const makeDebug = require('debug')
6+
const { range, isString } = require('lodash')
77

88
const debug = makeDebug('endpoint:calendar')
99

@@ -12,7 +12,7 @@ const canBeInt = (intLike) => {
1212
return !Number.isNaN(num)
1313
}
1414

15-
export const normalizeParams = (year, month, day) => {
15+
const normalizeParams = (year, month, day) => {
1616
// If string parsing failed, reject the promise
1717
if (isString(year) && !canBeInt(year)) return { error: 'Year must be a number' }
1818
if (isString(month) && !canBeInt(month)) return { error: 'Month must be a number' }
@@ -92,4 +92,5 @@ app.get('/calendar/:year/:month/:day', (req, res) => {
9292
.catch(error => res.status(400).json(error))
9393
})
9494

95-
export default lookupHolidays
95+
module.exports = lookupHolidays
96+
module.exports.normalizeParams = normalizeParams

endpoints/calendar/tests/integration_test.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
import request from 'request'
2-
import expect from 'expect'
3-
import helpers from '../../../lib/test_helpers'
4-
import { normalizeParams } from '../'
1+
const request = require('request')
2+
const expect = require('expect')
3+
const helpers = require('../../../lib/test_helpers')
4+
const { normalizeParams } = require('../')
55

66
describe('calendar/:year', () => {
77
it('should return an array of objects containing correct fields', (done) => {

endpoints/car/graphql_schema.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
import {
1+
const {
22
GraphQLObjectType,
33
GraphQLString,
4-
} from 'graphql'
4+
} = require('graphql')
55

6-
import lookupCar from './index'
6+
const lookupCar = require('./index')
77

88
const car = new GraphQLObjectType({
99
name: 'Car',
@@ -56,7 +56,7 @@ const car = new GraphQLObjectType({
5656
},
5757
})
5858

59-
export default {
59+
module.exports = {
6060
type: car,
6161
args: {
6262
carPlate: {

endpoints/car/index.js

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
/* eslint-disable prefer-promise-reject-errors */
2-
import request from 'request'
3-
import $ from 'cheerio'
4-
import h from 'apis-helpers'
5-
import app from '../../server'
2+
const request = require('request')
3+
const $ = require('cheerio')
4+
const h = require('apis-helpers')
5+
const app = require('../../server')
66

77
const lookupCar = plate => new Promise((resolve, reject) => {
88
// Encode carPlate so that Icelandic characters will work
@@ -57,4 +57,4 @@ app.get('/car', (req, res) => {
5757
.catch(error => res.status(500).json({ error }))
5858
})
5959

60-
export default lookupCar
60+
module.exports = lookupCar

endpoints/car/tests/integration_test.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/* eslint-disable import/extensions */
2-
import request from 'request'
3-
import helpers from '../../../lib/test_helpers.js'
2+
const request = require('request')
3+
const helpers = require('../../../lib/test_helpers.js')
44

55
describe('car', () => {
66
it('should return an array of objects containing correct fields', (done) => {

endpoints/carparks/index.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
/* eslint-disable no-restricted-globals */
22
/* eslint-disable no-plusplus */
3-
import request from 'request'
4-
import $ from 'cheerio'
5-
import h from 'apis-helpers'
6-
import app from '../../server'
3+
const request = require('request')
4+
const $ = require('cheerio')
5+
const h = require('apis-helpers')
6+
const app = require('../../server')
77

88
app.get('/carparks', (req, res) => {
99
const url = 'http://www.bilastaedasjodur.is/'

endpoints/carparks/tests/integration_test.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/* eslint-disable import/extensions */
2-
import request from 'request'
3-
import helpers from '../../../lib/test_helpers.js'
2+
const request = require('request')
3+
const helpers = require('../../../lib/test_helpers.js')
44

55
describe('carparks', () => {
66
it('should return an array of objects containing correct fields', (done) => {

endpoints/cinema/index.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
import request from 'request'
2-
import cheerio from 'cheerio'
3-
import app from '../../server'
1+
const request = require('request')
2+
const cheerio = require('cheerio')
3+
const app = require('../../server')
44

55
/**
66
* Fetches movies for show today in Icelandic cinemas.

endpoints/company/index.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
import request from 'request'
2-
import cheerio from 'cheerio'
3-
import h from 'apis-helpers'
4-
import app from '../../server'
1+
const request = require('request')
2+
const cheerio = require('cheerio')
3+
const h = require('apis-helpers')
4+
const app = require('../../server')
55

66
app.get('/company', (req, res) => {
77
const queryString = {

endpoints/company/tests/integration_test.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/* eslint-disable import/extensions */
2-
import request from 'request'
3-
import helpers from '../../../lib/test_helpers.js'
2+
const request = require('request')
3+
const helpers = require('../../../lib/test_helpers.js')
44

55
describe.skip('company', () => {
66
const fieldsToCheckFor = ['name', 'sn', 'active', 'address']

endpoints/concerts/index.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
import request from 'request'
2-
import _ from 'lodash'
3-
import app from '../../server'
1+
const request = require('request')
2+
const _ = require('lodash')
3+
const app = require('../../server')
44

55
app.get('/concerts', (req, res) => {
66
const url = 'http://midi.is/Home/LoadMoreEventsByDate?eventType=Concerts&pageNumber='

endpoints/concerts/tests/integration_test.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/* eslint-disable import/extensions */
2-
import request from 'request'
3-
import helpers from '../../../lib/test_helpers.js'
2+
const request = require('request')
3+
const helpers = require('../../../lib/test_helpers.js')
44

55
describe('concerts', () => {
66
const fieldsToCheckFor = [

endpoints/currency/arion.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
import request from 'request'
2-
import moment from 'moment'
3-
import h from 'apis-helpers'
4-
import app from '../../server'
1+
const request = require('request')
2+
const moment = require('moment')
3+
const h = require('apis-helpers')
4+
const app = require('../../server')
55

66
app.get('/currency/arion/:type?', (req, res) => {
77
// types: AlmenntGengi,KortaGengi(valitor),SedlaGengi,AirportGengi

endpoints/currency/borgun.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
/* eslint-disable no-plusplus */
22
/* eslint-disable prefer-destructuring */
3-
import request from 'request'
4-
import xml2js from 'xml2js'
5-
import app from '../../server'
3+
const request = require('request')
4+
const xml2js = require('xml2js')
5+
const app = require('../../server')
66

77
const parseString = xml2js.parseString
88

endpoints/currency/index.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import app from '../../server'
1+
const app = require('../../server')
22

33
app.get('/currency', (req, res) => {
44
const provider = req.query.provider || 'arion'

endpoints/currency/lb.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
/* eslint-disable no-plusplus */
22
/* eslint-disable prefer-destructuring */
3-
import request from 'request'
4-
import xml2js from 'xml2js'
5-
import app from '../../server'
3+
const request = require('request')
4+
const xml2js = require('xml2js')
5+
const app = require('../../server')
66

77
const parseString = xml2js.parseString
88

endpoints/currency/m5.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
/* eslint-disable import/first */
2-
import request from 'request'
3-
import h from 'apis-helpers'
4-
import app from '../../server'
5-
import cheerio from 'cheerio'
2+
const request = require('request')
3+
const h = require('apis-helpers')
4+
const app = require('../../server')
5+
const cheerio = require('cheerio')
66

77
app.get('/currency/m5', (req, res) => {
88
// FIXME: Not being used, comment out for now

endpoints/currency/tests/integration_test.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/* eslint-disable import/extensions */
2-
import request from 'request'
3-
import helpers from '../../../lib/test_helpers.js'
2+
const request = require('request')
3+
const helpers = require('../../../lib/test_helpers.js')
44

55
describe('currency', () => {
66
// The only thing that changes is the form attribute, so why not just re-use the object

0 commit comments

Comments
 (0)