Skip to content

Make and promote recommended and shareable presets like in eslint, tslint #1141

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

Open
jirfag opened this issue May 17, 2020 · 5 comments
Open
Labels
enhancement New feature or improvement
Milestone

Comments

@jirfag
Copy link
Contributor

jirfag commented May 17, 2020

Motivation

  1. Some linters are duplicated partially or fully: [errcheck, goerr13, staticcheck], [modguard, depguard], [golint, stylecheck]
  2. Some really cool linters aren't used because there are too many linters and only some of them are enabled by default.
  3. Configuration became too large. Even maintainers (me too) don't know all configuration options and linters.
  4. A common situation is to have multiple .golangci.yml config files because of a lack of extending capabilities.

Proposal

We need to research how eslint, tslint, etc work with that. My first guess is to introduce presets like golangci:recommended and add the ability to share and reuse such presets like airbnb-eslint. Such presets can include any configuration subset: linters, their configuration, output, etc.

@jirfag jirfag added the enhancement New feature or improvement label May 17, 2020
@jirfag jirfag changed the title Make and promote recommended presets like in eslint, tslint Make and promote recommended and shareable presets like in eslint, tslint May 17, 2020
@jirfag jirfag modified the milestones: v2.0.0, v1.21.0 May 24, 2020
@stale
Copy link

stale bot commented Jun 2, 2021

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale No recent correspondence or work activity label Jun 2, 2021
@ldez ldez removed the stale No recent correspondence or work activity label Jun 2, 2021
@thepwagner
Copy link

#2137 is perhaps related, especially when this idea gets into shared presets like airbnb-eslint.

@stale
Copy link

stale bot commented Nov 13, 2022

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale No recent correspondence or work activity label Nov 13, 2022
@ldez ldez removed the stale No recent correspondence or work activity label Nov 13, 2022
@ringerc
Copy link

ringerc commented Aug 15, 2023

I quickly hit issues with trying to promote a preferred default set of golangci-lint rules for my org, while preserving individual teams' ability to customise, add to and override them on a per-component / per-repo basis. Short of hacks in build automation like pre-processing a .golangci.yaml.d snippets directory to generate a config as part of build automation I didn't find a sensible way to do it.

The lightest-way to satisfy this might be to support a config-directory in golangci-lint like a .golangci.yaml.d. If the configuration points to a directory, all files in that directory are read in locale "C" sort-order and merged. How well this would work will depend a bit on how the config is expressed though; to be useful it has to be possible to match and delete array entries created by earlier configs.

That still leaves the problem of syncing the config snippets to the user of golangci-lint, but the workflow automation that runs the linter can probably take care of that.

@ldez
Copy link
Member

ldez commented Aug 15, 2023

Just to link the discussion topic: #3954

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or improvement
Projects
None yet
Development

No branches or pull requests

4 participants