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

[docs] Fix grammar issues in Babel plugin unwrap-createstyles #18856

Merged
merged 1 commit into from
Dec 15, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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