Fixes linting errors (#362)
This commit is contained in:
parent
82207a50d3
commit
313fc856d1
12 changed files with 72 additions and 16 deletions
|
@ -21,7 +21,10 @@ class Nav extends React.PureComponent {
|
|||
</button>
|
||||
</li>
|
||||
{(() => { // 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 (
|
||||
<li className="nav__item">
|
||||
<button
|
||||
|
@ -119,7 +122,9 @@ class Nav extends React.PureComponent {
|
|||
return (
|
||||
<li className="nav__item">
|
||||
<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>
|
||||
</li>
|
||||
);
|
||||
|
@ -153,7 +158,11 @@ class Nav extends React.PureComponent {
|
|||
</ul>
|
||||
<div className="nav__announce">
|
||||
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.
|
||||
</div>
|
||||
</nav>
|
||||
|
|
|
@ -24,7 +24,11 @@ class Console extends React.Component {
|
|||
<button className="preview-console__clear" onClick={this.props.clearConsole} aria-label="clear console">
|
||||
Clear
|
||||
</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} />
|
||||
</button>
|
||||
<button className="preview-console__expand" onClick={this.props.expandConsole} aria-label="expand console">
|
||||
|
|
|
@ -45,7 +45,11 @@ export class FileNode extends React.Component {
|
|||
if (oldFileExtension && !newFileExtension) {
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import React, { PropTypes } from 'react';
|
||||
import React from 'react';
|
||||
|
||||
class GridOutput extends React.Component {
|
||||
componentDidMount() {
|
||||
|
|
|
@ -8,7 +8,9 @@ import { getBlobUrl } from '../actions/files';
|
|||
import { resolvePathToFile } from '../../../../server/utils/filePath';
|
||||
|
||||
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;
|
||||
// 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 STRING_REGEX = /(['"])((\\\1|.)*?)\1/gm;
|
||||
const TEXT_FILE_REGEX = /(.+\.json$|.+\.txt$|.+\.csv$)/i;
|
||||
|
@ -175,7 +177,9 @@ class PreviewFrame extends React.Component {
|
|||
'/loop-protect.min.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 = [];
|
||||
interceptorScripts = [
|
||||
'/p5-interceptor/registry.js',
|
||||
|
|
|
@ -141,7 +141,10 @@ class Toolbar extends React.Component {
|
|||
}}
|
||||
>
|
||||
{this.props.project.name}
|
||||
{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>
|
||||
<input
|
||||
type="text"
|
||||
|
|
|
@ -97,7 +97,9 @@ class IDEView extends React.Component {
|
|||
componentDidUpdate(prevProps) {
|
||||
if (this.isUserOwner() && this.props.project.id) {
|
||||
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) {
|
||||
clearTimeout(this.autosaveInterval);
|
||||
}
|
||||
|
@ -350,7 +352,13 @@ class IDEView extends React.Component {
|
|||
</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 (
|
||||
<AccessibleOutput
|
||||
isPlaying={this.props.ide.isPlaying}
|
||||
|
|
|
@ -43,7 +43,11 @@ function AccountForm(props) {
|
|||
id="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 className="form__field">
|
||||
<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>}
|
||||
</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>
|
||||
);
|
||||
}
|
||||
|
|
|
@ -25,7 +25,11 @@ function NewPasswordForm(props) {
|
|||
id="confirm password"
|
||||
{...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>
|
||||
<input type="submit" disabled={submitting || invalid || pristine} value="Set New Password" aria-label="sign up" />
|
||||
</form>
|
||||
|
|
|
@ -15,7 +15,12 @@ function ResetPasswordForm(props) {
|
|||
{...domOnlyProps(email)}
|
||||
/>
|
||||
</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>
|
||||
);
|
||||
}
|
||||
|
|
|
@ -47,7 +47,11 @@ function SignupForm(props) {
|
|||
id="confirm password"
|
||||
{...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>
|
||||
<input type="submit" disabled={submitting || invalid || pristine} value="Sign Up" aria-label="sign up" />
|
||||
</form>
|
||||
|
|
|
@ -26,7 +26,9 @@ function validateNameEmail(formProps, errors) {
|
|||
|
||||
if (!formProps.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.';
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue