Skip to content

Commit

Permalink
Docs: fix grammar issues in Babel-plugin-unwrap-createstyles
Browse files Browse the repository at this point in the history
  • Loading branch information
RDIL authored Dec 15, 2019
1 parent e039ffb commit 6bda0a0
Showing 1 changed file with 13 additions and 11 deletions.
24 changes: 13 additions & 11 deletions packages/babel-plugin-unwrap-createstyles/README.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
## Motivation

We write our demos in TS but want to offer the same demos to JS users.
We write our demos in TS, but want to offer the same demos to JS users.
Maintaining two versions of the demos is hard and therefore we simply transpile
the TS demos with babel to JS.
the TS demos with Babel into JS.

However we have some TS only utility functions that are essentially identity function
with no side-effects whos only purpose is to defeat type widening. These add noise
to the JS files and bundle size for everyone.
However, we have some TS-only utility functions that are essentially identity function
with no side-effects, with the sole purpose being to defeat type widening.
Without it, noise is added to the JS files and bundle size for everyone.

This plugin unwraps them
This plugin unwraps them.

## Recognized patterns

Expand All @@ -20,6 +20,8 @@ const styles = () => createStyles({});
export default withStyles(styles)(Component);
```

would be changed to:

```js
import { withStyles } from '@material-ui/core/styles';

Expand All @@ -35,9 +37,9 @@ It works also with the `@material-ui/styles` package.
- default import from `createStyles`
- aliased imports

## Why not as a typescript transformer?
## Why not a TypeScript transformer?

Face these issues in chronological order
1. no config API i.e. transformers are only supported for programmatic transpilation/compilation
2. since we need to pipe prettier we might as well use a programmatic approach so back to transformer
3. typescript does not preserve blanklines (Microsoft/TypeScript#843) back to babel plugins
We face these issues (in chronological order):
1. no config API (i.e. transformers are only supported for programmatic transpilation/compilation)
2. since we need to pipe Prettier, we might as well use a programmatic approach so back to transformer
3. TypeScript does not send blanklines (Microsoft/TypeScript#843) back to Babel plugins

0 comments on commit 6bda0a0

Please sign in to comment.