One Linter to Rule Them All
One linter to bind them. Okay, okay. Jokes aside. Linting should be easy. Here at InfernoRed Technology, we work on many different technologies. This can lead to lots of variations in how linting or code checking works. I've been searching for an easy way to lint multiple projects with a similar process and lead to a similar quality. Here are two of the solutions I've come across. Happy coding!
GitHub's Super Linter
GitHub's SuperLinter has been around since 2020, but not everyone has heard of it. The pitch was simple. One linter to rule them all. Only install one linter and it'll lint all your various different types of code. From Kotlin to Typescript, this linter has it all.
Keep in mind you can still use the customization on many of your favorite linters. For example, you can still have a custom eslintrc. This just reduces the setup on having the linter run on CI.
Quick Setup on GitHub
- Create a workflow file named
super-linter.yml
in.github/workflows
- Copy the code below and commit file to a branch.
Note: Be sure to pin the versions with git hashes and use the latest version. - Merge your branch to your
main
- You're done! 🎉
Ox Security's MegaLinter
Well, if SuperLinter is so good, why would you need anything else? There's a couple gaps that SuperLinter doesn't fill. MegaLinter has their own comparison here, but I noticed some of these items are already out of date. For example, C++ has recently been added to SuperLinter. For many, I think the reason will be simple. It has both Android (Kotlin) and iOS (Swift). I think swiftlint
is the biggest missing component of SuperLinter. However, feel free to compare SuperLinter's list against MegaLinter's below.
Quick Setup for GitHub
- Create a workflow file named
mega-linter.yml
in.github/workflows
- Copy the code below and commit file to a branch.
Note: Be sure to pin the versions with git hashes and use the latest version. - Merge your branch to your
main
- You're done! 🎉
Quicker Setup
MegaLinter comes with an assisted setup for an even quick setup. Just run this command and follow the prompts to setup MegaLinter for your codebase with your CI of choice such as GitHub Actions, GitLab CI, Azure Pipelines, BitBucket Pipelines, Jenkins and so much more.
npx mega-linter-runner --install
Closing Notes
Thanks for taking the time to read this quick way to improve linters for your team. I hope that this can help your teams be more consistent together. Curious about tweaks you could make to these linters specific to your teams? Reach out to the InfernoRed Technology team.