Skip to content

Add commit message linting #1382

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

Merged
merged 10 commits into from
Jan 9, 2020
Merged

Conversation

dobromir-hristov
Copy link
Contributor

Description

Adds commit message linting before each commit.
Applies the conventional-commit pattern, also known as Angular preset.

@dobromir-hristov
Copy link
Contributor Author

Netlify's node version is 8.x where one of the packages depends on v10.x
Should I try do bump down the version of the package or should we set a higher version of Node on Netlify?

@JessicaSachs
Copy link
Collaborator

JessicaSachs commented Dec 21, 2019 via email

@afontcu
Copy link
Member

afontcu commented Dec 22, 2019

I have mixed feelings here.

Having conventional commits is a great idea, but adding a commit linting step for everyone might feel like a blocker when starting to contribute to the library.

If we use a squash merge strategy, we can customise the commit message that ends up in dev/master, so users could use whatever message they like, and we'd be the ones responsible for setting the right message.

This way we would have the best of both worlds: Angular-based commit messages while keeping it simple for contributors.

I've been using this approach both internally and in DOM Testing Library (and other Testing Lib projects) and works like a charm.

Thoughts?

@dobromir-hristov
Copy link
Contributor Author

Well I can see where you are coming from here and you have a fair point.
Users could be a bit intimidated when they see a commit error, but then again, its a not rocket science to do this. Also helps us to see what happened in the commit.

I looked at Vue, Vue-cli and other similar libs and all use that pattern.

Other way of doing this would be to drop commit linting, but still allow them to use yarn commit to use Commitizen for an easy message format, if they desire.

@afontcu
Copy link
Member

afontcu commented Dec 22, 2019

I looked at Vue, Vue-cli and other similar libs and all use that pattern.

Okay, that's a fair point.

Sure, let's go with this and provide the commit script to make it easier.

Thanks!

Co-Authored-By: Adrià Fontcuberta <[email protected]>
@dobromir-hristov
Copy link
Contributor Author

Should I change it so prettier and esling run a fix command, and we stage the changes? This way users dont need to figure out how to run them, it just happens for them?

@afontcu
Copy link
Member

afontcu commented Jan 3, 2020

Should I change it so prettier and esling run a fix command, and we stage the changes? This way users dont need to figure out how to run them, it just happens for them?

I don't see why not!

@dobromir-hristov
Copy link
Contributor Author

Now it auto runs lint and prettier, then stages the changes when you commit.
This should prevent issues with errors from eslint or prettier. Works similarly to how it is in Vue core.
Also set a default recommended Node version to 10

@lmiller1990 lmiller1990 merged commit 9ac748b into dev Jan 9, 2020
@lmiller1990 lmiller1990 deleted the feature/add-conventional-precommih-lint branch January 9, 2020 09:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants