- 31 Jan, 2020 10 commits
-
-
吕立青 authored
* setupTestFrameworkScriptFile is deprecated __Note:_ `_setupTestFrameworkScriptFile_` _is deprecated in favor of_ `_setupFilesAfterEnv_`_.__ ref: https://jestjs.io/docs/en/configuration#setupfilesafterenv-array * Update docusaurus/docs/running-tests.md Co-Authored-By:
Simen Bekkhus <sbekkhus91@gmail.com> Co-authored-by:
Simen Bekkhus <sbekkhus91@gmail.com>
-
Andrew Luca authored
This will fix e2e-behaviour on macos Related: https://github.com/npm/cli/issues/611#issuecomment-575287540
-
Matthew Curtis authored
* Expands scope of openBrowser tab control Adjust openChrome.applescript to allow manipulation of other Chromium-based browsers (defaulting to Chrome). Requires list of compatible browsers to try in openBrowser.js * Fix typo * Remove Safari
-
Christopher Button authored
Why: * As per best practice: https://git.kernel.org/pub/scm/git/git.git/tree/Documentation/SubmittingPatches#n135 See also: https://chris.beams.io/posts/git-commit/#imperative
-
Cassidy Williams authored
-
Ian Sutherland authored
- babel-plugin-named-asset-import@0.3.6 - babel-preset-react-app@9.1.1 - cra-template-typescript@1.0.1 - cra-template@1.0.1 - create-react-app@3.3.1 - eslint-config-react-app@5.2.0 - react-app-polyfill@1.0.6 - react-dev-utils@10.1.0 - react-error-overlay@6.0.5 - react-scripts@3.3.1
-
Ian Sutherland authored
-
Hu Chen authored
Co-authored-by:
Ian Schmitz <ianschmitz@gmail.com>
-
Kanitkorn Sujautra authored
-
Joshua Pollak authored
-
- 30 Jan, 2020 8 commits
-
-
Tomoya Fujita authored
-
Marius Craciunoiu authored
-
Alex James Vukovity authored
Co-authored-by:
Ian Schmitz <ianschmitz@gmail.com>
-
Boyuan Xu authored
`Auto Fix is enabled by default. Use the single string form.` warning is shown in `.vscode/settings.json` due to changes in vscode-eslint. As autoFix is set to default, object format in `eslint.validate` is deprecated.
-
Kevin Old authored
Co-authored-by:
Ian Schmitz <ianschmitz@gmail.com>
-
Ian Schmitz authored
-
Rasmus Nørskov authored
-
Ian Schmitz authored
Updates dependencies and removes babel plugins that are now covered by `@babel/preset-env`. Co-authored-by:
hdineen <hdineen@hubspot.com>
-
- 23 Jan, 2020 1 commit
-
-
Vincent Semrau authored
-
- 22 Jan, 2020 1 commit
-
-
Retsam authored
This removes `React.FC` from the base template for a Typescript project. Long explanation for a small change: `React.FC` is unnecessary: it provides next to no benefits and has a few downsides. (See below.) I see a lot of beginners to TS+React using it, however, and I think that it's usage in this template is a contributing factor to that, as the prominence of this template makes it a de facto source of "best practice". ### Downsides to React.FC/React.FunctionComponent ##### Provides an implicit definition of `children` Defining a component with `React.FC` causes it to implicitly take `children` (of type `ReactNode`). It means that all components accept children, even if they're not supposed to, allowing code like: ```ts const App: React.FC = () => { /*... */ }; const Example = () => { <App><div>Unwanted children</div></App> } ``` This isn't a run-time error, but it is a mistake and one that would be caught by Typescript if not for `React.FC`. ##### Doesn't support generics. I can define a generic component like: ```ts type GenericComponentProps<T> = { prop: T callback: (t: T) => void } const GenericComponent = <T>(props: GenericComponentProps<T>) => {/*...*/} ``` But it's not possible when using `React.FC` - there's no way to preserve the unresolved generic `T` in the type returned by `React.FC`. ```ts const GenericComponent: React.FC</* ??? */> = <T>(props: GenericComponentProps<T>) => {/*...*/} ``` ##### Makes "component as namespace pattern" more awkward. It's a somewhat popular pattern to use a component as a namespace for related components (usually children): ```jsx <Select> <Select.Item /> </Select> ``` This is possible, but awkward, with `React.FC`: ```tsx const Select: React.FC<SelectProps> & { Item: React.FC<ItemProps> } = (props) => {/* ... */ } Select.Item = (props) => { /*...*/ } ``` but "just works" without `React.FC`: ```tsx const Select = (props: SelectProps) => {/* ... */} Select.Item = (props) => { /*...*/ } ``` ##### Doesn't work correctly with defaultProps This is a fairly moot point as in both cases it's probably better to use ES6 default arguments, but... ```tsx type ComponentProps = { name: string; } const Component = ({ name }: ComponentProps) => (<div> {name.toUpperCase()} /* Safe since name is required */ </div>); Component.defaultProps = { name: "John" }; const Example = () => (<Component />) /* Safe to omit since name has a default value */ ``` This compiles correctly. Any approach with `React.FC` will be slightly wrong: either `React.FC<{name: string}>` will make the prop required by consumers, when it should be optional, or `React.FC<{name?: string}>` will cause `name.toUpperCase()` to be a type error. There's no way to replicate the "internally required, externally optional" behavior which is desired. ##### It's as long, or longer than the alternative: (especially longer if you use `FunctionalComponent`): Not a huge point, but it isn't even shorter to use `React.FC` ```ts const C1: React.FC<CProps> = (props) => { } const C2 = (props: CProps) => {}; ``` ### Benefits of React.FC ##### Provides an explicit return type The only benefit I really see to `React.FC` (unless you think that implicit `children` is a good thing) is that it specifies the return type, which catches mistakes like: ```ts const Component = () => { return undefined; // components aren't allowed to return undefined, just `null` } ``` In practice, I think this is fine, as it'll be caught as soon as you try to use it: ```ts const Example = () => <Component />; // Error here, due to Component returning the wrong thing ``` But even with explicit type annotations, `React.FC` still isn't saving very much boilerplate: ```ts const Component1 = (props: ComponentProps): ReactNode => { /*...*/ } const Component2: FC<ComponentProps> = (props) => { /*...*/ } ```
-
- 21 Jan, 2020 1 commit
-
-
Reece Dunham authored
-
- 16 Jan, 2020 1 commit
-
-
Evan Grim authored
-
- 12 Jan, 2020 2 commits
-
-
Tom Valorsa authored
-
Kai Hao authored
-
- 30 Dec, 2019 1 commit
-
-
Alex Guerra authored
The old favicon was the same as the official react documentation, which is a minor annoyance during development when trying to find the tab you want. The new favicon is just the old with inverted colors. Closes #7957
-
- 20 Dec, 2019 1 commit
-
-
Sony AK authored
-
- 19 Dec, 2019 1 commit
-
-
Andreas Cederström authored
-
- 18 Dec, 2019 1 commit
-
-
Brian Muenzenmeyer authored
-
- 16 Dec, 2019 1 commit
-
-
Alex Guerra authored
- Remove templates version minimum stopgap. - Replace indexOf with more idiomatic alternatives. - Inline errorLogFilePatterns. - Alphabetize validFiles. - Simplify log file removal code. - Move unconditional console.log() call outside of isSafe. - Differentiate conflicting directories from files. - Document yarn version special case. - Inline printValidationResults. - Standardize checkAppName output on failure. - Add link for checkThatNpmCanReadCwd. Functionally the code should be exactly the same.
-
- 15 Dec, 2019 2 commits
-
-
Peet Goddard authored
-
Jerome De Leon authored
* Add package-runner note to readme * Add link to `yarn create`
-
- 14 Dec, 2019 1 commit
-
-
Andreas Cederström authored
* Bump dependencies in react-dev-utils * Bump dependencies in react-app-polyfill * Bump dependencies in create-react-app * Bump dependencies in react-error-overlay * Bump dependencies in react-scripts * Bump react
-
- 13 Dec, 2019 4 commits
-
-
Ian Sutherland authored
-
Andreas Cederström authored
-
Andreas Cederström authored
-
Alex Guerra authored
Make the --info subcommand outuput the current version information and the location of the file being run. Our issue template tells users to provide the output of --info, so having the current version is incredibly helpful, especially since it doesn't necessarily match the globally installed version that envinfo outputs. Knowing the location helps us determine whether the running bin is globally installed or in the local node_modules.
-
- 11 Dec, 2019 1 commit
-
-
Reece Dunham authored
* security: update terser webpack plugin
-
- 10 Dec, 2019 1 commit
-
-
Endi authored
-
- 09 Dec, 2019 2 commits
-
-
Vadzim authored
This is just a comment fix. Actual optional chaining operator syntax is `?.`, not `.?`.
-
Wojciech Zieliński authored
-