Commit 837b8d77 authored by Jeff Avallone's avatar Jeff Avallone

Updating eslint rules and addressing issues

parent 8a3471b9
Pipeline #42252339 passed with stage
in 1 minute and 22 seconds
...@@ -23,6 +23,27 @@ ...@@ -23,6 +23,27 @@
"jest" "jest"
], ],
"rules": { "rules": {
"arrow-parens": [
"error",
"as-needed"
],
"arrow-spacing": [
"error",
{
"before": true,
"after": true
}
],
"comma-dangle": [
"error",
{
"objects": "never",
"arrays": "never",
"imports": "never",
"exports": "never",
"functions": "never"
}
],
"indent": [ "indent": [
"error", "error",
2 2
...@@ -31,6 +52,13 @@ ...@@ -31,6 +52,13 @@
"error", "error",
"unix" "unix"
], ],
"max-len": [
"warn",
{
"code": 80
}
],
"no-var": "error",
"quotes": [ "quotes": [
"error", "error",
"single" "single"
...@@ -38,6 +66,18 @@ ...@@ -38,6 +66,18 @@
"semi": [ "semi": [
"error", "error",
"always" "always"
],
"space-before-function-paren": [
"error",
{
"named": "never",
"anonymous": "never",
"asyncArrow": "always"
}
],
"template-curly-spacing": [
"error",
"always"
] ]
}, },
"settings": { "settings": {
......
...@@ -2,7 +2,9 @@ const buildId = [ ...@@ -2,7 +2,9 @@ const buildId = [
process.env.CI_COMMIT_REF_SLUG || 'prerelese', process.env.CI_COMMIT_REF_SLUG || 'prerelese',
(process.env.CI_COMMIT_SHA || 'gitsha').slice(0, 7) (process.env.CI_COMMIT_SHA || 'gitsha').slice(0, 7)
].join('-'); ].join('-');
const banner = (process.env.NODE_ENV === 'production') ? false : (process.env.NODE_ENV || 'development'); const banner = (process.env.NODE_ENV === 'production')
? false
: (process.env.NODE_ENV || 'development');
module.exports = { module.exports = {
siteMetadata: { siteMetadata: {
......
...@@ -21,8 +21,12 @@ export const FooterImpl = ({ site: { siteMetadata } }) => ( ...@@ -21,8 +21,12 @@ export const FooterImpl = ({ site: { siteMetadata } }) => (
Created by <a href="mailto:jeff.avallone@gmail.com">Jeff Avallone</a> Created by <a href="mailto:jeff.avallone@gmail.com">Jeff Avallone</a>
</li> </li>
<li> <li>
Generated images licensed: <a href="http://creativecommons.org/licenses/by/3.0/" rel="license external noopener noreferrer" target="_blank"> Generated images licensed: <a
<img src="https://licensebuttons.net/l/by/3.0/80x15.png" alt="Creative Commons CC-BY-3.0 License" /> 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> </a>
</li> </li>
</ul> </ul>
......
...@@ -17,14 +17,18 @@ const query = graphql` ...@@ -17,14 +17,18 @@ const query = graphql`
`; `;
export const HeaderImpl = ({ site: { siteMetadata } }) => ( export const HeaderImpl = ({ site: { siteMetadata } }) => (
<header className={ style.header } data-banner={ siteMetadata.banner || null }> <header
className={ style.header }
data-banner={ siteMetadata.banner || null }>
<h1> <h1>
<Link to="/">Regexper</Link> <Link to="/">Regexper</Link>
</h1> </h1>
<ul className={ style.list }> <ul className={ style.list }>
<li> <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 /> <GitlabIcon />
Source on GitLab Source on GitLab
</a> </a>
......
...@@ -24,7 +24,10 @@ const renderIcon = (type, icon) => { ...@@ -24,7 +24,10 @@ const renderIcon = (type, icon) => {
}; };
const Message = ({ type, icon, heading, children }) => ( 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 }> <div className={ style.header }>
{ renderIcon(type, icon) } { renderIcon(type, icon) }
<h2>{ heading }</h2> <h2>{ heading }</h2>
......
...@@ -27,9 +27,13 @@ describe('SentryBoundary', () => { ...@@ -27,9 +27,13 @@ describe('SentryBoundary', () => {
const error = new Error('Example error'); const error = new Error('Example error');
component.find('Child').simulateError(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(); expect(component).toMatchSnapshot();
}); });
}); });
...@@ -14,7 +14,8 @@ class SentryError extends React.Component { ...@@ -14,7 +14,8 @@ class SentryError extends React.Component {
render() { render() {
return <Message type="error" heading="An error has occurred"> 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>; </Message>;
} }
} }
......
...@@ -15,7 +15,7 @@ describe('SentryError', () => { ...@@ -15,7 +15,7 @@ describe('SentryError', () => {
}); });
describe('error reporting', () => { 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); Sentry.lastEventId.mockReturnValue(1);
const component = shallow( const component = shallow(
<SentryError /> <SentryError />
...@@ -27,7 +27,7 @@ describe('SentryError', () => { ...@@ -27,7 +27,7 @@ describe('SentryError', () => {
expect(Sentry.showReportDialog).toHaveBeenCalled(); 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); Sentry.lastEventId.mockReturnValue(false);
const component = shallow( const component = shallow(
<SentryError /> <SentryError />
......
...@@ -8,7 +8,8 @@ const IndexPage = () => <Layout> ...@@ -8,7 +8,8 @@ const IndexPage = () => <Layout>
<noscript> <noscript>
<Message type="error" heading="JavaScript Required"> <Message type="error" heading="JavaScript Required">
<p>You need JavaScript to use Regexper.</p> <p>You need JavaScript to use Regexper.</p>
<p>If you have concerns regarding the use of tracking code on Regexper, please see the <Link to="/privacy">Privacy Policy</Link>.</p> <p>If you have concerns regarding the use of tracking code on Regexper,
please see the <Link to="/privacy">Privacy Policy</Link>.</p>
</Message> </Message>
</noscript> </noscript>
<div>Hello world</div> <div>Hello world</div>
......
...@@ -5,14 +5,41 @@ import Message from 'components/Message'; ...@@ -5,14 +5,41 @@ import Message from 'components/Message';
const PrivacyPage = () => <Layout title="Privacy Policy"> const PrivacyPage = () => <Layout title="Privacy Policy">
<Message type="info" heading="Privacy Policy"> <Message type="info" heading="Privacy Policy">
<p>Regexper and the tools used to create it are all open source. If you are concerned that the JavaScript being delivered is in any way malicious, please inspect the source in the <a href="https://gitlab.com/javallone/regexper-static" rel="external noopener noreferrer" target="_blank">GitLab repository</a>.</p> <p>
<p>There are two data collection tools integrated in the app. These tools are not used to collect personal information:</p> Regexper and the tools used to create it are all open source. If you are
concerned that the JavaScript being delivered is in any way malicious,
please inspect the source in the <a
href="https://gitlab.com/javallone/regexper-static"
rel="external noopener noreferrer"
target="_blank">GitLab repository</a>.
</p>
<p>
There are two data collection tools integrated in the app. These tools
are not used to collect personal information:
</p>
<ul> <ul>
<li><b>Google Analytics</b> is used to track browser usage data and application performance. It is configured to anonymize the client IP address.</li> <li>
<li><b>Sentry.io</b> is a tool used to capture and report client-side JavaScript errors. It is configured to not store the client IP address.</li> <b>Google Analytics</b> is used to track browser usage data and
application performance. It is configured to anonymize the client IP
address.
</li>
<li>
<b>Sentry.io</b> is a tool used to capture and report client-side
JavaScript errors. It is configured to not store the client IP address.
</li>
</ul> </ul>
<p>Regexper honors the browser <b>&ldquo;Do Not Track&rdquo;</b> setting and will not enable these data collection tools if that setting is enabled. Also, most popular ad blockers will prevent these tools from sending any tracking data. Disabling or blocking these data collection tools will <b>not</b> impact the performance of this app. The information collected by these tools is used to monitor application performance, determine browser support, and collect error reports.</p> <p>
<p>Regexper is not supported by ad revenue or sales of any kind.</p> Regexper honors the browser <b>&ldquo;Do Not Track&rdquo;</b> setting and
will not enable these data collection tools if that setting is enabled.
Also, most popular ad blockers will prevent these tools from sending any
tracking data. Disabling or blocking these data collection tools
will <b>not</b> impact the performance of this app. The information
collected by these tools is used to monitor application performance,
determine browser support, and collect error reports.
</p>
<p>
Regexper is not supported by ad revenue or sales of any kind.
</p>
</Message> </Message>
</Layout>; </Layout>;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment