All Projects → trunk-io → configs

trunk-io / configs

Licence: MIT license
Trunk.io default linter configs

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to configs

Nvcode
An IDE layer for Neovim with sane defaults. Completely free and community driven.
Stars: ✭ 6,714 (+9630.43%)
Mutual labels:  linters, formatters
LunarVim
An IDE layer for Neovim with sane defaults. Completely free and community driven.
Stars: ✭ 9,296 (+13372.46%)
Mutual labels:  linters, formatters
pycln
A formatter for finding and removing unused import statements.
Stars: ✭ 161 (+133.33%)
Mutual labels:  linters, formatters
vim-filetype-formatter
Format program files in vim using your favorite command line formatter
Stars: ✭ 21 (-69.57%)
Mutual labels:  formatters
hyperlink
Very fast link checker for CI.
Stars: ✭ 85 (+23.19%)
Mutual labels:  linters
Reek
Code smell detector for Ruby
Stars: ✭ 3,693 (+5252.17%)
Mutual labels:  linters
inline-plz
Inline your lint messages
Stars: ✭ 32 (-53.62%)
Mutual labels:  linters
laravel-formatters
«‎Formatter» pattern for Laravel
Stars: ✭ 86 (+24.64%)
Mutual labels:  formatters
Ue4 Style Guide
An attempt to make Unreal Engine 4 projects more consistent
Stars: ✭ 2,656 (+3749.28%)
Mutual labels:  linters
ue5-style-guide
An attempt to make Unreal Engine 4 projects more consistent
Stars: ✭ 2,892 (+4091.3%)
Mutual labels:  linters
salt-lint
A command-line utility that checks for best practices in SaltStack.
Stars: ✭ 111 (+60.87%)
Mutual labels:  linters
rubric
Linter Config Initializer for Python
Stars: ✭ 21 (-69.57%)
Mutual labels:  linters
Go Tools
Staticcheck - The advanced Go linter
Stars: ✭ 4,317 (+6156.52%)
Mutual labels:  linters
eslint-config
🚀 Jetrockets Standarts | ESLint
Stars: ✭ 20 (-71.01%)
Mutual labels:  linters
Pronto
Quick automated code review of your changes
Stars: ✭ 2,450 (+3450.72%)
Mutual labels:  linters
morestachio
Lightweight, powerful, flavorful, template engine.
Stars: ✭ 45 (-34.78%)
Mutual labels:  formatters
megalinter
🦙 Mega-Linter analyzes 48 languages, 22 formats, 19 tooling formats, excessive copy-pastes, spelling mistakes and security issues in your repository sources with a GitHub Action, other CI tools or locally.
Stars: ✭ 534 (+673.91%)
Mutual labels:  linters
lints
Lint all your JavaScript, CSS, HTML, Markdown and Dockerfiles with a single command
Stars: ✭ 14 (-79.71%)
Mutual labels:  linters
lintpack
Build Go linters from lintpack-compatible packages. Also serves as a framework for writing checkers.
Stars: ✭ 28 (-59.42%)
Mutual labels:  linters
Syntastic
Syntax checking hacks for vim
Stars: ✭ 11,044 (+15905.8%)
Mutual labels:  linters

Trunk Configs

Clean default configs for linters, formatters, and more

🎉 Trunk is in beta. We'd appreciate your feedback - stop by the Trunk Community Slack and let us know what you think. Thanks!

Here are some simple and ultra-clean default configs for linters, formatters, and more. Every character has been scrutinized to create the finest dotfiles in the galaxy. Enjoy 😎

PRs are welcome!

Three tips for successful linter configs

1. Turn off formatting errors, use autoformatters instead

Nobody wants to hear about every missing space as a separate lint error. Don't run prettier via eslint. Don't run flake8 formatting errors instead of autoformatting with black, etc. The same theme rings true with most language linter setups.

2. Put your linter configs in standalone files

Sure, you can embed your eslint settings in package.json or your flake8 settings in setup.cfg, but please don't. It's just good separation of concerns. It's easy for other people to find the config options in standalone files, if you stop using a linter it's easy to delete the config, it's easy to look up the format of a config or get editor autocompletion (they often have schemas on schemastore.org), everything is easier.

3. Put your linter configs at the root of your repo

Whether you have a monorepo with language subdirectories or a microrepo with a single source file, by sticking all of your lint configuration at the root, no matter where someone adds new files, they're covered. All too often, large swaths of a codebase go unlinted because linter configs didn't cover some directories.

Why you should spend more time on linter configs

An ounce of prevention is worth a pound of cure. Running more well configured linters will reduce your bugs, increase consistency, reduce security vulnerabilities, and increase your overall speed. Spend a little time now, reap the rewards forever.

Notes

.editorconfig

Always have a .editorconfig file, not only for users of your repo using editors, but also some linters use the settings in .editorconfig. For example shfmt uses it to figure out indentation, and prettier will also respect it as a fallback to its own config (though that is undocumented).

.eslintrc.yaml

Open to contributions! It's really tricky to make a general eslint config that works for everyone, so we don't have one in this collection yet. Eslint's config structure is the singularly most complicated linter config we've seen, and we've seen a lot. That said, there is one must have:

Use eslint-config-prettier to disable any formatting rules eslint turns on:

npm install --save-dev eslint-config-prettier

In your eslint config:

extends:
  - eslint:recommended
  ...
  - prettier

This allows you to autoformat your code with prettier instead of seeing formatting issues one line at a time via eslint.

.clang-format

Clang-format can format a bunch of languages, but we prefer prettier on languages they both cover. To lint additional languages, you need a section for that language as is shown in this .clang-format. Note there's a section for proto: Clang-format can autoformat proto files too! Cool.

This config is yaml, but it's kind of multiple yaml files stacked into the same file. Bad config design, but a good tool!

.flake8

We turned off all the formatting categories because black handles autoformatting. No one should be hearing about formatting issues one space at a time. This is a theme across many linters.

Black itself has a black-compatible flake8 config here, however it keeps flake8 formatting errors on. If you've autoformatted with black, you won't have any flake8 errors with their config, but really you should be gating your CI on both black and flake8 (with trunk), and it's much nicer to hear that you just need to autoformat your file with black, not hear about every missing space as a different lint error.

.clang-tidy

Clang-tidy has one of the more annoying configs around. Tidy has ~50 rules which are aliases of other rules. If you don't disable them, you end up getting duplicate results and tidy takes longer.

Also, the config is yaml, but the Checks key takes a string which is a comma separated list instead of a yaml list. :( The comment blocks at the top describe what we've turned on/off and why.

.markdownlint.yaml

We turned off all formatting categories which are handled by prettier. If you use trunk, you'll just see that your file needs to be autoformatted, not every instance of missing whitespace in your markdown.

.shellcheckrc

This config turns on as much as possible, but relies on sourcing other scripts always relative to the current script's directory. If you want to turn off checking related to source, you could add:

disable=SC1090
disable=SC1091

.stylelintrc.yaml

This config turns on the standard scss config, which is a superset of the standard css config and compatible whether you use scss or not.

Stylelint does require you to install plugins locally though:

npm install --save-dev stylelint stylelint-config-standard-scss stylelint-config-prettier

This config also uses stylelint-config-prettier, which turns off all formatting rules which prettier takes care of. Since you'll be enabling prettier, you don't need to hear about formatting issues that prettier will take care of.

Note: In trunk.yaml you'll want to enable both stylelint-fmt and stylelint. The former automatically fixes what stylelint supports automatic fixes for, and runs via trunk check and trunk fmt. The latter is for issues without autofixes.

svgo.config.js

This config is curated to not break things, as opposed to minify maximally. Specifically it will leave embedded raster images, and both viewbox and width/height attributes in place.

.yamllint.yaml

Yamllint mostly has formatting rules without autofixes. As mentioned above, we recommend using autoformatters as opposed to linters which give formatting errors one space at a time. This config enables only select rules, and not any formatting rules which prettier handles automatically.

What's the best way to run linters and formatters?

Trunk 🎉 (docsvscode extensiongithub action)

Contributing

Think there's a better setup for one of these linters? Put up a PR and let's see it! Also happy to see contributions for linters we haven't covered here.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].