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

ci: add eslint check to only check changed files and fail when warnings are thrown #5357

Merged
merged 28 commits into from
Jul 25, 2019

Conversation

kieckhafer
Copy link
Member

@kieckhafer kieckhafer commented Jul 24, 2019

Impact: minor
Type: ci|performance

Issue

We currently have ~300 eslint warnings related to jsdoc.

Solution

To incrementally fix all these issues. we will add a check to the CI process to throw an error if there are any eslint errors OR warnings, only files you changed in your PR. In addition to only checking changed files, this is different than our traditional eslint CI check in that it will not pass even if there are warnings, where our traditional check only fails against errors.

Breaking changes

None

Testing

  1. Make any change (add a random comment in the file somewhere) to multiples file that is currently throwing an eslint warning, and make a PR with said change. Two files with eslint warnings:
    • imports/plugins/included/product-variant/client/templates/products/productSettings/productSettings.js
    • client/modules/core/main.js
  1. see that CI does not pass until warnings is fixed

I made a few test commits with purposefully failing files, you can see the CI check running and failing when there are eslint warnings (not errors): https://circleci.com/gh/reactioncommerce/reaction/49620?utm_campaign=vcs-integration-link&utm_medium=referral&utm_source=github-checks-link

Signed-off-by: Erik Kieckhafer <[email protected]>
Signed-off-by: Erik Kieckhafer <[email protected]>
Signed-off-by: Erik Kieckhafer <[email protected]>
Signed-off-by: Erik Kieckhafer <[email protected]>
Signed-off-by: Erik Kieckhafer <[email protected]>
Signed-off-by: Erik Kieckhafer <[email protected]>
Signed-off-by: Erik Kieckhafer <[email protected]>
Signed-off-by: Erik Kieckhafer <[email protected]>
Signed-off-by: Erik Kieckhafer <[email protected]>
Signed-off-by: Erik Kieckhafer <[email protected]>
Signed-off-by: Erik Kieckhafer <[email protected]>
Signed-off-by: Erik Kieckhafer <[email protected]>
Signed-off-by: Erik Kieckhafer <[email protected]>
Signed-off-by: Erik Kieckhafer <[email protected]>
Signed-off-by: Erik Kieckhafer <[email protected]>
@kieckhafer kieckhafer changed the title [WIP] ci: add eslint check to only check changed files ci: add eslint check to only check changed files and fail when warnings are thrown Jul 24, 2019
@kieckhafer kieckhafer marked this pull request as ready for review July 24, 2019 20:12
@kieckhafer kieckhafer requested a review from aldeed July 24, 2019 20:12
@kieckhafer
Copy link
Member Author

@mikemurray could you please see that this works as it should, since you know what it's supposed to do?

@aldeed / @focusaurus could you please check the bash script / config file code?

Copy link
Contributor

@focusaurus focusaurus left a comment

Choose a reason for hiding this comment

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

I pushed a commit to refactor the bash script a bit. You'll need to re-test nothing broke but I'm fairly confident it will still work properly. Otherwise looks good.

- format with shfmt
- safer curl args
- Use `jq -r` to remove quotes
- consistent use of curlies around variable names

Signed-off-by: Peter Lyons <[email protected]>
@focusaurus focusaurus force-pushed the ci-kieckhafer-addByChangedFileLinting branch from 0eb643c to 5483142 Compare July 25, 2019 00:02
@kieckhafer
Copy link
Member Author

@mikemurray confirmed @focusaurus's changes still work.

Here is the latest CI run that is failing on purpose, should be good enough for testing: https://circleci.com/gh/reactioncommerce/reaction/49757?utm_campaign=vcs-integration-link&utm_medium=referral&utm_source=github-checks-link

@mikemurray mikemurray merged commit fad7a34 into develop Jul 25, 2019
@mikemurray mikemurray deleted the ci-kieckhafer-addByChangedFileLinting branch July 25, 2019 19:29
@kieckhafer kieckhafer mentioned this pull request Aug 2, 2019
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