diff --git a/packages/babel-plugin-unwrap-createstyles/README.md b/packages/babel-plugin-unwrap-createstyles/README.md index 90686355c803f9..1029607e4811bc 100644 --- a/packages/babel-plugin-unwrap-createstyles/README.md +++ b/packages/babel-plugin-unwrap-createstyles/README.md @@ -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 @@ -20,6 +20,8 @@ const styles = () => createStyles({}); export default withStyles(styles)(Component); ``` +would be changed to: + ```js import { withStyles } from '@material-ui/core/styles'; @@ -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