evanshortiss / lintspaces-cli

A CLI for the node-lintspaces module.
MIT License
18 stars 6 forks source link

Cannot pass regex into ignores #3

Closed matthew-andrews closed 8 years ago

matthew-andrews commented 10 years ago

Firstly - great module it's helped us catch all sorts of subtle mistakes. :smile:

It would be super handy if you could pass regular expressions in as custom ignores.

I'm not sure myself if supporting this is even a good idea - I tried implemented it and it's non-trivial.

I was testing with the following command:-

lintspaces test.js -d tabs -i '"/var ([^=]+=.*,)*([^=]+=.*;)/g",js-comments'
evanshortiss commented 10 years ago

Apologies, I've only just noticed this!

This is supported by the main module that this CLI uses internally (node-lintspaces) so the CLI should ideally support it too.

I'll do some investigation as soon a I get a chance. It may be worth having a separate flag for RegEx ignores so they can be identified more easily.

kaelig commented 9 years ago

Hi there! We'd love to have an update on this.

kaelig commented 8 years ago

Hi @evanshortiss, any chance this will ever get fixed?

evanshortiss commented 8 years ago

Hey @kaelig,

I missed your previous comment, I'll try look into it this week. If you have experimented with a fix I'd be happy to accept a PR

evanshortiss commented 8 years ago

@matthew-andrews @kaelig I've taken a look into this have implemented a solution. Can you guys let me know is it workable for you?

The readme for 0.3.0 has the details, but basically this is the new syntax:

# -r is for regex ignores, and -i is for built in ignore patterns
lintspaces -r '/pointless|regex/g' -i 'js-comments' -i 'c-comments' *.js
evanshortiss commented 8 years ago

@matthew-andrews @kaelig closing this now. Let me know if you feel it is not sufficient 😄