lint-staged
commitlint
Our great sponsors
lint-staged | commitlint | |
---|---|---|
50 | 26 | |
12,773 | 15,815 | |
1.5% | 1.9% | |
8.4 | 9.6 | |
3 days ago | 6 days ago | |
JavaScript | TypeScript | |
MIT License | MIT License |
Stars - the number of stars that a project has on GitHub. Growth - month over month growth in stars.
Activity is a relative number indicating how actively a project is being developed. Recent commits have higher weight than older ones.
For example, an activity of 9.0 indicates that a project is amongst the top 10% of the most actively developed projects that we are tracking.
lint-staged
-
How Automation Saved Me from Oops Moments: Never Skip Tests in Production Again!
We were already using lint-staged and have a pre-commit hook in place using Husky in our project for linter and prettier. So it made sense to add a check here.
-
Pre-commit with husky & lint-staged
Now you can config it in your package.json, here is the guide doc:
-
Automating code patterns with Husky
In the world of software development, maintaining consistent code quality and ensuring that the codebase adheres to predefined patterns and guidelines is crucial. However, manually enforcing these standards can be time-consuming and error-prone. This is where automation tools like Husky, Lint-Staged, Commitlint, and Commitizen come to the rescue. In this post, we will explore how these tools can be combined to streamline your development workflow.
-
Set up linting and formatting for code and (S)CSS files in a Next.js project
lint-staged is a package that can be used to run formatting and linting commands on staged files in a Git repo.
-
How do you handle eslint/prettier configs across multiple repos?
To answer your next question: I lint and format on save, and I use Git hooks installed by Husky and executed through Lint-Staged (this tool helps ensure your Git hooks only run on modified files, etc) to ensure there are no lint or formatting errors whenever making a commit or pushing code. This is helpful for teams, as some developers tend to forget to run lint tasks, or don't have the Prettier extension installed in their IDE. If there are lint errors, the commit is rejected until fixed. YMMV - you'll need to fine-tune the strictness of this based on the team's needs.
-
How to create and publish a TypeScript library with ease
Uses Husky Git hooks and Lint-staged pre-commit hooks.
-
How to Contribute on the First Day of a Frontend Project
Something else to consider is applying linting and formatting before every git commit. A package like Lint-staged only lints and formats on staged items, ensuring all pushed code follows the standards in the repo. This allows developers to have their own formatting preferences when developing, while the code homogenizes on push. Linting pre-commit also avoids strict rules like no-console or no-unused-vars restricting a developer when writing code, when it should only apply in production. Imagine not being able to console log anything during development!
-
Commit Like a PRO
Lint-Staged Docs
-
How to beautify your code and make contributions easy?
Additionally, there are pre-commit hooks which can be setup to seamlessly validate and modify the source code before every commit. I followed Prettier documentation to create one. I ran npx mrm@2 lint-staged which installed husky and lint-stagedand added a configuration to the project’s package.json. Then, I modified the commands a little and that's it.
-
Just deployed my first web app. I know it's simple, but any feedback would be greatly appreciated..
I'm noticing a lack of formatting in your JS. Some files have semi-colons, some don't. Some lines are indented more than others. There's inconsistent use of single vs double quotes. You can easily standardize formatting with a Prettier. It's recommend to run it with husky and lint-staged on every commit so you never commit code which is unformatted. (Same with your HTML and CSS which are inconsistently formatted making it harder to read.)
commitlint
-
Better Git Commits with `@commitlint`
There are many features of commitlint that I can't mention one by one, as well as installation guide. To know the detail you can directly access https://github.com/conventional-changelog/commitlint.
-
Nodejs Boilerplate with Typescript and Express
Commit Lint
-
Setting Up a Modern Preact Application With Typescript, Vite and Vitest
I personally find it quite useful to enforce a uniform commit style. commitlint pairs well with husky.
-
Commit message linting within Magit?
Can setup tools like Commitlint to add hooks that will reject a commit message if it is invalid, but if you format a commit message incorrectly it simply closes the commit buffer and returns to git status, meaning you have to retype out your commit message, which is obviously less than ideal.
-
🚀 Angular 14 + ESLint, Material + Transloco + Jest, TestCafe + Docker + Prettier 🚀
✅ Angular 14 ✅ Angular Material ✅ Unit Testing with Jest ✅ End-to-End Testing with TestCafé ✅ Internationalization with Transloco ✅ Auto documentation with Compodoc ✅ Analyse your project with source-map-explorer ✅ Docker ✅ ESLint ✅ Prettier ✅ Commit Linting
- Require commit-msg hook for all users...
-
commitlint VS lintje - a user suggested alternative
2 projects | 11 Sep 2022
-
How to make an npm package with an automated workflow
const Configuration = { extends: ["@commitlint/config-conventional"], formatter: "@commitlint/format", ignores: [(commit) => commit === ""], defaultIgnores: true, helpUrl: "https://github.com/conventional-changelog/commitlint/#what-is-commitlint", }; module.exports = Configuration;
-
Releases the Easy Way
Now you’ll be notified if you try to make a commit whose message doesn’t meet the Conventional Commit standards! Even better, you can configure your linting by updating your config file with some rules!
-
Things you must have in every Repo for Javascript
we need husky Hooks to enforce commit lint for our code with commitlint Lets first install https://github.com/conventional-changelog/commitlint module
What are some alternatives?
semantic-release - :package::rocket: Fully automated version management and package publishing
Nest - A progressive Node.js framework for building efficient, scalable, and enterprise-grade server-side applications with TypeScript/JavaScript 🚀
husky - Git hooks made easy 🐶 woof!
stylelint - A mighty CSS linter that helps you avoid errors and enforce conventions.
graphql-code-generator - A tool for generating code based on a GraphQL schema and GraphQL operations (query/mutation/subscription), with flexible support for custom plugins.
prettier - Prettier is an opinionated code formatter.
volar - ⚡ Explore high-performance tooling for Vue [Moved to: https://github.com/vuejs/language-tools]
pre-commit - A framework for managing and maintaining multi-language pre-commit hooks.
jest - Delightful JavaScript Testing.
standard-version - :trophy: Automate versioning and CHANGELOG generation, with semver.org and conventionalcommits.org