Fixes linting errors (#362)

This commit is contained in:
Andrew Nicolaou 2017-06-06 04:33:32 +02:00 committed by Cassie Tarakajian
parent 82207a50d3
commit 313fc856d1
12 changed files with 72 additions and 16 deletions

View file

@ -21,7 +21,10 @@ class Nav extends React.PureComponent {
</button> </button>
</li> </li>
{(() => { // eslint-disable-line {(() => { // eslint-disable-line
if (!this.props.project.owner || (this.props.project.owner && this.props.project.owner.id === this.props.user.id)) { if (
!this.props.project.owner ||
(this.props.project.owner && this.props.project.owner.id === this.props.user.id)
) {
return ( return (
<li className="nav__item"> <li className="nav__item">
<button <button
@ -119,7 +122,9 @@ class Nav extends React.PureComponent {
return ( return (
<li className="nav__item"> <li className="nav__item">
<p> <p>
<Link to="/login">Log in</Link> <span className="nav__item-spacer">or</span> <Link to="/signup">Sign up</Link> <Link to="/login">Log in</Link>
<span className="nav__item-spacer">or</span>
<Link to="/signup">Sign up</Link>
</p> </p>
</li> </li>
); );
@ -153,7 +158,11 @@ class Nav extends React.PureComponent {
</ul> </ul>
<div className="nav__announce"> <div className="nav__announce">
This is a preview version of the editor, that has not yet been officially released. This is a preview version of the editor, that has not yet been officially released.
It is in development, you can report bugs <a href="https://github.com/processing/p5.js-web-editor/issues" target="_blank" rel="noopener noreferrer">here</a>. It is in development, you can report bugs <a
href="https://github.com/processing/p5.js-web-editor/issues"
target="_blank"
rel="noopener noreferrer"
>here</a>.
Please use with caution. Please use with caution.
</div> </div>
</nav> </nav>

View file

@ -24,7 +24,11 @@ class Console extends React.Component {
<button className="preview-console__clear" onClick={this.props.clearConsole} aria-label="clear console"> <button className="preview-console__clear" onClick={this.props.clearConsole} aria-label="clear console">
Clear Clear
</button> </button>
<button className="preview-console__collapse" onClick={this.props.collapseConsole} aria-label="collapse console"> <button
className="preview-console__collapse"
onClick={this.props.collapseConsole}
aria-label="collapse console"
>
<InlineSVG src={downArrowUrl} /> <InlineSVG src={downArrowUrl} />
</button> </button>
<button className="preview-console__expand" onClick={this.props.expandConsole} aria-label="expand console"> <button className="preview-console__expand" onClick={this.props.expandConsole} aria-label="expand console">

View file

@ -45,7 +45,11 @@ export class FileNode extends React.Component {
if (oldFileExtension && !newFileExtension) { if (oldFileExtension && !newFileExtension) {
this.props.updateFileName(this.props.id, this.originalFileName); this.props.updateFileName(this.props.id, this.originalFileName);
} }
if (oldFileExtension && newFileExtension && oldFileExtension[0].toLowerCase() !== newFileExtension[0].toLowerCase()) { if (
oldFileExtension &&
newFileExtension &&
oldFileExtension[0].toLowerCase() !== newFileExtension[0].toLowerCase()
) {
this.props.updateFileName(this.props.id, this.originalFileName); this.props.updateFileName(this.props.id, this.originalFileName);
} }
} }

View file

@ -1,4 +1,4 @@
import React, { PropTypes } from 'react'; import React from 'react';
class GridOutput extends React.Component { class GridOutput extends React.Component {
componentDidMount() { componentDidMount() {

View file

@ -8,7 +8,9 @@ import { getBlobUrl } from '../actions/files';
import { resolvePathToFile } from '../../../../server/utils/filePath'; import { resolvePathToFile } from '../../../../server/utils/filePath';
const startTag = '@fs-'; const startTag = '@fs-';
// eslint-disable-next-line max-len
const MEDIA_FILE_REGEX = /^('|")(?!(http:\/\/|https:\/\/)).*\.(png|jpg|jpeg|gif|bmp|mp3|wav|aiff|ogg|json|txt|csv|svg|obj|mp4|ogg|webm|mov|otf|ttf|m4a)('|")$/i; const MEDIA_FILE_REGEX = /^('|")(?!(http:\/\/|https:\/\/)).*\.(png|jpg|jpeg|gif|bmp|mp3|wav|aiff|ogg|json|txt|csv|svg|obj|mp4|ogg|webm|mov|otf|ttf|m4a)('|")$/i;
// eslint-disable-next-line max-len
const MEDIA_FILE_REGEX_NO_QUOTES = /^(?!(http:\/\/|https:\/\/)).*\.(png|jpg|jpeg|gif|bmp|mp3|wav|aiff|ogg|json|txt|csv|svg|obj|mp4|ogg|webm|mov|otf|ttf|m4a)$/i; const MEDIA_FILE_REGEX_NO_QUOTES = /^(?!(http:\/\/|https:\/\/)).*\.(png|jpg|jpeg|gif|bmp|mp3|wav|aiff|ogg|json|txt|csv|svg|obj|mp4|ogg|webm|mov|otf|ttf|m4a)$/i;
const STRING_REGEX = /(['"])((\\\1|.)*?)\1/gm; const STRING_REGEX = /(['"])((\\\1|.)*?)\1/gm;
const TEXT_FILE_REGEX = /(.+\.json$|.+\.txt$|.+\.csv$)/i; const TEXT_FILE_REGEX = /(.+\.json$|.+\.txt$|.+\.csv$)/i;
@ -175,7 +177,9 @@ class PreviewFrame extends React.Component {
'/loop-protect.min.js', '/loop-protect.min.js',
'/hijackConsole.js' '/hijackConsole.js'
]; ];
if (this.props.isAccessibleOutputPlaying || ((this.props.textOutput || this.props.gridOutput || this.props.soundOutput) && this.props.isPlaying)) { if (
this.props.isAccessibleOutputPlaying ||
((this.props.textOutput || this.props.gridOutput || this.props.soundOutput) && this.props.isPlaying)) {
let interceptorScripts = []; let interceptorScripts = [];
interceptorScripts = [ interceptorScripts = [
'/p5-interceptor/registry.js', '/p5-interceptor/registry.js',

View file

@ -141,7 +141,10 @@ class Toolbar extends React.Component {
}} }}
> >
{this.props.project.name}&nbsp; {this.props.project.name}&nbsp;
{this.canEditProjectName() && <InlineSVG className="toolbar__edit-name-button" src={editProjectNameUrl} alt="Edit Project Name" />} {
this.canEditProjectName() &&
<InlineSVG className="toolbar__edit-name-button" src={editProjectNameUrl} alt="Edit Project Name" />
}
</a> </a>
<input <input
type="text" type="text"

View file

@ -97,7 +97,9 @@ class IDEView extends React.Component {
componentDidUpdate(prevProps) { componentDidUpdate(prevProps) {
if (this.isUserOwner() && this.props.project.id) { if (this.isUserOwner() && this.props.project.id) {
if (this.props.preferences.autosave && this.props.ide.unsavedChanges && !this.props.ide.justOpenedProject) { if (this.props.preferences.autosave && this.props.ide.unsavedChanges && !this.props.ide.justOpenedProject) {
if (this.props.selectedFile.name === prevProps.selectedFile.name && this.props.selectedFile.content !== prevProps.selectedFile.content) { if (
this.props.selectedFile.name === prevProps.selectedFile.name &&
this.props.selectedFile.content !== prevProps.selectedFile.content) {
if (this.autosaveInterval) { if (this.autosaveInterval) {
clearTimeout(this.autosaveInterval); clearTimeout(this.autosaveInterval);
} }
@ -350,7 +352,13 @@ class IDEView extends React.Component {
</div> </div>
<div> <div>
{(() => { {(() => {
if (((this.props.preferences.textOutput || this.props.preferences.gridOutput || this.props.preferences.soundOutput) && this.props.ide.isPlaying) || this.props.ide.isAccessibleOutputPlaying) { if (
(
(this.props.preferences.textOutput ||
this.props.preferences.gridOutput ||
this.props.preferences.soundOutput
) && this.props.ide.isPlaying
) || this.props.ide.isAccessibleOutputPlaying) {
return ( return (
<AccessibleOutput <AccessibleOutput
isPlaying={this.props.ide.isPlaying} isPlaying={this.props.ide.isPlaying}

View file

@ -43,7 +43,11 @@ function AccountForm(props) {
id="currentPassword" id="currentPassword"
{...domOnlyProps(currentPassword)} {...domOnlyProps(currentPassword)}
/> />
{currentPassword.touched && currentPassword.error && <span className="form-error">{currentPassword.error}</span>} {
currentPassword.touched &&
currentPassword.error &&
<span className="form-error">{currentPassword.error}</span>
}
</p> </p>
<p className="form__field"> <p className="form__field">
<label htmlFor="new password" className="form__label">New Password</label> <label htmlFor="new password" className="form__label">New Password</label>
@ -56,7 +60,12 @@ function AccountForm(props) {
/> />
{newPassword.touched && newPassword.error && <span className="form-error">{newPassword.error}</span>} {newPassword.touched && newPassword.error && <span className="form-error">{newPassword.error}</span>}
</p> </p>
<input type="submit" disabled={submitting || invalid || pristine} value="Save All Settings" aria-label="updateSettings" /> <input
type="submit"
disabled={submitting || invalid || pristine}
value="Save All Settings"
aria-label="updateSettings"
/>
</form> </form>
); );
} }

View file

@ -25,7 +25,11 @@ function NewPasswordForm(props) {
id="confirm password" id="confirm password"
{...domOnlyProps(confirmPassword)} {...domOnlyProps(confirmPassword)}
/> />
{confirmPassword.touched && confirmPassword.error && <span className="form-error">{confirmPassword.error}</span>} {
confirmPassword.touched &&
confirmPassword.error &&
<span className="form-error">{confirmPassword.error}</span>
}
</p> </p>
<input type="submit" disabled={submitting || invalid || pristine} value="Set New Password" aria-label="sign up" /> <input type="submit" disabled={submitting || invalid || pristine} value="Set New Password" aria-label="sign up" />
</form> </form>

View file

@ -15,7 +15,12 @@ function ResetPasswordForm(props) {
{...domOnlyProps(email)} {...domOnlyProps(email)}
/> />
</p> </p>
<input type="submit" disabled={submitting || invalid || pristine || props.user.resetPasswordInitiate} value="Send Password Reset Email" aria-label="Send email to reset password" /> <input
type="submit"
disabled={submitting || invalid || pristine || props.user.resetPasswordInitiate}
value="Send Password Reset Email"
aria-label="Send email to reset password"
/>
</form> </form>
); );
} }

View file

@ -47,7 +47,11 @@ function SignupForm(props) {
id="confirm password" id="confirm password"
{...domOnlyProps(confirmPassword)} {...domOnlyProps(confirmPassword)}
/> />
{confirmPassword.touched && confirmPassword.error && <span className="form-error">{confirmPassword.error}</span>} {
confirmPassword.touched &&
confirmPassword.error &&
<span className="form-error">{confirmPassword.error}</span>
}
</p> </p>
<input type="submit" disabled={submitting || invalid || pristine} value="Sign Up" aria-label="sign up" /> <input type="submit" disabled={submitting || invalid || pristine} value="Sign Up" aria-label="sign up" />
</form> </form>

View file

@ -26,7 +26,9 @@ function validateNameEmail(formProps, errors) {
if (!formProps.email) { if (!formProps.email) {
errors.email = 'Please enter an email.'; errors.email = 'Please enter an email.';
} else if (!formProps.email.match(/^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/i)) { } else if (
// eslint-disable-next-line max-len
!formProps.email.match(/^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/i)) {
errors.email = 'Please enter a valid email address.'; errors.email = 'Please enter a valid email address.';
} }
} }