Skip to content

Conversation

@bajtos
Copy link
Member

@bajtos bajtos commented Oct 2, 2017

  • Move prettier config from VSCode settings to a standalone file
  • Add npm run prettier:check for verifying formatting
  • Add npm run prettier:fix to automatically reformat the code
  • Integrate prettier check into npm test pipeline
  • Enable "format on save" in VS Code settings (yay 🕺)
  • Reformat all existing code

@bajtos bajtos self-assigned this Oct 2, 2017
@bajtos bajtos added the review label Oct 2, 2017
@bajtos
Copy link
Member Author

bajtos commented Oct 2, 2017

A note for reviewers: the first commit (4c8f72e) contains changes in project infrastructure, the second commit (d58127b) contains formatting changes in TypeScript sources. I hope this will make it easier for you to review this patch.

I'll squash both commits into a single one before merging.

@virkt25
Copy link
Contributor

virkt25 commented Oct 2, 2017

LGTM. Just a comment regarding checking this in our npm test workflow. I think it might be better to have different stage for linting on travis where we run npm run lint && npm run prettier:check. I just find it easier to look at Travis and know where something went wrong without having to open up logs.

Something like the following job in .travis.yml

- stage: Linting
      node_js:
        - "8"
      before_script: skip
      script: npm run lint && npm run prettier:check
      after_script: skip

@bajtos
Copy link
Member Author

bajtos commented Oct 3, 2017

LGTM. Just a comment regarding checking this in our npm test workflow. I think it might be better to have different stage for linting on travis where we run npm run lint && npm run prettier:check. I just find it easier to look at Travis and know where something went wrong without having to open up logs.

Makes sense, it would be good improvement. Let's leave it out of scope of this pull request though, as it's a different change IMO. Created a GH issue to keep track of this - see #610.

This actually raises a question - I think npm run lint should execute both tslint and prettier, because both tools are checking the coding style. Thoughts?

@bajtos
Copy link
Member Author

bajtos commented Oct 3, 2017

I think npm run lint should execute both tslint and prettier, because both tools are checking the coding style. Thoughts?

Pushed a new commit a641331 to make this happen. npm run lint will run both linters now, npm run lint:fix will run both checkers in the auto-fix mode.

@bajtos
Copy link
Member Author

bajtos commented Oct 3, 2017

@virkt25 PTAL again.

@kjdelisle @raymondfeng do you have any opinion on this change? May I go ahead and land this patch?

@virkt25
Copy link
Contributor

virkt25 commented Oct 3, 2017

Makes sense, it would be good improvement. Let's leave it out of scope of this pull request though, as it's a different change IMO. Created a GH issue to keep track of this - see #610.

+1

I think npm run lint should execute both tslint and prettier, because both tools are checking the coding style.

+1

ctx
.bind('fido')
.to(new Dog())
.tag('dog');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What rule control this? Isn't ctx.bind('spot').to(new Dog()).tag('dog'); perfectly readable?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like this is hard-coded, at least I don't see any option to control this: https://github.com/prettier/prettier/blob/master/docs/options.md

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

//prettier-ignore can be used to skip lines / blocks we want to be skipped by prettier.

Just an option. I do think we should keep prettier formatting wherever possible to keep things consistent.

(Also if the result of a chain is being assigned to variable then it doesn’t break it down to a command per line)

* The location of the API key. Valid values are "query" or "header".
*/
'in'?: 'query' | 'header';
in?: 'query' | 'header';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Interesting, I don't know that we can use in keyword as object key without quotation.

Copy link
Contributor

@raymondfeng raymondfeng left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM with a few minor questions/comments.

@bajtos bajtos merged commit b2be342 into master Oct 4, 2017
@bajtos bajtos deleted the style/prettier branch October 4, 2017 08:06
@bajtos bajtos removed the review label Oct 4, 2017
@bajtos bajtos added this to the Sprint 46 milestone Oct 4, 2017
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.

4 participants