worker-dom icon indicating copy to clipboard operation
worker-dom copied to clipboard

Linter + rollup plugin for transpile workarounds

Open dreamofabear opened this issue 7 years ago • 1 comments

E.g. we workaround super.getter (#332) to avoid an expensive transpile. It would be nice to have:

  1. A linter to catch and ban future instances of super.getter pattern.
  2. A rollup plugin to remove the workaround for module outputs.

dreamofabear avatar Mar 08 '19 17:03 dreamofabear

Another pattern here would be to selectively modify the root source in this case for the nomodule output.

Input

class Y {
  get textContent() {
    return 'text';
  }
}

class x extends Y {
  get textContent() {
    return super.textContent;
  }  
}

Module Output

class Y {
  get textContent() {
    return 'text';
  }
}

class x extends Y {
  get textContent() {
    return super.textContent;
  }  
}

Nomodule Output (Before Babel)

class Y {
  get textContent() {
    return 'text';
  }
  _textContent() {
    return 'text';
  }
}

class x extends Y {
  get textContent() {
    return super._textContent();
  }  
}

kristoferbaxter avatar Mar 11 '19 22:03 kristoferbaxter