Skip to content

Commit

Permalink
install eslint (#37)
Browse files Browse the repository at this point in the history
* update base models

* add eslint

* bump version
  • Loading branch information
xinghengwang authored Aug 6, 2024
1 parent fea2c4b commit 8deb671
Show file tree
Hide file tree
Showing 8 changed files with 602 additions and 20 deletions.
27 changes: 27 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import globals from "globals";
import path from "node:path";
import { fileURLToPath } from "node:url";
import js from "@eslint/js";
import { FlatCompat } from "@eslint/eslintrc";

const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
const compat = new FlatCompat({
baseDirectory: __dirname,
recommendedConfig: js.configs.recommended,
allConfig: js.configs.all
});

export default [...compat.extends("eslint:recommended"), {
languageOptions: {
globals: {
...globals.browser,
},

ecmaVersion: 12,
sourceType: "module",
},
rules: {
"no-undef": "error",
},
}];
4 changes: 3 additions & 1 deletion lib/Controllers/HealthController.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@

var _request = require('../Http/Client/RequestClient'),
_configuration = require('../configuration'),
_APIHelper = require('../APIHelper')
_APIHelper = require('../APIHelper');

var StatusModel = require('../Models/StatusModel');

var HealthController = {

Expand Down
12 changes: 6 additions & 6 deletions lib/Models/BaseModel.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,17 @@ function BaseModel() {
this._variableDict= [];
this.toJSON = function(){
var newDict = {};
for(var prop in this){
if(typeof this[prop]!=="function" && prop !== "_variableDict"){
if(prop in this._variableDict){
for(var prop in this){
if(typeof this[prop]!=="function" && prop !== "_variableDict"){
if(prop in this._variableDict){
var value = this._variableDict[prop];
newDict[value] = this[prop];
}else{
}else{
newDict[prop] = this[prop];
}
}
}
}
return (newDict);
}
}
module.exports = BaseModel;
module.exports = BaseModel;
2 changes: 1 addition & 1 deletion lib/Models/EventRequestModel.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ var BaseModel = require("./BaseModel");
*
* @constructor
*/
EventRequestModel = function (obj) {
var EventRequestModel = function (obj) {
if(!obj) {
this.time = null;
this.uri = null;
Expand Down
4 changes: 2 additions & 2 deletions lib/Models/EventResponseModel.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ var BaseModel = require("./BaseModel");
*
* @constructor
*/
EventResponseModel = function (obj) {
var EventResponseModel = function (obj) {
if(!obj) {
this.time = null;
this.status = null;
Expand All @@ -27,7 +27,7 @@ EventResponseModel = function (obj) {
this.headers = obj.headers;
this.body = obj.body;
this.ipAddress = obj.ipAddress;
this.transferEncoding = obj.transferEncoding;
this.transferEncoding = obj.transferEncoding;
//Append to variable dictionary
this._variableDict['ipAddress'] = 'ip_address';
this._variableDict['transferEncoding'] = 'transfer_encoding';
Expand Down
16 changes: 8 additions & 8 deletions lib/Models/StatusModel.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ var BaseModel = require("./BaseModel");
*
* @constructor
*/
StatusModel = function (obj) {
var StatusModel = function (obj) {
if(!obj) {
this.status = null;
this.region = null;
this.status = null;
this.region = null;
} else {
this.status = obj.status;
this.region = obj.region;
Expand All @@ -34,8 +34,8 @@ StatusModel.prototype.getStatus = function() {

/**
* Setter for Status
*
* @param {bool} value
*
* @param {bool} value
*/
StatusModel.prototype.setStatus = function(value) {
this.status = value;
Expand All @@ -52,12 +52,12 @@ StatusModel.prototype.getRegion = function() {

/**
* Setter for Region
*
* @param {string} value
*
* @param {string} value
*/
StatusModel.prototype.setRegion = function(value) {
this.region = value;
};


module.exports = StatusModel;
module.exports = StatusModel;
Loading

0 comments on commit 8deb671

Please sign in to comment.