Skip to content
This repository has been archived by the owner on Jun 3, 2024. It is now read-only.

Move PropTypes from React package to prop-types #160

Merged
merged 4 commits into from
Feb 23, 2018

Conversation

mjclawar
Copy link
Contributor

Description

This moves the PropTypes import from react to prop-types.

Example:

import React, { PropTypes } from 'react';

is now

import React from 'react';
import PropTypes from 'prop-types';

This will allow dash-core-components to support React 16+ by patching in different versions to the dash-renderer by the Dash developer (for now).

For example, in the application definition file:

import dash_renderer
dash_renderer._js_dist_dependencies = [
                {
                    'external_url': [
                        'https://unpkg.com/react@16/umd/react.production.min.js',
                        'https://unpkg.com/react-dom@16/umd/react-dom.production.min.js'
                    ],
                    'relative_package_path': [
                        'react.production.min.js',  # where the user has added this file to the installed dash-renderer for now
                        'react-dom.production.min.js'  # where the user has added this file to installed dash-renderer for now
                    ],
                    'namespace': 'dash_renderer'
                }
            ]

Changes

@@ -1,4 +1,5 @@
import React, {Component, PropTypes} from 'react';
import PropTypes from 'prop-types';
import React, { Component } from 'react';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

a few nit-picky things. I have the personal convention of using {Component} rather than { Component }

@@ -252,4 +253,4 @@ Upload.defaultProps = {
borderColor: '#c66',
backgroundColor: '#eee'
}
};
};
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, my editor will automatically add new lines to the ends of files whereas it looks like yours removes them. Could we add these newlines back?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Otherwise the next time I make a PR, it'll have these superfluous diffs

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mind if I add a .editorconfig with a newline at the end of all files then?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this was the codemod that made all the style changes at the end of files.

@chriddyp
Copy link
Member

Looks good to me here too. Once we change { Component } to {Component} and add the new lines back, I'll merge this

- Add newlines at end of file.
- Add a .editorconfig for newlines at end of file.
@mjclawar
Copy link
Contributor Author

@chriddyp fixed the style mismatches. I added a .editorconfig file that makes sure the newline gets added to future files, but I can remove that if you prefer to avoid adding that file.

@chriddyp
Copy link
Member

.editorconfig - very nice! didn't know about this

@chriddyp chriddyp merged commit f05e229 into plotly:master Feb 23, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants