diff --git a/bin/update_version.js b/bin/update_version.js index add57c6..c60341f 100755 --- a/bin/update_version.js +++ b/bin/update_version.js @@ -23,7 +23,7 @@ console.log( name, version, commit, - date + date, }, undefined, 2 diff --git a/package.json b/package.json index 5c9747e..dc58d1a 100644 --- a/package.json +++ b/package.json @@ -15,7 +15,7 @@ "reactstrap": "8.4.1" }, "devDependencies": { - "prettier": "1.19.1", + "prettier": "2.0.2", "source-map-explorer": "2.4.1" }, "resolutions": { diff --git a/src/AutoProgressBar.js b/src/AutoProgressBar.js index 5e4df7f..aca74d1 100644 --- a/src/AutoProgressBar.js +++ b/src/AutoProgressBar.js @@ -8,19 +8,19 @@ export default class AutoProgressBar extends React.Component { total: PropTypes.number, targetTime: PropTypes.number, auto: PropTypes.bool, - autoTickRate: PropTypes.number + autoTickRate: PropTypes.number, }; static defaultProps = { targetTime: 5000, auto: true, - autoTickRate: 100 + autoTickRate: 100, }; constructor(props) { super(props); this.state = { - autoCounter: 0 + autoCounter: 0, }; this.interval = null; } @@ -36,7 +36,7 @@ export default class AutoProgressBar extends React.Component { tick() { const { autoTickRate, targetTime } = this.props; - this.setState(state => { + this.setState((state) => { const next = state.autoCounter + autoTickRate; if (next > targetTime) { clearInterval(this.interval); diff --git a/src/Common.js b/src/Common.js index 8a19f0c..9a8a13f 100644 --- a/src/Common.js +++ b/src/Common.js @@ -5,11 +5,11 @@ export class EllipsisLoading extends React.PureComponent { static defaultProps = { text: 'Loading', animationMs: 400, - maxDots: 5 + maxDots: 5, }; componentDidMount() { this.interval = window.setInterval(() => { - this.setState(state => { + this.setState((state) => { return { dots: (state.dots + 1) % this.props.maxDots }; }); }, this.props.animationMs); diff --git a/src/DeployPage.js b/src/DeployPage.js index 43b0d92..ef07369 100644 --- a/src/DeployPage.js +++ b/src/DeployPage.js @@ -21,7 +21,7 @@ function makeTagAbsoluteUrl(owner, repo, tag) { class DeployPage extends React.Component { static propsTypes = { - shortCode: PropTypes.string.isRequired + shortCode: PropTypes.string.isRequired, }; state = { @@ -32,7 +32,7 @@ class DeployPage extends React.Component { deployInfo: null, error: null, loading: null, - tags: null + tags: null, }; isLoading() { @@ -53,13 +53,13 @@ class DeployPage extends React.Component { } finishLoad(name) { - this.setState(state => state.loading.delete(name)); + this.setState((state) => state.loading.delete(name)); } async decodeShortCode() { const { history, - match: { params } + match: { params }, } = this.props; this.startLoad('parameters'); try { @@ -90,7 +90,7 @@ class DeployPage extends React.Component { } else { this.setState({ deployInfo: res.deployments, - tags: res.tags + tags: res.tags, }); } } catch (error) { @@ -137,8 +137,8 @@ class DeployPage extends React.Component { render() { const { match: { - params: { code } - } + params: { code }, + }, } = this.props; const { error, @@ -147,7 +147,7 @@ class DeployPage extends React.Component { commits, tags, owner, - repo + repo, } = this.state; document.title = `What's Deployed on ${owner}/${repo}?`; @@ -219,19 +219,19 @@ class DeployTable extends React.Component { tags: PropTypes.object.isRequired, code: PropTypes.string.isRequired, owner: PropTypes.string.isRequired, - repo: PropTypes.string.isRequired + repo: PropTypes.string.isRequired, }; static prefBorsModeCacheKey = 'pref-bors-mode'; state = { - borsMode: false + borsMode: false, }; componentDidMount() { this._restoreBorsModeChoice(); } - handleBorsCheckbox = ev => { + handleBorsCheckbox = (ev) => { this.setState({ borsMode: ev.target.checked }, this._persistBorsModeChoice); }; @@ -282,7 +282,7 @@ class DeployTable extends React.Component { for (const deploy of deployInfo) { if (commit.sha === deploy.sha) { foundDeploy[deploy.name] = true; - if (Array.from(Object.values(foundDeploy)).every(f => f)) { + if (Array.from(Object.values(foundDeploy)).every((f) => f)) { foundMatch = true; } } @@ -308,7 +308,7 @@ class DeployTable extends React.Component { owner={owner} repo={repo} /> - {deployInfo.map(deploy => ( + {deployInfo.map((deploy) => ( )} - {deployInfo.map(deployment => ( + {deployInfo.map((deployment) => ( {deployment.name} ))} @@ -382,12 +382,12 @@ class CommitDetails extends React.Component { author: PropTypes.shape({ login: PropTypes.string.isRequired, avatar_url: PropTypes.string.isRequired, - html_url: PropTypes.string.isRequired + html_url: PropTypes.string.isRequired, }), html_url: PropTypes.string.isRequired, owner: PropTypes.string.isRequired, repo: PropTypes.string.isRequired, - tag: PropTypes.any + tag: PropTypes.any, }; parseBorsMessage(commit) { @@ -409,12 +409,12 @@ class CommitDetails extends React.Component { const { users } = this.props; let headers = commit.message .split(/\n\n/g) - .filter(paragraph => /^\d+: /.test(paragraph)); + .filter((paragraph) => /^\d+: /.test(paragraph)); return { description: headers.join('; '), authors: headers - .map(header => { + .map((header) => { const match = header.match(/a=([^ ]*)+/); if (match) { let [, author] = match; @@ -427,7 +427,7 @@ class CommitDetails extends React.Component { } return null; }) - .filter(login => login) + .filter((login) => login), }; } @@ -444,7 +444,10 @@ class CommitDetails extends React.Component { const { description, authors } = this.parseBorsMessage(commit); title = description; for (const author of authors) { - if (author && !involvedUsers.map(u => u.login).includes(author.login)) { + if ( + author && + !involvedUsers.map((u) => u.login).includes(author.login) + ) { involvedUsers.unshift(author); } } @@ -480,7 +483,7 @@ class CommitDetails extends React.Component { function UserAvatars({ users }) { return (
- {users.map(user => { + {users.map((user) => { if (!user) { return ( @@ -510,7 +513,7 @@ class RepoSummary extends React.Component { ).isRequired, owner: PropTypes.string.isRequired, repo: PropTypes.string.isRequired, - tags: PropTypes.object.isRequired + tags: PropTypes.object.isRequired, }; render() { @@ -529,13 +532,13 @@ class RepoSummary extends React.Component { Revision URLs SHA - {deployInfo.map(deployment => ( + {deployInfo.map((deployment) => ( {deployment.name} ))} - {deployInfo.map(deployment => ( + {deployInfo.map((deployment) => ( - {deployInfo.map(otherDeployment => { + {deployInfo.map((otherDeployment) => { if (otherDeployment.name === deployment.name) { return -; } else { @@ -606,7 +609,7 @@ class Culprits extends React.PureComponent { state = { loading: true, culprits: null, - error: null + error: null, }; componentDidMount() { @@ -628,7 +631,7 @@ class Culprits extends React.PureComponent { const res = await ky .post('/culprits', { signal, - json: { owner, repo, deployments: deployInfo } + json: { owner, repo, deployments: deployInfo }, }) .json(); if (this.dismounted) return; @@ -655,7 +658,7 @@ class Culprits extends React.PureComponent { {loading && } {culprits && (
- {culprits.map(group => ( + {culprits.map((group) => (

On {group.name} @@ -691,7 +694,7 @@ class Culprits extends React.PureComponent { class BadgesAndUrls extends React.Component { state = { showHelp: false, - textCopied: '' + textCopied: '', }; componentWillUnmount() { @@ -699,10 +702,10 @@ class BadgesAndUrls extends React.Component { } toggleHelp = () => { - this.setState(state => ({ showHelp: !state.showHelp })); + this.setState((state) => ({ showHelp: !state.showHelp })); }; - copiedText = textCopied => { + copiedText = (textCopied) => { this.setState({ textCopied }, () => { window.setTimeout(() => { if (!this.dismounted) { @@ -712,7 +715,7 @@ class BadgesAndUrls extends React.Component { }); }; - showCopyToClipboard = text => { + showCopyToClipboard = (text) => { return ( this.copiedText(text)}> @@ -735,7 +738,9 @@ class BadgesAndUrls extends React.Component { const { protocol, host } = window.location; const fullUrl = `${protocol}//${host}${shortUrl}/${owner}/${repo}`; - const envs = deployInfo.map(deploy => deploy.name.toLowerCase()).join(','); + const envs = deployInfo + .map((deploy) => deploy.name.toLowerCase()) + .join(','); const badgeUrl = `https://img.shields.io/badge/whatsdeployed-${envs}-green.svg`; const badgeAlt = `What's deployed on ${envs}?`; const markdown = `[![${badgeAlt}](${badgeUrl})](${fullUrl})`; diff --git a/src/LongUrlRedirect.js b/src/LongUrlRedirect.js index 636982f..9d6a0bd 100644 --- a/src/LongUrlRedirect.js +++ b/src/LongUrlRedirect.js @@ -7,7 +7,7 @@ import { withRouter } from './Routes'; class LongUrlRedirect extends React.Component { state = { - error: null + error: null, }; static propsTypes = { @@ -16,9 +16,9 @@ class LongUrlRedirect extends React.Component { deployments: PropTypes.arrayOf( PropTypes.shape({ url: PropTypes.string.isRequired, - name: PropTypes.string.isRequired + name: PropTypes.string.isRequired, }) - ) + ), }; async shorten(props = this.props) { @@ -40,7 +40,7 @@ class LongUrlRedirect extends React.Component { pathname: `/s/${code}`, search: '', hash: '', - state: null + state: null, }); } catch (error) { this.setState({ error }); diff --git a/src/Routes.js b/src/Routes.js index aad2f35..6000feb 100644 --- a/src/Routes.js +++ b/src/Routes.js @@ -3,7 +3,7 @@ import { Switch, Redirect, Route, - withRouter as originalWithRouter + withRouter as originalWithRouter, } from 'react-router-dom'; import SetupPage from './SetupPage'; @@ -28,7 +28,7 @@ const Routes = withRouter(({ location }) => { export default Routes; export function withRouter(Component) { - return originalWithRouter(props => { + return originalWithRouter((props) => { props.location.searchParams = new URLSearchParams(props.location.search); return ; }); diff --git a/src/SetupPage.js b/src/SetupPage.js index 55e7e56..0cfe1e3 100644 --- a/src/SetupPage.js +++ b/src/SetupPage.js @@ -31,9 +31,9 @@ class SetupForm extends React.Component { rows: [ { name: '', - url: '' - } - ] + url: '', + }, + ], }; onChange(ev) { @@ -44,7 +44,7 @@ class SetupForm extends React.Component { onRowChange(rowIdx, ev) { const name = ev.target.name; const value = ev.target.value; - this.setState(state => { + this.setState((state) => { // replace an existing row without modifying any existing objects let newRows = [...state.rows]; newRows[rowIdx][name] = value; @@ -54,7 +54,7 @@ class SetupForm extends React.Component { addRow() { this.setState(({ rows }) => ({ - rows: rows.concat([{ name: '', url: '' }]) + rows: rows.concat([{ name: '', url: '' }]), })); } @@ -64,14 +64,14 @@ class SetupForm extends React.Component { let newUrl = shortUrls.buildLongUrl({ owner, repo: repository, - deployments: rows + deployments: rows, }); ev.preventDefault(); history.push({ pathname: newUrl.pathname, search: newUrl.search, hash: '', - state: null + state: null, }); } @@ -148,7 +148,7 @@ const SetupFormWithRouter = withRouter(SetupForm); class PreviousEnvironments extends React.Component { state = { environments: [], - loading: false + loading: false, }; componentWillUnmount() { @@ -172,13 +172,13 @@ class PreviousEnvironments extends React.Component { ) : (
    - {environments.map(env => ( + {environments.map((env) => (
  • {env.owner}/{env.repo} - {env.revisions.map(r => r[0]).join(', ')} + {env.revisions.map((r) => r[0]).join(', ')}
  • ))} diff --git a/src/serviceWorker.js b/src/serviceWorker.js index 8859a0c..8655967 100644 --- a/src/serviceWorker.js +++ b/src/serviceWorker.js @@ -55,7 +55,7 @@ export function register(config) { function registerValidSW(swUrl, config) { navigator.serviceWorker .register(swUrl) - .then(registration => { + .then((registration) => { registration.onupdatefound = () => { const installingWorker = registration.installing; installingWorker.onstatechange = () => { @@ -86,7 +86,7 @@ function registerValidSW(swUrl, config) { }; }; }) - .catch(error => { + .catch((error) => { console.error('Error during service worker registration:', error); }); } @@ -94,14 +94,14 @@ function registerValidSW(swUrl, config) { function checkValidServiceWorker(swUrl, config) { // Check if the service worker can be found. If it can't reload the page. fetch(swUrl) - .then(response => { + .then((response) => { // Ensure service worker exists, and that we really are getting a JS file. if ( response.status === 404 || response.headers.get('content-type').indexOf('javascript') === -1 ) { // No service worker found. Probably a different app. Reload the page. - navigator.serviceWorker.ready.then(registration => { + navigator.serviceWorker.ready.then((registration) => { registration.unregister().then(() => { window.location.reload(); }); @@ -120,7 +120,7 @@ function checkValidServiceWorker(swUrl, config) { export function unregister() { if ('serviceWorker' in navigator) { - navigator.serviceWorker.ready.then(registration => { + navigator.serviceWorker.ready.then((registration) => { registration.unregister(); }); } diff --git a/src/shortUrls.js b/src/shortUrls.js index 2a1a9b5..fb660fe 100644 --- a/src/shortUrls.js +++ b/src/shortUrls.js @@ -87,6 +87,6 @@ const shortUrls = { newUrl.searchParams.append('url[]', url); } return newUrl; - } + }, }; export default shortUrls; diff --git a/yarn.lock b/yarn.lock index ef73ba4..08b6bff 100644 --- a/yarn.lock +++ b/yarn.lock @@ -9169,10 +9169,10 @@ prepend-http@^1.0.0: resolved "https://registry.yarnpkg.com/prepend-http/-/prepend-http-1.0.4.tgz#d4f4562b0ce3696e41ac52d0e002e57a635dc6dc" integrity sha1-1PRWKwzjaW5BrFLQ4ALlemNdxtw= -prettier@1.19.1: - version "1.19.1" - resolved "https://registry.yarnpkg.com/prettier/-/prettier-1.19.1.tgz#f7d7f5ff8a9cd872a7be4ca142095956a60797cb" - integrity sha512-s7PoyDv/II1ObgQunCbB9PdLmUcBZcnWOcxDh7O0N/UwDEsHyqkW+Qh28jW+mVuCdx7gLB0BotYI1Y6uI9iyew== +prettier@2.0.2: + version "2.0.2" + resolved "https://registry.yarnpkg.com/prettier/-/prettier-2.0.2.tgz#1ba8f3eb92231e769b7fcd7cb73ae1b6b74ade08" + integrity sha512-5xJQIPT8BraI7ZnaDwSbu5zLrB6vvi8hVV58yHQ+QK64qrY40dULy0HSRlQ2/2IdzeBpjhDkqdcFBnFeDEMVdg== pretty-bytes@^5.1.0: version "5.2.0"