Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disable, enable, disable-in-line like eslint. #2118

Closed
Stupidism opened this issue Jun 18, 2017 · 1 comment
Closed

Disable, enable, disable-in-line like eslint. #2118

Stupidism opened this issue Jun 18, 2017 · 1 comment

Comments

@Stupidism
Copy link

Stupidism commented Jun 18, 2017

Bug report or feature request?
feature request

ES5 or ES6+ input?

Uglify version (uglifyjs -V)

JavaScript input

The uglifyjs CLI command executed or minify() options used.

JavaScript output or error produced.

I'm trying to serialize function in documentation.
I have a function

  const handler = (props, next) => (count) => {
    if (Math.random() < possibility) {
      next();
      log('hit', possibility, props, count);
    } else {
      log('miss', possibility, props, count);
    }
  };

And I used handler.toString() to print it out:
image

It's pretty good. But after uglify:
image

So I'm thinking If I can have some thing like the /* disable-eslint */, /* disable-enable */, /* disable-enable-line */, /* disable-enable-next-line */ in eslint library.
So I can write the code like this:

/* uglify-compress-disable */
  const handler = (props, next) => (count) => {
    if (Math.random() < possibility) {
      next();
      log('hit', possibility, props, count);
    } else {
      log('miss', possibility, props, count);
    }
  };
/* uglify-compress-enable */
@Stupidism Stupidism changed the title Disable-enable, disable-in-line like eslint. Disable, enable, disable-in-line like eslint. Jun 18, 2017
@alexlamsl
Copy link
Collaborator

In your particular example, disabling reduce_vars may make your customised requirements work.

Closing as duplicate of #361

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants