Closed tbezman closed 3 years ago
Wow, Awesome contribution @tbezman ! We definitely need to add GitHub actions here.
However, we are already using eslint across our projects. We have lint and fix commands in Borsh JS
package.json
. eslint
is a linter, so it's more powerful and can look for potential errors in code. But I can agree that Prettier
is doing a better job in code formatting. So I can see two ways how we can stay consistent and make this project better.
eslint
instead of Prettier
in added GitHub Action.eslint
and Prettier
. They can be in conflict, so we will need to read this article first. Maybe we will need to have two separate actions for them.I would rather use default parameters for Prettier and not override them with a separate config file. More chances that it will not be in conflict with text editors and IDEs.
Bonus points for adding Unit tests GitHub Action (just run yarn test
)
Thanks for getting back to me. I'll apply all of this feedback ASAP.
@volovyk-s Yeah there is a config we can use to disable all eslint rules around code formatting so we can use prettier for formatting, and eslint for code conventions. I think I'll save the ESLint configuration for an upcoming PR since we have a bunch of warnings atm. I'll do the eslint stuff as a followup.
Okay @volovyk-s, I updated the PR. I removed the prettier config (now we're using prettier defaults), and added unit tests to the github action workflow. I think you'll have to make the action a required check on PRs after this merges.
@volovyk-s On this branch, when I run yarn pretty
, none of my files actually change but I do get some output in the console about which files prettier ran against. Are you seeing the same behavior or is something borked?
@tbezman I have double-checked. All good, thank you!
Hm, it's getting changed after yarn test
, that is weird :/
Test and pretty (with small fix) GitHub actions works! https://github.com/near/borsh-js/pull/35
Hoping this a welcome addition. I added prettier and setup a config file that closely matches the existing code style that already existed. I'm also only checking
index.ts
for now which seems like one of our only TypeScript source files.I also setup the repo's first Github Action to ensure code is properly formatted from people posting PRs.