aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2018-07-06 02:11:40 +0300
committerGravatar Vitaly Takmazov2023-01-13 10:37:53 +0300
commitea1b9039ae221355cfaabb16fc43dab5917bea56 (patch)
tree9e9c40a33cfcbd69062dae77a68964929f952368
parent91faf0911184bb430170d021195d008b977e0ac4 (diff)
Fix eslint warnings
-rw-r--r--vnext/src/components/Avatar.js2
-rw-r--r--vnext/src/components/Button.js4
-rw-r--r--vnext/src/components/Chat.js6
-rw-r--r--vnext/src/components/Feeds.js14
-rw-r--r--vnext/src/components/Footer.js9
-rw-r--r--vnext/src/components/LoginButton.js14
-rw-r--r--vnext/src/components/Message.js4
-rw-r--r--vnext/src/components/MessageInput.js20
-rw-r--r--vnext/src/components/Modal.js4
-rw-r--r--vnext/src/components/PM.js2
-rw-r--r--vnext/src/components/SearchBox.js14
-rw-r--r--vnext/src/components/Spinner.js4
-rw-r--r--vnext/src/components/Thread.js10
-rw-r--r--vnext/src/components/__tests__/Avatar.test.js2
-rw-r--r--vnext/src/components/__tests__/Footer.test.js2
-rw-r--r--vnext/src/components/__tests__/LoginButton.test.js2
-rw-r--r--vnext/src/components/__tests__/MessageInput-test.js2
17 files changed, 61 insertions, 54 deletions
diff --git a/vnext/src/components/Avatar.js b/vnext/src/components/Avatar.js
index 73b885ad..0df0dbd7 100644
--- a/vnext/src/components/Avatar.js
+++ b/vnext/src/components/Avatar.js
@@ -17,4 +17,4 @@ export default function Avatar(props) {
Avatar.propTypes = {
user: UserType,
link: PropTypes.string
-}
+};
diff --git a/vnext/src/components/Button.js b/vnext/src/components/Button.js
index 656c0426..11887d41 100644
--- a/vnext/src/components/Button.js
+++ b/vnext/src/components/Button.js
@@ -3,7 +3,7 @@ import React from 'react';
export default function Button(props) {
return (
<button style={buttonStyle} {...props} />
- )
+ );
}
const buttonStyle = {
@@ -15,4 +15,4 @@ const buttonStyle = {
display: 'inline-block',
margin: '5px',
padding: '2px 10px'
-} \ No newline at end of file
+};
diff --git a/vnext/src/components/Chat.js b/vnext/src/components/Chat.js
index dd94dd9e..2e91888f 100644
--- a/vnext/src/components/Chat.js
+++ b/vnext/src/components/Chat.js
@@ -47,7 +47,7 @@ export default class Chat extends React.Component {
pm(template.to.uname, template.body)
.then(res => {
this.loadChat(this.props.match.params.user);
- }).catch(console.log)
+ }).catch(console.log);
}
render() {
@@ -76,7 +76,7 @@ export default class Chat extends React.Component {
}
</article>
</div>
- )
+ );
}
}
@@ -93,4 +93,4 @@ const chatStyle = {
display: 'flex',
flexDirection: 'column-reverse',
width: '100%'
-}
+};
diff --git a/vnext/src/components/Feeds.js b/vnext/src/components/Feeds.js
index 80e9071b..3cbc7d4b 100644
--- a/vnext/src/components/Feeds.js
+++ b/vnext/src/components/Feeds.js
@@ -16,7 +16,7 @@ export function Discover(props) {
baseUrl: '/messages',
pageParam: 'before_mid'
};
- return (<Feed authRequired={false} query={query} {...props} />)
+ return (<Feed authRequired={false} query={query} {...props} />);
}
export function Discussions(props) {
@@ -24,7 +24,7 @@ export function Discussions(props) {
baseUrl: '/messages/discussions',
pageParam: 'to'
};
- return (<Feed authRequired={true} query={query} {...props} />)
+ return (<Feed authRequired={true} query={query} {...props} />);
}
export function Blog(props) {
@@ -36,7 +36,7 @@ export function Blog(props) {
},
pageParam: 'before_mid'
};
- return (<Feed authRequired={false} query={query} {...props} />)
+ return (<Feed authRequired={false} query={query} {...props} />);
}
export function Tag(props) {
@@ -48,7 +48,7 @@ export function Tag(props) {
},
pageParam: 'before_mid'
};
- return (<Feed authRequired={false} query={query} {...props} />)
+ return (<Feed authRequired={false} query={query} {...props} />);
}
export function Home(props) {
@@ -56,7 +56,7 @@ export function Home(props) {
baseUrl: '/home',
pageParam: 'before_mid'
};
- return (<Feed authRequired={true} query={query} {...props} />)
+ return (<Feed authRequired={true} query={query} {...props} />);
}
class Feed extends React.Component {
@@ -101,9 +101,9 @@ class Feed extends React.Component {
let newFilter = Object.assign({}, filterParams);
newFilter[pageParam] = pageValue;
const nextpage = `?${qs.stringify(newFilter)}`;
- this.setState({ msgs: data, loading: false, nextpage: nextpage })
+ this.setState({ msgs: data, loading: false, nextpage: nextpage });
}).catch(ex => {
- this.setState({ error: true })
+ this.setState({ error: true });
});
}
diff --git a/vnext/src/components/Footer.js b/vnext/src/components/Footer.js
index a775833e..a6d89a5d 100644
--- a/vnext/src/components/Footer.js
+++ b/vnext/src/components/Footer.js
@@ -1,4 +1,5 @@
import React from 'react';
+import PropTypes from 'prop-types';
import Icon from './Icon';
@@ -22,5 +23,9 @@ export default function Footer(props) {
<div>Sponsors: {props.links}</div>
}
</div>
- )
-} \ No newline at end of file
+ );
+}
+
+Footer.propTypes = {
+ links: PropTypes.string
+};
diff --git a/vnext/src/components/LoginButton.js b/vnext/src/components/LoginButton.js
index 05f5df97..e6c079f6 100644
--- a/vnext/src/components/LoginButton.js
+++ b/vnext/src/components/LoginButton.js
@@ -15,7 +15,9 @@ export default class LoginButton extends React.Component {
};
}
toggleModal = (event) => {
- if (event) event.preventDefault()
+ if (event) {
+ event.preventDefault();
+ }
this.setState({
isOpen: !this.state.isOpen
});
@@ -23,12 +25,12 @@ export default class LoginButton extends React.Component {
usernameChanged = (event) => {
this.setState({
username: event.target.value
- })
+ });
}
passwordChanged = (event) => {
this.setState({
password: event.target.value
- })
+ });
}
login = (event) => {
event.preventDefault();
@@ -88,16 +90,16 @@ const socialButtonsStyle = {
display: 'flex',
justifyContent: 'space-evenly',
padding: '4px'
-}
+};
const facebookButtonStyle = {
color: '#fff',
padding: '2px 14px',
background: '#3b5998'
-}
+};
const vkButtonStyle = {
color: '#fff',
padding: '2px 14px',
background: '#4c75a3'
-}
+};
diff --git a/vnext/src/components/Message.js b/vnext/src/components/Message.js
index d9a32a11..0ff68c7b 100644
--- a/vnext/src/components/Message.js
+++ b/vnext/src/components/Message.js
@@ -98,7 +98,7 @@ function Tags({ data, user, ...rest }) {
<div className="msg-tags" itemProp="headline">
{
data.map(tag => {
- return (<Link key={tag} to={{ pathname: `/${user.uname}`, search: `?tag=${tag}` }} title={tag}>{tag}</Link>)
+ return (<Link key={tag} to={{ pathname: `/${user.uname}`, search: `?tag=${tag}` }} title={tag}>{tag}</Link>);
})
}
</div>
@@ -114,5 +114,5 @@ Message.propTypes = {
Tags.propTypes = {
user: UserType.isRequired,
data: PropTypes.array
-}
+};
diff --git a/vnext/src/components/MessageInput.js b/vnext/src/components/MessageInput.js
index 1260b6fb..0f1fa4be 100644
--- a/vnext/src/components/MessageInput.js
+++ b/vnext/src/components/MessageInput.js
@@ -18,7 +18,7 @@ export default class MessageInput extends React.Component {
to: this.props.data.to || {},
body: this.props.text || '',
attach: ''
- }
+ };
}
handleCtrlEnter = (event) => {
@@ -28,7 +28,9 @@ export default class MessageInput extends React.Component {
}
onSubmit = (event) => {
- if (event.preventDefault) event.preventDefault();
+ if (event.preventDefault) {
+ event.preventDefault();
+ }
const input = this.fileinput.current;
this.props.onSend({
mid: this.state.mid,
@@ -36,20 +38,20 @@ export default class MessageInput extends React.Component {
body: this.state.body,
attach: this.state.attach ? input.files[0] : '',
to: this.state.to
- })
+ });
this.setState({
body: '',
attach: ''
- })
+ });
}
componentDidMount() {
- this.textarea.current.focus()
+ this.textarea.current.focus();
}
textChanged = (event) => {
this.setState({
body: event.target.value
- })
+ });
const el = this.textarea.current;
const offset = el.offsetHeight - el.clientHeight;
const height = el.scrollHeight + offset;
@@ -58,7 +60,7 @@ export default class MessageInput extends React.Component {
attachmentChanged = (event) => {
this.setState({
attach: event.target.value
- })
+ });
}
openfile = () => {
const input = this.fileinput.current;
@@ -89,7 +91,7 @@ export default class MessageInput extends React.Component {
</div>
</div>
</form>
- )
+ );
}
}
@@ -98,7 +100,7 @@ const commentStyle = {
flexDirection: 'column',
width: '100%',
marginTop: '10px'
-}
+};
const inactiveStyle = {
cursor: 'pointer',
diff --git a/vnext/src/components/Modal.js b/vnext/src/components/Modal.js
index 296f7911..77ca1a37 100644
--- a/vnext/src/components/Modal.js
+++ b/vnext/src/components/Modal.js
@@ -3,7 +3,7 @@ import PropTypes from 'prop-types';
import Icon from './Icon';
-class Modal extends React.Component {
+export default class Modal extends React.Component {
render() {
// Render nothing if the "show" prop is false
if (!this.props.show) {
@@ -41,5 +41,3 @@ Modal.propTypes = {
show: PropTypes.bool,
children: PropTypes.node
};
-
-export default Modal; \ No newline at end of file
diff --git a/vnext/src/components/PM.js b/vnext/src/components/PM.js
index 61e28e9a..c8812a02 100644
--- a/vnext/src/components/PM.js
+++ b/vnext/src/components/PM.js
@@ -46,4 +46,4 @@ function chatItemStyle(me, msg) {
PM.propTypes = {
chat: MessageType.isRequired,
visitor: UserType.isRequired
-} \ No newline at end of file
+};
diff --git a/vnext/src/components/SearchBox.js b/vnext/src/components/SearchBox.js
index 38414c78..612d860b 100644
--- a/vnext/src/components/SearchBox.js
+++ b/vnext/src/components/SearchBox.js
@@ -3,28 +3,28 @@ import PropTypes from 'prop-types';
export default class SearchBox extends React.Component {
constructor(props) {
- super(props)
+ super(props);
this.state = {
search: ''
- }
+ };
}
handleChange = (event) => {
this.setState({
search: event.target.value
- })
+ });
}
onSubmit = (event) => {
- event.preventDefault()
+ event.preventDefault();
this.props.onSearch(this.state.search);
}
render() {
- return <form onSubmit={this.onSubmit}>
+ return (<form onSubmit={this.onSubmit}>
<input name="search" className="text"
placeholder="Search..." value={this.state.search} onChange={this.handleChange} />
- </form>
+ </form>);
}
}
SearchBox.propTypes = {
onSearch: PropTypes.func.isRequired
-}
+};
diff --git a/vnext/src/components/Spinner.js b/vnext/src/components/Spinner.js
index 48979339..b5ec4e0d 100644
--- a/vnext/src/components/Spinner.js
+++ b/vnext/src/components/Spinner.js
@@ -20,5 +20,5 @@ export default function Spinner(props) {
<rect x="0" y="120" rx="0" ry="0" width="340" height="1" />
</ContentLoader>
</div>
- )
-} \ No newline at end of file
+ );
+}
diff --git a/vnext/src/components/Thread.js b/vnext/src/components/Thread.js
index 7ec6fff6..7f8e515a 100644
--- a/vnext/src/components/Thread.js
+++ b/vnext/src/components/Thread.js
@@ -31,7 +31,7 @@ export default class Thread extends React.Component {
this.loadReplies();
}
loadReplies() {
- this.setState({ replies: [], loading: true })
+ this.setState({ replies: [], loading: true });
const { mid } = this.props.match.params;
let params = {
mid: mid
@@ -47,7 +47,7 @@ export default class Thread extends React.Component {
replies: response.data,
loading: false,
active: 0
- })
+ });
}
).catch(ex => {
console.log(ex);
@@ -56,13 +56,13 @@ export default class Thread extends React.Component {
setActive(msg, event) {
this.setState({
active: msg.rid || 0
- })
+ });
}
onReply = (msg) => {
if (msg.mid == this.state.msg.mid) {
this.setState({
replies: [...this.state.replies, msg]
- })
+ });
}
}
postComment = (template) => {
@@ -153,7 +153,7 @@ export default class Thread extends React.Component {
}
</ul>
</React.Fragment>
- )
+ );
}
}
diff --git a/vnext/src/components/__tests__/Avatar.test.js b/vnext/src/components/__tests__/Avatar.test.js
index ac33abe9..e1a12912 100644
--- a/vnext/src/components/__tests__/Avatar.test.js
+++ b/vnext/src/components/__tests__/Avatar.test.js
@@ -12,4 +12,4 @@ test('Avatar renders correctly', () => {
);
let tree = component.toJSON();
expect(tree).toMatchSnapshot();
-}); \ No newline at end of file
+});
diff --git a/vnext/src/components/__tests__/Footer.test.js b/vnext/src/components/__tests__/Footer.test.js
index 17461b85..5550c663 100644
--- a/vnext/src/components/__tests__/Footer.test.js
+++ b/vnext/src/components/__tests__/Footer.test.js
@@ -15,4 +15,4 @@ test('Footer renders correctly with and without sponsors', () => {
);
footerTree = sponsoredFooter.toJSON();
expect(footerTree).toMatchSnapshot();
-}); \ No newline at end of file
+});
diff --git a/vnext/src/components/__tests__/LoginButton.test.js b/vnext/src/components/__tests__/LoginButton.test.js
index 0b672365..be083c22 100644
--- a/vnext/src/components/__tests__/LoginButton.test.js
+++ b/vnext/src/components/__tests__/LoginButton.test.js
@@ -13,4 +13,4 @@ test('Login button and form are renders correctly', () => {
button.root.instance.toggleModal();
let modal = button.toJSON();
expect(modal).toMatchSnapshot();
-}); \ No newline at end of file
+});
diff --git a/vnext/src/components/__tests__/MessageInput-test.js b/vnext/src/components/__tests__/MessageInput-test.js
index 53db324f..65ec383d 100644
--- a/vnext/src/components/__tests__/MessageInput-test.js
+++ b/vnext/src/components/__tests__/MessageInput-test.js
@@ -55,4 +55,4 @@ it('Clears template on submit', () => {
expect(messageInput.state().body).toEqual(' ');
messageInput.find('Button').simulate('click');
expect(messageInput.state().body).toEqual('');
-})
+});