1

I would like to lint staged files that are both .ts or .tsx that are inside the src folder, I know that in order to select all js files you can do "*.js": [--list of commands--] inisde the lint staged property.

I would like to know more about this language used select and import files in node.js, is it similar to regex without escape characters or is it Unix based?

Andre GolFe
  • 300
  • 5
  • 12

1 Answers1

2

Those are GLOB patterns

Most of the time you'll see simple wildcard patterns like:

*.ts

Matches:

foo.ts
bar.baz.ts

Or you'll need to match all files in a directory no matter how deeply nested:

src/**/*.ts

Matches:

src/foo.ts
src/bar/baz.ts
src/a/b/c/d/e/f/g/h/i.ts
Alex Wayne
  • 178,991
  • 47
  • 309
  • 337
  • Any chance I could use a pattern to match the .tsx files inside the src folder? Or should I duplicate the commands? – Andre GolFe Apr 21 '21 at 15:39
  • I'm not sure what are asking that isn't outlined above. ".tsx files inside the src folder" would be either `src/*.tsx` for all files in that folder or `src/**/*.tsx` for all files nested under that folder. – Alex Wayne Apr 21 '21 at 16:22
  • I found what I was looking right here https://stackoverflow.com/a/53670956/12898885, thanks – Andre GolFe Apr 21 '21 at 16:46