How to have multiple patterns for lint-staged?

Viewed 649

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.

1 Answers

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"
    ]
  }
Related