Updating eslint rules and addressing issues

This commit is contained in:
Jeff Avallone
2019-01-05 12:27:13 -05:00
parent 8a3471b916
commit 837b8d77df
10 changed files with 104 additions and 18 deletions
+6 -2
View File
@@ -21,8 +21,12 @@ export const FooterImpl = ({ site: { siteMetadata } }) => (
Created by <a href="mailto:jeff.avallone@gmail.com">Jeff Avallone</a>
</li>
<li>
Generated images licensed: <a href="http://creativecommons.org/licenses/by/3.0/" rel="license external noopener noreferrer" target="_blank">
<img src="https://licensebuttons.net/l/by/3.0/80x15.png" alt="Creative Commons CC-BY-3.0 License" />
Generated images licensed: <a
href="http://creativecommons.org/licenses/by/3.0/"
rel="license external noopener noreferrer"
target="_blank">
<img src="https://licensebuttons.net/l/by/3.0/80x15.png"
alt="Creative Commons CC-BY-3.0 License" />
</a>
</li>
</ul>
+6 -2
View File
@@ -17,14 +17,18 @@ const query = graphql`
`;
export const HeaderImpl = ({ site: { siteMetadata } }) => (
<header className={ style.header } data-banner={ siteMetadata.banner || null }>
<header
className={ style.header }
data-banner={ siteMetadata.banner || null }>
<h1>
<Link to="/">Regexper</Link>
</h1>
<ul className={ style.list }>
<li>
<a href="https://gitlab.com/javallone/regexper-static" rel="external noopener noreferrer" target="_blank">
<a href="https://gitlab.com/javallone/regexper-static"
rel="external noopener noreferrer"
target="_blank">
<GitlabIcon />
Source on GitLab
</a>
+4 -1
View File
@@ -24,7 +24,10 @@ const renderIcon = (type, icon) => {
};
const Message = ({ type, icon, heading, children }) => (
<div className={ [style.message, type && style[type] ].filter(Boolean).join(' ') }>
<div className={ [
style.message,
type && style[type]
].filter(Boolean).join(' ') }>
<div className={ style.header }>
{ renderIcon(type, icon) }
<h2>{ heading }</h2>
+6 -2
View File
@@ -27,9 +27,13 @@ describe('SentryBoundary', () => {
const error = new Error('Example error');
component.find('Child').simulateError(error);
component.setState({ hasError: true }); // NOTE: Enzyme doesn't call getDerivedStateFromError yet
// NOTE: Enzyme doesn't call getDerivedStateFromError yet, so we have to
// set the state manually
component.setState({ hasError: true });
expect(Sentry.captureException).toHaveBeenCalledWith(error, expect.anything());
expect(Sentry.captureException).toHaveBeenCalledWith(
error,
expect.anything());
expect(component).toMatchSnapshot();
});
});
+2 -1
View File
@@ -14,7 +14,8 @@ class SentryError extends React.Component {
render() {
return <Message type="error" heading="An error has occurred">
<p>This error has been logged. You may also <a href="#error-report" onClick={ this.reportError }>fill out a report</a>.</p>
<p>This error has been logged. You may also <a href="#error-report"
onClick={ this.reportError }>fill out a report</a>.</p>
</Message>;
}
}
+2 -2
View File
@@ -15,7 +15,7 @@ describe('SentryError', () => {
});
describe('error reporting', () => {
test('clicking to fill out a report when an event has been logged', () => {
test('fill out a report when an event has been logged', () => {
Sentry.lastEventId.mockReturnValue(1);
const component = shallow(
<SentryError />
@@ -27,7 +27,7 @@ describe('SentryError', () => {
expect(Sentry.showReportDialog).toHaveBeenCalled();
});
test('clicking to fill out a report when an event has not been logged', () => {
test('fill out a report when an event has not been logged', () => {
Sentry.lastEventId.mockReturnValue(false);
const component = shallow(
<SentryError />