4

I had it match on .rb and .js files for instance.

e.g. **/*.{js,rb}

And wanted to also match on Gemfile and Rakefile for instance.

Dorian
  • 7,749
  • 4
  • 38
  • 57

1 Answers1

5

the solution was to recursively use {}, e.g.

  "lint-staged": {
    "{Gemfile,Rakefile,**/*.{js,rb,rake,ru}}": [
      "./node_modules/prettier/bin-prettier.js --write"
    ],
    "**/*.js": [
      "node_modules/eslint/bin/eslint.js"
    ],
    "{Gemfile,Rakefile,**/*.{rb,rake,ru}}": [
      "bundle exec rubocop -a"
    ]
  }
Dorian
  • 7,749
  • 4
  • 38
  • 57
  • 1
    It's a shame that neither `lint-staged` nor `micromatch` docs are clear about this -- at least I only found a proper solution in your answer. Thanks! – Gustavo Straube Nov 18 '21 at 12:00