Skip to content

Commit

Permalink
Fix React warnings (#5877)
Browse files Browse the repository at this point in the history
  • Loading branch information
willdurand committed Aug 14, 2018
1 parent c69dfb2 commit 85113ae
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 17 deletions.
8 changes: 4 additions & 4 deletions src/amo/components/Addon/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,8 @@ const slugIsPositiveID = (slug) => {

export class AddonBase extends React.Component {
static propTypes = {
RatingManager: PropTypes.element,
addon: PropTypes.object.isRequired,
RatingManager: PropTypes.func,
addon: PropTypes.object,
clientApp: PropTypes.string.isRequired,
config: PropTypes.object,
defaultInstallSource: PropTypes.string.isRequired,
Expand All @@ -82,9 +82,9 @@ export class AddonBase extends React.Component {
params: PropTypes.object.isRequired,
}).isRequired,
installStatus: PropTypes.string.isRequired,
userAgentInfo: PropTypes.object.isRequired,
addonsByAuthors: PropTypes.array.isRequired,
addonsByAuthors: PropTypes.array,
setCurrentStatus: PropTypes.func.isRequired,
userAgentInfo: PropTypes.object.isRequired,
};

static defaultProps = {
Expand Down
2 changes: 1 addition & 1 deletion src/amo/components/LandingPage/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ export class LandingPageBase extends React.Component {
// This is a bug; addonTypeOfResults is used in
// `componentWillReceiveProps()`.
// eslint-disable-next-line react/no-unused-prop-types
addonTypeOfResults: PropTypes.string.isRequired,
addonTypeOfResults: PropTypes.string,
// This is a bug; context is used in `setViewContextType()`.
// eslint-disable-next-line react/no-unused-prop-types
context: PropTypes.string.isRequired,
Expand Down
10 changes: 5 additions & 5 deletions src/amo/components/LanguageTools/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -233,9 +233,9 @@ export class LanguageToolsBase extends React.Component<Props> {
</Tr>
);
})
: Array(50).fill(
// eslint-disable-next-line react/jsx-indent
<Tr>
: Array.from(Array(50)).map((_, i) => (
// eslint-disable-next-line react/jsx-indent, react/no-array-index-key
<Tr key={`LoadingText-${i}`}>
<Td>
<LoadingText />
</Td>
Expand All @@ -245,8 +245,8 @@ export class LanguageToolsBase extends React.Component<Props> {
<Td>
<LoadingText />
</Td>
</Tr>,
)}
</Tr>
))}
</Tbody>
</Table>
</Card>
Expand Down
4 changes: 2 additions & 2 deletions src/core/components/InstallButton/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ export class InstallButtonBase extends React.Component {
headerURL: PropTypes.string,
i18n: PropTypes.object.isRequired,
iconURL: PropTypes.string,
id: PropTypes.string,
id: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
install: PropTypes.func.isRequired,
installTheme: PropTypes.func.isRequired,
// See ReactRouterLocationType in 'core/types/router'
Expand All @@ -98,7 +98,7 @@ export class InstallButtonBase extends React.Component {
uninstall: PropTypes.func.isRequired,
updateURL: PropTypes.string,
useButton: PropTypes.bool,
userAgentInfo: PropTypes.string.isRequired,
userAgentInfo: PropTypes.object.isRequired,
version: PropTypes.string,
_InstallTrigger: PropTypes.object,
_config: PropTypes.object,
Expand Down
2 changes: 1 addition & 1 deletion src/core/components/InstallSwitch/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export class InstallSwitchBase extends React.Component {
headerURL: PropTypes.string,
i18n: PropTypes.object.isRequired,
iconURL: PropTypes.string,
id: PropTypes.string,
id: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
install: PropTypes.func.isRequired,
installTheme: PropTypes.func.isRequired,
installURL: PropTypes.string,
Expand Down
6 changes: 3 additions & 3 deletions src/core/installAddon.js
Original file line number Diff line number Diff line change
Expand Up @@ -307,9 +307,9 @@ export class WithInstallHelpers extends React.Component {
// See ReactRouterLocationType from 'core/types/router'
location: PropTypes.object,
platformFiles: PropTypes.object,
name: PropTypes.string.isRequired,
status: PropTypes.string.isRequired,
type: PropTypes.string.isRequired,
name: PropTypes.string,
status: PropTypes.string,
type: PropTypes.string,
userAgentInfo: PropTypes.object.isRequired,
};

Expand Down
2 changes: 1 addition & 1 deletion src/core/middleware/security.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export function getNoScriptStyles(
`src/${appName}/noscript.css`,
);
try {
return fs.readFileSync(cssPath);
return fs.readFileSync(cssPath, 'utf8');
} catch (e) {
if (e.code !== 'ENOENT') {
_log.info(`noscript styles could not be parsed from ${cssPath}`);
Expand Down

0 comments on commit 85113ae

Please sign in to comment.