In an era of omnipresent frameworks, libraries and tooling, it may be hard to decide what tool to use and when.
I know from experience, that the f...
For further actions, you may consider blocking this person and/or reporting abuse
The only thing
precommit
package do, is running all the scripts listed in package.json, eg."pre-commit": ["test", "lint"]
before everygit commit
command.When you install it, it sets up everything for you, so that you don't need to do or remember anything.
Sounds good, does it cancel operation
commit
in case of not successful command execution, like 'test' etc?That's exactly how it works. There is
--no-verify
flag (which is a default git flag, rather than any other library thing), but I doesn't recommend using it if you wish to push your commits :)Great article, although ironically I've now wasted 30 minutes trying to get StandardJS to work. It appears to install fine but just cries "command not found" when I try and run it :/ I use plenty of other npm libraries on a daily basis so no idea whats wrong with this one ... Shame
It's because I don't use npm global installation in this article. If you want it to be accessible from anywhere, you have to write
npm install -g standard
.However, if you use it withing
package.json
scripts, then it can be installed locally, without-g
flag and it will still run when done throughnpm run lint
or any othernpm
script.Great post, thanks for advice. It would be really nice if there was an easy way to add ES6 imports/exports to the flow.
There is, but why would you need an ES6 modules in Node.js? It doesn't support it natively anyway. Or do you want to use ES6 modules and just be able to test them like I described in an article?
I know that they're not supported yet, but I hope we'll get it soon. I am a front-end dev, and so in general I have to spend a lot of time tuning webpack/babel before I start a project. And as you probably know, ES6 modules are commonly used in front-end nowadays.
Testing would also be nice.
I got you covered! ;)
gist.github.com/kamilogorek/0a2d7f...
And then you can use ES6 modules in your tests as well as in your code :)
Thanks a lot, Kamil,
you're a real MVP :)
Very helpful! I set it up with the support for ES6-Modules a few posts down! Just starting to write (serious) JS-code, and never used npm / node before. So this covers a lot for me! (TDD, git and more).
<3 <3 <3
Glad I could help! :)
Thanks! This is great post!!! 🙏
Dude, thank you so much! I've been attempting getting a modern JS-based development environment working smoothly for a little while now. This is exactly what I was looking for!
Except only minority of devs use mentioned tools. There are modern tools out there that have much greater support.
Glad I could help! :)
"Because the environment assumes you’ll work in TDD style"
What does TDD mean ?
Test Driven Development, a practice where you write tests first, and the implementation afterwards.
Can read more online, or Test Driven Development: By Example by Kent Beck
Test Driven Development – en.wikipedia.org/wiki/Test-driven_...
Thank you !
Looks nice, apart from Standard. XO achieves the same goal.
Thanks. It's just a matter of a preference, as they both achieve then same thing, as you just said.
Valuable post. Where's the damn like/heart/+1 button on this thing? Need2bookmark