Skip to content
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

Fixed linting issues. #26

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

wolfeidau
Copy link

  • 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

* 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
@stevezau
Copy link
Contributor

Thanks, i'll review this shortly!

@stevezau
Copy link
Contributor

Hi @wolfeidau were you able to test the changes to the console regex and if statements?

@wolfeidau
Copy link
Author

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.

@stevezau
Copy link
Contributor

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants