Skip to content

Commit

Permalink
fix: change tsconfig to jsconfig
Browse files Browse the repository at this point in the history
  • Loading branch information
Enubia committed Oct 15, 2020
1 parent 4f14632 commit 0c97c16
Show file tree
Hide file tree
Showing 7 changed files with 33 additions and 47 deletions.
2 changes: 1 addition & 1 deletion .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"@hokify/eslint-config"
],
"parserOptions": {
"project": "tsconfig.json",
"project": "jsconfig.json",
"ecmaVersion": 2015
},
"rules": {
Expand Down
27 changes: 14 additions & 13 deletions app.js
Original file line number Diff line number Diff line change
@@ -1,19 +1,20 @@
'use strict';
/* eslint-disable import/no-dynamic-require */
/* eslint-disable @typescript-eslint/no-var-requires */
const path = require('path');

module.exports = (agenda, options) => {
options = options || {};
if (!options.middleware) {
options.middleware = 'express';
}
options = options || {};
if (!options.middleware) {
options.middleware = 'express';
}

const agendash = require('./lib/controllers/agendash')(agenda, options);
const agendash = require('./lib/controllers/agendash')(agenda, options);

try {
const middlewarePath = path.join(__dirname, 'lib/middlewares', options.middleware);
return require(middlewarePath)(agendash);
} catch (err) {
console.log(err)
throw new Error('No middleware available for ' + options.middleware);
}
try {
const middlewarePath = path.join(__dirname, 'lib/middlewares', options.middleware);
return require(middlewarePath)(agendash);
} catch (err) {
console.log(err);
throw new Error(`No middleware available for ${options.middleware}`);
}
};
11 changes: 11 additions & 0 deletions jsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"include": [
"./public/app/js/*.js",
"./bin/*.js",
"./lib/**/*.js",
"./test/*.js"
],
"exclude": [
"node_modules"
]
}
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
"scripts": {
"postversion": "npm publish",
"postpublish": "git push origin --all; git push origin --tags",
"lint": "eslint --fix '**/*.js'",
"test": "run-p lint ava",
"ava": "ava -v -c 1"
},
Expand Down
5 changes: 3 additions & 2 deletions test/test-express.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* eslint-disable @typescript-eslint/no-var-requires */
const test = require('ava');
const supertest = require('supertest');
const express = require('express');
Expand Down Expand Up @@ -43,9 +44,9 @@ test.serial('POST /api/jobs/create should confirm the job exists', async t => {

t.true('created' in res.body);

agenda._collection.count({}, null, (err, res) => {
agenda._collection.count({}, null, (err, _res) => {
t.ifError(err);
if (res !== 1) {
if (_res !== 1) {
throw new Error('Expected one document in database');
}
});
Expand Down
5 changes: 3 additions & 2 deletions test/test-hapi.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* eslint-disable @typescript-eslint/no-var-requires */
const test = require('ava');
const supertest = require('supertest');
const Hapi = require('hapi');
Expand Down Expand Up @@ -51,9 +52,9 @@ test.serial('POST /api/jobs/create should confirm the job exists', async t => {

t.true('created' in res.body);

agenda._collection.count({}, null, (err, res) => {
agenda._collection.count({}, null, (err, _res) => {
t.ifError(err);
if (res !== 1) {
if (_res !== 1) {
throw new Error('Expected one document in database');
}
});
Expand Down
29 changes: 0 additions & 29 deletions tsconfig.json

This file was deleted.

0 comments on commit 0c97c16

Please sign in to comment.