Update airbnb eslint config to 3.0.0
This commit is contained in:
parent
9db0341973
commit
7c72cac71f
File diff suppressed because one or more lines are too long
|
@ -1,27 +1,27 @@
|
|||
{
|
||||
"name": "irc",
|
||||
"name": "dispatch",
|
||||
"version": "0.0.0",
|
||||
"description": "",
|
||||
"main": "index.js",
|
||||
"devDependencies": {
|
||||
"babel-core": "^6.3.26",
|
||||
"babel-eslint": "^5.0.0-beta6",
|
||||
"babel-loader": "^6.2.0",
|
||||
"babel-loader": "^6.2.1",
|
||||
"babel-plugin-react-transform": "^2.0.0",
|
||||
"babel-plugin-transform-decorators-legacy": "^1.3.4",
|
||||
"babel-preset-es2015": "^6.3.13",
|
||||
"babel-preset-react": "^6.3.13",
|
||||
"babel-preset-stage-0": "^6.3.13",
|
||||
"eslint": "^1.10.3",
|
||||
"eslint-config-airbnb": "^2.1.1",
|
||||
"eslint-loader": "^1.1.1",
|
||||
"eslint-plugin-react": "^3.13.1",
|
||||
"eslint-config-airbnb": "^3.0.0",
|
||||
"eslint-loader": "^1.2.0",
|
||||
"eslint-plugin-react": "^3.14.0",
|
||||
"express": "^4.13.3",
|
||||
"gulp": "~3.9.0",
|
||||
"gulp": "^3.9.0",
|
||||
"gulp-autoprefixer": "3.1.0",
|
||||
"gulp-cached": "^1.1.0",
|
||||
"gulp-concat": "~2.6.0",
|
||||
"gulp-cssnano": "^2.0.0",
|
||||
"gulp-concat": "^2.6.0",
|
||||
"gulp-cssnano": "^2.1.0",
|
||||
"gulp-gzip": "1.2.0",
|
||||
"gulp-htmlmin": "^1.3.0",
|
||||
"gulp-util": "^3.0.7",
|
||||
|
@ -43,14 +43,14 @@
|
|||
"immutable": "^3.7.6",
|
||||
"lodash": "^3.10.1",
|
||||
"pure-render-decorator": "^0.2.0",
|
||||
"react": "^0.14.3",
|
||||
"react-dom": "^0.14.3",
|
||||
"react": "^0.14.5",
|
||||
"react-dom": "^0.14.5",
|
||||
"react-infinite": "0.7.3",
|
||||
"react-redux": "^4.0.5",
|
||||
"react-redux": "^4.0.6",
|
||||
"react-router": "^1.0.3",
|
||||
"redux": "^3.0.5",
|
||||
"redux-simple-router": "^1.0.2",
|
||||
"redux-thunk": "^1.0.2",
|
||||
"redux-thunk": "^1.0.3",
|
||||
"reselect": "^2.0.1"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -68,7 +68,7 @@ export function setNick(nick, server) {
|
|||
socket: {
|
||||
type: 'nick',
|
||||
data: {
|
||||
new: nick,
|
||||
'new': nick,
|
||||
server
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,10 +7,10 @@ import Navicon from '../components/Navicon';
|
|||
@pure
|
||||
export default class ChatTitle extends Component {
|
||||
handleLeaveClick = () => {
|
||||
const { tab, channel, disconnect, part, closePrivateChat } = this.props;
|
||||
const { tab, disconnect, part, closePrivateChat } = this.props;
|
||||
|
||||
if (tab.channel) {
|
||||
part([channel.get('name')], tab.server);
|
||||
part([tab.channel], tab.server);
|
||||
} else if (tab.user) {
|
||||
closePrivateChat(tab.server, tab.user);
|
||||
} else {
|
||||
|
|
|
@ -17,8 +17,12 @@ export default class MessageHeader extends Component {
|
|||
render() {
|
||||
const { message } = this.props;
|
||||
const line = Autolinker.link(message.lines[0], { stripPrefix: false });
|
||||
const classes = ['message'];
|
||||
let sender = null;
|
||||
let messageClass = 'message';
|
||||
|
||||
if (message.type) {
|
||||
classes.push(`message-${message.type}`);
|
||||
}
|
||||
|
||||
if (message.from) {
|
||||
sender = (
|
||||
|
@ -31,12 +35,8 @@ export default class MessageHeader extends Component {
|
|||
);
|
||||
}
|
||||
|
||||
if (message.type) {
|
||||
messageClass += ' message-' + message.type;
|
||||
}
|
||||
|
||||
return (
|
||||
<p className={messageClass}>
|
||||
<p className={classes.join(' ')}>
|
||||
<span className="message-time">{timestamp(message.time)}</span>
|
||||
{sender}
|
||||
<span dangerouslySetInnerHTML={{ __html: ' ' + line }}></span>
|
||||
|
|
|
@ -5,11 +5,12 @@ import pure from 'pure-render-decorator';
|
|||
@pure
|
||||
export default class MessageLine extends Component {
|
||||
render() {
|
||||
const line = Autolinker.link(this.props.line, { stripPrefix: false });
|
||||
const { line, type } = this.props;
|
||||
const content = Autolinker.link(line, { stripPrefix: false });
|
||||
const classes = ['message'];
|
||||
|
||||
let messageClass = 'message';
|
||||
if (this.props.type) {
|
||||
messageClass += ' message-' + this.props.type;
|
||||
if (type) {
|
||||
classes.push(`message-${type}`);
|
||||
}
|
||||
|
||||
const style = {
|
||||
|
@ -17,8 +18,8 @@ export default class MessageLine extends Component {
|
|||
};
|
||||
|
||||
return (
|
||||
<p className={messageClass} style={style}>
|
||||
<span dangerouslySetInnerHTML={{ __html: line }}></span>
|
||||
<p className={classes.join(' ')} style={style}>
|
||||
<span dangerouslySetInnerHTML={{ __html: content }}></span>
|
||||
</p>
|
||||
);
|
||||
}
|
||||
|
|
|
@ -5,10 +5,11 @@ import { toggleMenu } from '../actions/tab';
|
|||
|
||||
@pure
|
||||
class Navicon extends Component {
|
||||
handleClick = () => this.props.dispatch(toggleMenu())
|
||||
|
||||
render() {
|
||||
const { dispatch } = this.props;
|
||||
return (
|
||||
<i className="icon-menu navicon" onClick={() => dispatch(toggleMenu())}></i>
|
||||
<i className="icon-menu navicon" onClick={this.handleClick}></i>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,25 +10,27 @@ export default class Search extends Component {
|
|||
}
|
||||
}
|
||||
|
||||
render() {
|
||||
const { search, onSearch } = this.props;
|
||||
const results = search.results.map(result => {
|
||||
return (
|
||||
<p key={result.id}>{timestamp(new Date(result.time * 1000))} {result.from} {result.content}</p>
|
||||
);
|
||||
});
|
||||
handleSearch = e => this.props.onSearch(e.target.value)
|
||||
|
||||
render() {
|
||||
const { search } = this.props;
|
||||
const style = {
|
||||
display: search.show ? 'block' : 'none'
|
||||
};
|
||||
|
||||
const results = search.results.map(result => (
|
||||
<p key={result.id}>
|
||||
{timestamp(new Date(result.time * 1000))} {result.from} {result.content}
|
||||
</p>
|
||||
));
|
||||
|
||||
return (
|
||||
<div className="search" style={style}>
|
||||
<input
|
||||
ref="input"
|
||||
className="search-input"
|
||||
type="text"
|
||||
onChange={e => onSearch(e.target.value)}
|
||||
onChange={this.handleSearch}
|
||||
/>
|
||||
<div className="search-results">{results}</div>
|
||||
</div>
|
||||
|
|
|
@ -4,10 +4,9 @@ import TabListItem from './TabListItem';
|
|||
|
||||
@pure
|
||||
export default class TabList extends Component {
|
||||
handleTabClick = (server, channel, pm) => {
|
||||
const { select, hideMenu } = this.props;
|
||||
select(server, channel, pm);
|
||||
hideMenu();
|
||||
handleTabClick = (server, target) => {
|
||||
this.props.select(server, target, target && target.charAt(0) !== '#');
|
||||
this.props.hideMenu();
|
||||
}
|
||||
|
||||
handleConnectClick = () => {
|
||||
|
@ -29,35 +28,39 @@ export default class TabList extends Component {
|
|||
tabs.push(
|
||||
<TabListItem
|
||||
key={address}
|
||||
server
|
||||
server={address}
|
||||
content={servers.getIn([address, 'name'])}
|
||||
selected={selected.server === address && selected.channel === null && selected.user === null}
|
||||
onClick={() => this.handleTabClick(address)}
|
||||
selected={
|
||||
selected.server === address &&
|
||||
selected.channel === null &&
|
||||
selected.user === null
|
||||
}
|
||||
onClick={this.handleTabClick}
|
||||
/>
|
||||
);
|
||||
|
||||
server.forEach((channel, name) => {
|
||||
tabs.push(
|
||||
server.forEach((channel, name) => tabs.push(
|
||||
<TabListItem
|
||||
key={address + channel.get('name')}
|
||||
content={channel.get('name')}
|
||||
key={address + name}
|
||||
server={address}
|
||||
target={name}
|
||||
content={name}
|
||||
selected={selected.server === address && selected.channel === name}
|
||||
onClick={() => this.handleTabClick(address, channel.get('name'))}
|
||||
onClick={this.handleTabClick}
|
||||
/>
|
||||
);
|
||||
});
|
||||
));
|
||||
|
||||
if (privateChats.has(address)) {
|
||||
privateChats.get(address).forEach(nick => {
|
||||
tabs.push(
|
||||
privateChats.get(address).forEach(nick => tabs.push(
|
||||
<TabListItem
|
||||
key={address + nick}
|
||||
server={address}
|
||||
target={nick}
|
||||
content={nick}
|
||||
selected={selected.server === address && selected.user === nick}
|
||||
onClick={() => this.handleTabClick(address, nick, true)}
|
||||
onClick={this.handleTabClick}
|
||||
/>
|
||||
);
|
||||
});
|
||||
));
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
@ -3,19 +3,25 @@ import pure from 'pure-render-decorator';
|
|||
|
||||
@pure
|
||||
export default class TabListItem extends Component {
|
||||
handleClick = () => {
|
||||
const { server, target, onClick } = this.props;
|
||||
onClick(server, target);
|
||||
}
|
||||
|
||||
render() {
|
||||
const { target, content, selected } = this.props;
|
||||
const classes = [];
|
||||
|
||||
if (this.props.server) {
|
||||
if (!target) {
|
||||
classes.push('tab-server');
|
||||
}
|
||||
|
||||
if (this.props.selected) {
|
||||
if (selected) {
|
||||
classes.push('selected');
|
||||
}
|
||||
|
||||
return (
|
||||
<p className={classes.join(' ')} onClick={this.props.onClick}>{this.props.content}</p>
|
||||
<p className={classes.join(' ')} onClick={this.handleClick}>{content}</p>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -29,8 +29,7 @@ export default class UserList extends Component {
|
|||
if (!tab.channel) {
|
||||
style.display = 'none';
|
||||
} else {
|
||||
this.props.users.forEach(user => {
|
||||
users.push(
|
||||
this.props.users.forEach(user => users.push(
|
||||
<UserListItem
|
||||
key={user.nick}
|
||||
user={user}
|
||||
|
@ -38,8 +37,7 @@ export default class UserList extends Component {
|
|||
openPrivateChat={openPrivateChat}
|
||||
select={select}
|
||||
/>
|
||||
);
|
||||
});
|
||||
));
|
||||
}
|
||||
|
||||
return (
|
||||
|
|
|
@ -55,6 +55,13 @@ class Chat extends Component {
|
|||
}
|
||||
}
|
||||
|
||||
handleSearch = phrase => {
|
||||
const { dispatch, tab } = this.props;
|
||||
if (tab.channel) {
|
||||
dispatch(searchMessages(tab.server, tab.channel, phrase));
|
||||
}
|
||||
}
|
||||
|
||||
render() {
|
||||
const { tab, channel, search, history, dispatch } = this.props;
|
||||
|
||||
|
@ -72,8 +79,7 @@ class Chat extends Component {
|
|||
<ChatTitle {...this.props } />
|
||||
<Search
|
||||
search={search}
|
||||
onSearch={phrase => tab.channel &&
|
||||
dispatch(searchMessages(tab.server, tab.channel, phrase))}
|
||||
onSearch={this.handleSearch}
|
||||
/>
|
||||
<MessageBox {...this.props } />
|
||||
<MessageInput
|
||||
|
@ -115,7 +121,7 @@ function mapStateToProps(state) {
|
|||
|
||||
let title;
|
||||
if (tab.channel) {
|
||||
title = channel.get('name');
|
||||
title = tab.channel;
|
||||
} else if (tab.user) {
|
||||
title = tab.user;
|
||||
} else {
|
||||
|
|
|
@ -79,10 +79,7 @@ export default createReducer(Map(), {
|
|||
|
||||
[actions.SOCKET_JOIN](state, action) {
|
||||
const { server, channels, user } = action;
|
||||
const channel = channels[0];
|
||||
return state
|
||||
.setIn([server, channel, 'name'], channels[0])
|
||||
.updateIn([server, channel, 'users'], List(), users => {
|
||||
return state.updateIn([server, channels[0], 'users'], List(), users => {
|
||||
return users.push(createUser(user)).sort(compareUsers);
|
||||
});
|
||||
},
|
||||
|
@ -91,7 +88,9 @@ export default createReducer(Map(), {
|
|||
const { server, channels, user } = action;
|
||||
const channel = channels[0];
|
||||
if (state.hasIn([server, channel])) {
|
||||
return state.updateIn([server, channel, 'users'], users => users.filter(u => u.nick !== user));
|
||||
return state.updateIn([server, channel, 'users'], users =>
|
||||
users.filter(u => u.nick !== user)
|
||||
);
|
||||
}
|
||||
return state;
|
||||
},
|
||||
|
@ -156,8 +155,7 @@ export default createReducer(Map(), {
|
|||
action.data.forEach(channel => {
|
||||
s.setIn([channel.server, channel.name], Map({
|
||||
users: List(),
|
||||
topic: channel.topic,
|
||||
name: channel.name
|
||||
topic: channel.topic
|
||||
}));
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue