sumologic-aws-lambda
sumologic-aws-lambda copied to clipboard
Fixed linting issues.
- Fixed comparison operators, some where not safe in JS
- Removed extra escape character in regex
- Small change to console to log to avoid unneeded string concatenation.
- Superfulous whitespace
Thanks, i'll review this shortly!
Hi @wolfeidau were you able to test the changes to the console regex and if statements?
Thanks for taking a look, happy to update this ticket once I have it running in my dev account.
Just as a bit of background I normally just run eslint over any nodejs project prior to deploying it, in this case I have just fixed the main things. In this case your "close" to semistandard layout so I use that assess the codebase.
Also semistandard
uses eslint which is a pretty widely used JS linting tool.
If you want to produce this then just run.
npm install semistandard -g
semistandard cloudwatchlogs_lambda.js
In my case I just focused on the more common issues in the list below, I try to avoid messing with peoples layout too much.
semistandard cloudwatchlogs_lambda.js | egrep -v 'indent|space'
semistandard: Semicolons For All! (https://github.com/Flet/semistandard)
semistandard: Run `semistandard --fix` to automatically fix some problems.
/Users/markw/Code/ops/sumologic-aws-lambda/cloudwatchlogs/cloudwatchlogs_lambda.js:23:38: Unexpected tab character.
/Users/markw/Code/ops/sumologic-aws-lambda/cloudwatchlogs/cloudwatchlogs_lambda.js:27:48: Unnecessary escape character: \-.
/Users/markw/Code/ops/sumologic-aws-lambda/cloudwatchlogs/cloudwatchlogs_lambda.js:32:1: More than 1 blank line not allowed.
/Users/markw/Code/ops/sumologic-aws-lambda/cloudwatchlogs/cloudwatchlogs_lambda.js:39:100: Expected '!==' and instead saw '!='.
/Users/markw/Code/ops/sumologic-aws-lambda/cloudwatchlogs/cloudwatchlogs_lambda.js:43:88: Expected '!==' and instead saw '!='.
/Users/markw/Code/ops/sumologic-aws-lambda/cloudwatchlogs/cloudwatchlogs_lambda.js:49:88: Expected '!==' and instead saw '!='.
/Users/markw/Code/ops/sumologic-aws-lambda/cloudwatchlogs/cloudwatchlogs_lambda.js:72:1: Block must not be padded by blank lines.
/Users/markw/Code/ops/sumologic-aws-lambda/cloudwatchlogs/cloudwatchlogs_lambda.js:88:19: Expected '===' and instead saw '=='.
/Users/markw/Code/ops/sumologic-aws-lambda/cloudwatchlogs/cloudwatchlogs_lambda.js:97:1: More than 1 blank line not allowed.
/Users/markw/Code/ops/sumologic-aws-lambda/cloudwatchlogs/cloudwatchlogs_lambda.js:112:36: Expected '===' and instead saw '=='.
/Users/markw/Code/ops/sumologic-aws-lambda/cloudwatchlogs/cloudwatchlogs_lambda.js:132:1: More than 1 blank line not allowed.
/Users/markw/Code/ops/sumologic-aws-lambda/cloudwatchlogs/cloudwatchlogs_lambda.js:134:45: Block must not be padded by blank lines.
/Users/markw/Code/ops/sumologic-aws-lambda/cloudwatchlogs/cloudwatchlogs_lambda.js:141:28: Expected '!==' and instead saw '!='.
/Users/markw/Code/ops/sumologic-aws-lambda/cloudwatchlogs/cloudwatchlogs_lambda.js:164:64: Block must not be padded by blank lines.
/Users/markw/Code/ops/sumologic-aws-lambda/cloudwatchlogs/cloudwatchlogs_lambda.js:214:5: Block must not be padded by blank lines.
I would suggest just running https://github.com/Flet/semistandard as a baseline for these files either in your editor or prior to pushing, the --fix
makes this pretty easy :)
Hopefully that helps.
Hey @wolfeidau I did run it though eslint via jetbrains IDE and it didn't pick those up for some reason. probably an issue with the eslint config or i was using more relaxed rules.
Anyway we will do a quick test to make sure the console output works fine then merge