grunt-remove-logging icon indicating copy to clipboard operation
grunt-remove-logging copied to clipboard

Common (enough?) inline semicolon usage to warrant a RegExp fix?

Open eckdanny opened this issue 10 years ago • 1 comments

I too was getting burned with not semicolon matching ([^;]). Turns out there are a few things that the devs on my team like to do that cause problems with the RegExp matching solution which may or may not be representative of all users of the plugin.

I started a new issue because I wanted to provide some "feedback from the field" on #18 but the title didn't really capture my concerns. Thanks for this great plugin btw!

Getting cute with colored output:

console.log('%c Look at me!', 'background: #222; color: #bada55');

Inline commenting:

console.log('hello world'); // Logs a hello msg

I had a crack at mixing up the regex... (exploding by string delimiters and parens) but because braceless conditionals is also a big problem for us I think going down the path of #19 is best.

For now, I'm keeping grunt-remove-logging in place as it solves 95% of the console.log problems we have, and just using grep/manual methods to replace the rest. It'd be great if this was a single routine tho.

eckdanny avatar Dec 23 '13 17:12 eckdanny

Take a look at grunt-groundskeeper which uses esprima instead of a simple regex. It'll probably address these use cases.

ehynds avatar Dec 23 '13 18:12 ehynds