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

feat: Add format check to validate script #146

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

Conversation

MichaelDeBoey
Copy link
Contributor

Closes #64
Closes #65

@codecov
Copy link

codecov bot commented May 24, 2020

Codecov Report

Merging #146 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #146   +/-   ##
=======================================
  Coverage   86.86%   86.86%           
=======================================
  Files          18       18           
  Lines         335      335           
  Branches       80       80           
=======================================
  Hits          291      291           
  Misses         36       36           
  Partials        8        8           
Impacted Files Coverage Δ
src/scripts/validate.js 100.00% <ø> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update d3bf8b4...4f55981. Read the comment docs.

@MichaelDeBoey MichaelDeBoey changed the title feat: Add format to validate script feat: Add format check to validate script May 24, 2020
Copy link
Owner

@kentcdodds kentcdodds left a comment

Choose a reason for hiding this comment

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

Quick question.

@@ -18,6 +18,9 @@ const useDefaultScripts = typeof validateScripts !== 'string'
const scripts = useDefaultScripts
? {
build: ifScript('build', 'npm run build --silent'),
format: preCommit
? null
: ifScript('format', 'npm run format -- --check'),
Copy link
Owner

Choose a reason for hiding this comment

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

What happens when prettier is passed --write and --check at the same time?

Also, this kinda assumes that the format script is using something that accepts the --check flag (like kcd-scripts format which forwards the flags to prettier). So it probably does, but maybe we should note that in a code comment.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The test one also assumes there's a test script that accepts a --coverage flag, so I don't think we should mind the --check flag

Have to look into the code so we don't send the --write flag when checking I think.

Base automatically changed from master to main January 25, 2021 23:15
Copy link
Contributor

@nickserv nickserv left a comment

Choose a reason for hiding this comment

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

Haven't tested this but the code looks good

@nickserv
Copy link
Contributor

Actually just noticed something. Is the script passed file paths to format? If not Prettier will fail and print usage, so you should add . to check all files.

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.

check prettier formatting in validate script
3 participants