Skip to content
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

Configuration per files #105

Open
azu opened this issue Mar 28, 2020 · 3 comments
Open

Configuration per files #105

azu opened this issue Mar 28, 2020 · 3 comments
Labels
Status: Proposal Request for comments

Comments

@azu
Copy link
Member

azu commented Mar 28, 2020

Summary

Some use case multiple configuration in a project.

  • lint manifest/*.yml with manifest rules
  • lint "**/*" with recommended rules

It will gain performance, because reduce manifest rules works.

Currenlty, we can do this will by two steps:

  1. secretlint --secretlintrc .secretlintrc.manifest.json "manifest/*.yml"
  2. secretlint --secretlintrc .secretlintrc.json "**/*"

We need to optimize this pattern.

Basic example

ESlint resolve this issue by overrides config.

{
  "rules": {
    "quotes": ["error", "double"]
  },

  "overrides": [
    {
      "files": ["bin/*.js", "lib/*.js"],
      "excludedFiles": "*.test.js",
      "rules": {
        "quotes": ["error", "single"]
      }
    }
  ]
}

Maybe, It is complex.

We need to think more reasonable solutions.

@azu azu added the Status: Proposal Request for comments label Mar 28, 2020
@azu
Copy link
Member Author

azu commented Mar 30, 2020

I have a idea: add includes and excludes for each rule.
Secretlint use minimatch and target file before linting.

{
  "rules": [{
     "id": "example",
     "includes": ["**/*"],
     "excludes": ["ignored_dir/**"]
  }]
}

When run secretlint with above config

secretlint "**/*"
  • target/test.txt: it is linted
  • ignored_dir/text.txt: it is ignored

@azu
Copy link
Member Author

azu commented Apr 22, 2020

#105 (comment)
This concept is that secretlintignore for a rule.
I think that this configuration is useful. It will improve performance and improve flexibility.
As Cons, It make a bit complexibility to codebase?

@moltar
Copy link

moltar commented Oct 6, 2023

I think includes and excludes are necessary, and can unlock a lot of useful functionality, especially for monorepos, where rules might be per-package.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Proposal Request for comments
Projects
None yet
Development

No branches or pull requests

2 participants