sindresorhus / hide-files-on-github

Chrome extension - Hide nonessential files from the GitHub file browser
https://chrome.google.com/webstore/detail/hide-files-on-github/lpnakhpaodhdkleejaehlapdhbgjbddp
MIT License
320 stars 35 forks source link

Allow multiple regular expressions #50

Closed popey456963 closed 7 years ago

popey456963 commented 7 years ago

Would be nice.

sindresorhus commented 7 years ago

Why?

popey456963 commented 7 years ago

Because editing one massive regular expression is a lot harder than editing lots of smaller ones. Similar to the reason one doesn't put all of their code on one line but instead spaces it out amongst multiple lines.

^\.|^license|^cname$|^version$|^(patents|authors|contributors|acknowledgments|backers)(\.|$)|^(issue|pull_request)_template\.md$|^(appveyor|circle|codecov)\.yml$|^(yarn|Gemfile)\.lock$|^npm-shrinkwrap\.json$|\.sublime-project$|^(tsconfig|typings|tslint|tsfmt)\.json$|^coffeelint\.json$|^(karma|protractor|sauce).*\.js$|^testem(\.[\w-]+)?\.(json|js)$|^yuidoc\.json$|^stylelint-config\.json

Is not the most appealing regular expression. Whereas in my opinion:

^\.
^license
^cname$
^version$
^(patents|authors|contributors|acknowledgments|backers)(\.|$)
^(issue|pull_request)_template\.md$
^(appveyor|circle|codecov)\.yml$
^(yarn|Gemfile)\.lock$
^npm-shrinkwrap\.json$|\.sublime-project$
^(tsconfig|typings|tslint|tsfmt)\.json$
^coffeelint\.json$
^(karma|protractor|sauce).*\.js$
^testem(\.[\w-]+)?\.(json|js)$
^yuidoc\.json$
^stylelint-config\.json

Is much nicer.

popey456963 commented 7 years ago

As a point, it would also be simple to implement this. If multiple lines exist just split on them and then join them with pipes to form the single regular expression.

sindresorhus commented 7 years ago

Ah yeah, good point. Pull request welcome :)

sindresorhus commented 7 years ago

Fixed by https://github.com/sindresorhus/hide-files-on-github/commit/1157a69fa59df4ab78d7df61a251087a425e49af.

fregante commented 7 years ago

Hah I didn't even realize that it had been requested 😁

One note for existing users: the extension will not update your regex, you'll have to do it yourself or leave it empty to get the new multiline defaults.