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
Basic eslint fixes #26
Conversation
See also: https://github.com/eslint/eslint/blob/v8.4.0/CHANGELOG.md Signed-off-by: Tony Narlock <tony@git-pull.com>
Signed-off-by: Tony Narlock <tony@git-pull.com>
Signed-off-by: Tony Narlock <tony@git-pull.com>
Signed-off-by: Tony Narlock <tony@git-pull.com>
@@ -14,6 +14,10 @@ function createReadStreamSafe(filename, options) { | |||
}); | |||
} | |||
|
|||
function hasOwnProperty(obj, key) { | |||
return Object.prototype.hasOwnProperty.call(obj, key); |
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.
Via no-prototype-builtins
via eslint:recommended
MDN: Object.prototype.hasOwnProperty()
Personally I'd prefer optional chaining, e.g.:
diff --git a/packages/scans/src/action-helper.js b/packages/scans/src/action-helper.js
index 49cbc8a..c3a6c8a 100644
--- a/packages/scans/src/action-helper.js
+++ b/packages/scans/src/action-helper.js
@@ -60,7 +60,7 @@ let actionHelper = {
sites.forEach((site => {
msg = msg + `${BULLET} Site: [${site["@name"]}](${site["@name"]}) ${NXT_LINE}`;
- if (hasOwnProperty(site, 'alerts')) {
+ if (site?.alerts) {
if (site.alerts.length !== 0) {
msg = `${msg} ${TAB} **New Alerts** ${NXT_LINE}`;
site.alerts.forEach((alert) => {
If we intend on ever doing a dist/
release with this, ncc
raised an error:
./node_modules/.bin/ncc build
ncc: Version 0.21.1
ncc: Compiling file index.js
Error: Module parse failed: Unexpected token (63:21)
File was processed with these loaders:
* ./node_modules/@zeit/ncc/dist/ncc/loaders/empty-loader.js
* ./node_modules/@zeit/ncc/dist/ncc/loaders/relocate-loader.js
* ./node_modules/@zeit/ncc/dist/ncc/loaders/shebang-loader.js
You may need an additional loader to handle the result of these loaders.
| sites.forEach((site => {
| msg = msg + `${BULLET} Site: [${site["@name"]}](${site["@name"]}) ${NXT_LINE}`;
> if (site?.alerts) {
| if (site.alerts.length !== 0) {
| msg = `${msg} ${TAB} **New Alerts** ${NXT_LINE}`;
at evalmachine.<anonymous>:1:1416387
at eval (eval at create (evalmachine.<anonymous>:1:274053), <anonymous>:13:1)
at processTicksAndRejections (internal/process/task_queues.js:95:5)
If we update ncc
from 0.21.0 to 0.33.0 it fixes it:
npm uninstall @zeit/ncc && npm install --save-dev @vercel/ncc
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.
See #27
Same as #25 and there's indication that |
Lint fixes on top of #25
Fixes: