Hi Greg,
Yes, this certainly should work and I'll use an approach like this. I had just hoped there might be a more concise method that I had overlooked. Best, Billy — Billy Matthews 719.439.5484 On Sat, Feb 14, 2015 at 3:16 PM, Greg Cochard <[email protected]> wrote: > What about having a leading comment rather than trailing? If it's on the > same line, just disable the behavior for that line. > On Friday, February 13, 2015 at 4:39:34 PM UTC-8, Nicholas Zakas wrote: >> >> Hi Billy, >> >> We don't have single-line enabling/disabling of rules. It's a bit complex >> using an AST to deal with trailing comments that alter behavior (because >> they logically come after the code they're describing during a traversal). >> That's why we have the eslint-enable and eslint-disable comments work the >> way they do - so we're informed before a change in behavior is necessary. >> >> If this is a big pain point for you, feel free to file an issue and we can >> see if anyone has an idea about how to accomplish something similar. >> >> -N >> >> On Fri, Feb 13, 2015 at 1:38 PM, Billy Matthews <[email protected] >> <javascript:>> wrote: >> >>> Hello, >>> >>> I am thinking there must be a way to do what this, but I can't seem to >>> find it in the documentation ... but is there a way to mute/ignore a single >>> instance of a rule through a comment? >>> >>> For example, say I have the below: >>> >>> if (someThing) { >>> // Need to evaluate the value for some arbitrary reason >>> value = eval(value); >>> } else { >>> // Something else happens >>> } >>> >>> Then the eval rule will yell at me. But in this instance I know I need it >>> and I'd prefer not to see this warning anymore. From the docs it seems I >>> could do something like the following: >>> >>> if (someThing) { >>> // Need to evaluate the value for some arbitrary reason >>> /*eslint-disable no-eval*/ >>> value = eval(value); >>> /*eslint-enable */ >>> } else { >>> // Something else happens >>> } >>> >>> Which definitely makes sense for a block of code, but for a single line >>> it seems like a lot of markup, what I'm looking for is something more like: >>> >>> if (someThing) { >>> // Need to evaluate the value for some arbitrary reason >>> value = eval(value); /*eslint-ignore no-eval*/ >>> } else { >>> // Something else happens >>> } >>> >>> Does something like this exist? >>> >>> Thanks, >>> Billy Matthews >>> >>> -- >>> You received this message because you are subscribed to the Google Groups >>> "ESLint" group. >>> To unsubscribe from this group and stop receiving emails from it, send an >>> email to [email protected] <javascript:>. >>> For more options, visit https://groups.google.com/d/optout. >>> >> >> >> >> -- >> >> ______________________________ >> Nicholas C. Zakas >> @slicknet >> >> Author, Professional JavaScript for Web Developers >> Buy it at Amazon.com: >> http://www.amazon.com/Professional-JavaScript-Developers-Nicholas-Zakas/dp/1118026691/ref=sr_1_3 >> -- You received this message because you are subscribed to the Google Groups "ESLint" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
