Skip to content

Commit 744ef82

Browse files
author
Parth Shah
committed
updating lint config
1 parent 2099b80 commit 744ef82

File tree

7 files changed

+52
-86
lines changed

7 files changed

+52
-86
lines changed

.eslintignore

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
config/local.js
2+
config/sample.local.js
3+
node_modules
4+
dist
5+
.ebextensions
6+
.elasticbeanstalk
7+
coverage

.eslintrc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"extends": "airbnb",
2+
"extends": "airbnb-base",
33
"parser": "babel-eslint",
44
"env": {
55
"browser": false,
@@ -8,6 +8,7 @@
88
"mocha": true
99
},
1010
"rules": {
11+
"import/no-extraneous-dependencies": ["error", {"devDependencies": ["**/*.test.js", "**/*.spec.js"]}],
1112
"valid-jsdoc": ["error", {
1213
"requireReturn": true,
1314
"requireReturnType": true,

config/sample.local.js

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,34 @@
11
// force using test.json for unit tests
22

3-
var config
3+
let config;
44
if (process.env.NODE_ENV === 'test') {
5-
config = require('./test.json')
5+
config = require('./test.json');
66
} else {
77
config = {
8-
"authSecret": "secret",
9-
"logLevel": "debug",
10-
"captureLogs": "false",
11-
"logentriesToken": "",
12-
"rabbitmqURL": "amqp://dockerhost:5672",
13-
"fileServiceEndpoint": "https://api.topcoder-dev.com/v3/files/",
14-
"topicServiceEndpoint": "https://api.topcoder-dev.com/v4/topics/",
15-
"directProjectServiceEndpoint": "https://api.topcoder-dev.com/v3/direct",
16-
"userServiceUrl": "https://api.topcoder-dev.com/v3/users",
17-
"connectProjectsUrl": "https://connect.topcoder-dev.com/projects/",
18-
"salesforceLead" : {
19-
"webToLeadUrl": 'https://www.salesforce.com/servlet/servlet.WebToLead?encoding=UTF-8',
20-
"orgId": "00D2C0000000dO6",
21-
"projectNameFieldId": "title",
22-
"projectDescFieldId": "description",
23-
"projectLinkFieldId": "URL",
24-
"projectIdFieldId" : "00N2C000000Vxxx"
25-
},
26-
"dbConfig": {
27-
"masterUrl": "postgres://coder:mysecretpassword@dockerhost:5432/projectsdb",
28-
"maxPoolSize": 50,
29-
"minPoolSize": 4,
30-
"idleTimeout": 1000
31-
}
32-
}
8+
authSecret: 'secret',
9+
logLevel: 'debug',
10+
captureLogs: 'false',
11+
logentriesToken: '',
12+
rabbitmqURL: 'amqp://dockerhost:5672',
13+
fileServiceEndpoint: 'https://api.topcoder-dev.com/v3/files/',
14+
topicServiceEndpoint: 'https://api.topcoder-dev.com/v4/topics/',
15+
directProjectServiceEndpoint: 'https://api.topcoder-dev.com/v3/direct',
16+
userServiceUrl: 'https://api.topcoder-dev.com/v3/users',
17+
connectProjectsUrl: 'https://connect.topcoder-dev.com/projects/',
18+
salesforceLead: {
19+
webToLeadUrl: 'https://www.salesforce.com/servlet/servlet.WebToLead?encoding=UTF-8',
20+
orgId: '00D2C0000000dO6',
21+
projectNameFieldId: 'title',
22+
projectDescFieldId: 'description',
23+
projectLinkFieldId: 'URL',
24+
projectIdFieldId: '00N2C000000Vxxx',
25+
},
26+
dbConfig: {
27+
masterUrl: 'postgres://coder:mysecretpassword@dockerhost:5432/projectsdb',
28+
maxPoolSize: 50,
29+
minPoolSize: 4,
30+
idleTimeout: 1000,
31+
},
32+
};
3333
}
34-
module.exports = config
34+
module.exports = config;

migrations/sync.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
'use strict'
1+
22

33
/**
44
* Sync the database models to db tables.
@@ -12,9 +12,9 @@
1212

1313
require('./dist/models').default.sequelize.sync({ force: true })
1414
.then(() => {
15-
console.log('Database synced successfully')
16-
process.exit()
15+
console.log('Database synced successfully');
16+
process.exit();
1717
}).catch((err) => {
18-
console.error('Error syncing database', err)
19-
process.exit(1)
20-
})
18+
console.error('Error syncing database', err);
19+
process.exit(1);
20+
});

newrelic.js

Lines changed: 0 additions & 35 deletions
This file was deleted.

package.json

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@
99
"scripts": {
1010
"build": "babel src -d dist --presets es2015",
1111
"sync": "node migrations/sync.js",
12-
"lint": "./node_modules/.bin/eslint src",
12+
"lint": "./node_modules/.bin/eslint .",
13+
"lint:fix": "./node_modules/.bin/eslint . --fix || true",
1314
"prestart": "npm run -s build",
1415
"start": "node dist",
1516
"start:dev": "NODE_ENV=local PORT=8001 nodemon -w src --exec \"babel-node src --presets es2015\" | ./node_modules/.bin/bunyan",
@@ -43,7 +44,6 @@
4344
"express-validation": "^0.6.0",
4445
"joi": "^8.0.5",
4546
"lodash": "^4.16.4",
46-
"newrelic": "^1.27.2",
4747
"pg": "^4.5.5",
4848
"pg-native": "^1.10.0",
4949
"sequelize": "^3.23.0",
@@ -57,11 +57,9 @@
5757
"babel-preset-es2015": "^6.9.0",
5858
"bunyan": "^1.8.1",
5959
"chai": "^3.5.0",
60-
"eslint": "^3.2.2",
61-
"eslint-config-airbnb": "^14.1.0",
60+
"eslint": "^3.16.1",
61+
"eslint-config-airbnb-base": "^11.1.0",
6262
"eslint-plugin-import": "^2.2.0",
63-
"eslint-plugin-jsx-a11y": "^4.0.0",
64-
"eslint-plugin-react": "^6.10.0",
6563
"istanbul": "^1.0.0-alpha.2",
6664
"mocha": "^2.5.3",
6765
"nodemon": "^1.9.1",

src/index.js

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,11 @@
11

2-
3-
import models from './models';
4-
5-
// include newrelic
6-
if (process.env.NODE_ENV !== 'test' && process.env.NODE_ENV !== 'local') {
7-
require('newrelic');
8-
}
9-
102
const app = require('./app');
3+
const coreLib = require('tc-core-library-js');
4+
const expressListRoutes = require('express-list-routes');
115

126
/**
137
* Handle server shutdown gracefully
8+
* @returns {undefined}
149
*/
1510
function gracefulShutdown() {
1611
app.services.pubsub.disconnect()
@@ -36,9 +31,9 @@ const port = process.env.PORT || 3000; // used to create, sign, and verify token
3631

3732
const server = app.listen(port, () => {
3833
app.logger.info('Starting server on PORT: %d', port);
39-
const authz = require('tc-core-library-js').Authorizer;
34+
const authz = coreLib.Authorizer;
4035
app.logger.info('Registered Policies', authz.getRegisteredPolicies());
41-
require('express-list-routes')({ prefix: '', spacer: 7 }, 'APIs:', app.routerRef);
36+
expressListRoutes({ prefix: '', spacer: 7 }, 'APIs:', app.routerRef);
4237
});
4338

4439
module.exports = server;

0 commit comments

Comments
 (0)