-
Notifications
You must be signed in to change notification settings - Fork 474
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add ESLint #728
base: main
Are you sure you want to change the base?
Add ESLint #728
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
{ | ||
"extends": [ | ||
"eslint:recommended" | ||
], | ||
"plugins": [ | ||
], | ||
"parserOptions": { | ||
"ecmaVersion": 2018, | ||
"sourceType": "module" | ||
}, | ||
"env": { | ||
"browser": true, | ||
"node": true, | ||
"es6": true | ||
}, | ||
"rules": { | ||
"no-unused-vars": [ | ||
"warn", | ||
{ | ||
"argsIgnorePattern": "^_", | ||
"varsIgnorePattern": "^_", | ||
"caughtErrorsIgnorePattern": "^_" | ||
} | ||
], | ||
"no-cond-assign": "warn", | ||
"no-constant-condition": "off" | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -49,3 +49,6 @@ jobs: | |
|
||
# Run the tests | ||
- run: make test | ||
|
||
# Run linting | ||
- run: npm run lint |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -179,6 +179,7 @@ | |
this.unregisterConsumer(consumerTag); | ||
return ok.fields; | ||
}); | ||
return ok | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Returning ok looks like a change in behaviour. Was this previously an omission or just made to appease a linting rule? |
||
} | ||
|
||
get(queue, options) { | ||
|
@@ -289,7 +290,7 @@ | |
// Channel closed | ||
if (!this.pending) { | ||
var cb; | ||
while (cb = this.unconfirmed.shift()) { | ||
Check warning on line 293 in lib/channel_model.js GitHub Actions / build (18.x)
Check warning on line 293 in lib/channel_model.js GitHub Actions / build (10.x)
Check warning on line 293 in lib/channel_model.js GitHub Actions / build (20.x)
Check warning on line 293 in lib/channel_model.js GitHub Actions / build (12.x)
Check warning on line 293 in lib/channel_model.js GitHub Actions / build (14.x)
|
||
if (cb) cb(new Error('channel closed')); | ||
} | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -105,7 +105,7 @@ function encodeFieldValue(buffer, value, offset) { | |
var start = offset; | ||
var type = typeof value, val = value; | ||
// A trapdoor for specifying a type, e.g., timestamp | ||
if (value && type === 'object' && value.hasOwnProperty('!')) { | ||
if (value && type === 'object' && Object.prototype.hasOwnProperty.call(value, '!')) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sometimes I hate javascript! |
||
val = value.value; | ||
type = value['!']; | ||
} | ||
|
@@ -216,7 +216,7 @@ function encodeFieldValue(buffer, value, offset) { | |
break; | ||
case 'decimal': | ||
tag('D'); | ||
if (val.hasOwnProperty('places') && val.hasOwnProperty('digits') | ||
if (Object.prototype.hasOwnProperty.call(val, 'places') && Object.prototype.hasOwnProperty.call(val, 'digits') | ||
&& val.places >= 0 && val.places < 256) { | ||
buffer[offset] = val.places; offset++; | ||
buffer.writeUInt32BE(val.digits, offset); offset += 4; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suggest we change this to "off" given it's used fairly extensively. Warnings are just annoying.