Permalink
Browse files

fix(lint): after upgradeC

  • Loading branch information...
xcarpentier committed Dec 18, 2017
1 parent 3f09d38 commit 4571ddabf60e5dad54c2d83970c7c5e15097c88c
Showing with 400 additions and 358 deletions.
  1. +11 βˆ’5 .eslintrc
  2. +6 βˆ’6 package.json
  3. +7 βˆ’5 src/Actions.js
  4. +4 βˆ’2 src/Avatar.js
  5. +4 βˆ’2 src/Bubble.js
  6. +8 βˆ’6 src/Composer.js
  7. +1 βˆ’1 src/Day.js
  8. +2 βˆ’0 src/GiftedAvatar.js
  9. +11 βˆ’9 src/GiftedChat.js
  10. +2 βˆ’0 src/InputToolbar.js
  11. +2 βˆ’0 src/LoadEarlier.js
  12. +2 βˆ’0 src/Message.js
  13. +6 βˆ’4 src/MessageContainer.js
  14. +2 βˆ’0 src/MessageText.js
  15. +332 βˆ’318 yarn.lock
View
@@ -1,17 +1,23 @@
{
"extends": "cooperka/react-native",
"env": {
"browser": true,
"jest": true
},
"rules": {
"no-underscore-dangle": 0,
"import/no-unresolved": [2, { "ignore": ["react", "react-native"] }],
"import/no-unresolved": [
2,
{
"ignore": [
"react",
"react-native"
]
}
],
"import/no-extraneous-dependencies": 0,
"import/extensions": 0,
"react/no-unused-prop-types": 0,
"comma-dangle": 0,
"arrow-parens": 0
"react/no-typos": 0
}
}
}
View
@@ -27,12 +27,12 @@
"lint": "eslint . --ext .js,.jsx"
},
"devDependencies": {
"eslint": "3.19.0",
"eslint-config-airbnb": "15.0.2",
"eslint-config-cooperka": "0.2.3",
"eslint-plugin-import": "2.6.1",
"eslint-plugin-jsx-a11y": "5.1.1",
"eslint-plugin-react": "7.1.0",
"eslint": "^4.9.0",
"eslint-config-airbnb": "16.1.0",
"eslint-config-cooperka": "0.2.9",
"eslint-plugin-import": "^2.7.0",
"eslint-plugin-jsx-a11y": "^6.0.2",
"eslint-plugin-react": "^7.4.0",
"eslint-plugin-react-native": "2.3.2"
},
"dependencies": {
View
@@ -6,6 +6,7 @@ import { StyleSheet, Text, TouchableOpacity, View, ViewPropTypes } from 'react-n
import Color from './Color';
export default class Actions extends React.Component {
constructor(props) {
super(props);
this.onActionsPress = this.onActionsPress.bind(this);
@@ -20,9 +21,9 @@ export default class Actions extends React.Component {
cancelButtonIndex,
tintColor: this.props.optionTintColor,
},
buttonIndex => {
function handle(buttonIndex) {
let i = 0;
Object.keys(this.props.options).forEach(key => {
Object.keys(this.props.options).forEach(function launch(key) {

This comment has been minimized.

Show comment
Hide comment
@brunocascio

brunocascio Mar 15, 2018

Collaborator

@xcarpentier
After change to non-arrow function, this code brokes because this.props is undefined (since this is the context of launc instead of handle.

I'm going to fix now.

@brunocascio

brunocascio Mar 15, 2018

Collaborator

@xcarpentier
After change to non-arrow function, this code brokes because this.props is undefined (since this is the context of launc instead of handle.

I'm going to fix now.

if (this.props.options[key]) {
if (buttonIndex === i) {
this.props.options[key](this.props);
@@ -31,7 +32,7 @@ export default class Actions extends React.Component {
i += 1;
}
});
}
},
);
}
@@ -56,6 +57,7 @@ export default class Actions extends React.Component {
</TouchableOpacity>
);
}
}
const styles = StyleSheet.create({
@@ -85,14 +87,14 @@ Actions.contextTypes = {
};
Actions.defaultProps = {
onSend: () => {},
onSend: () => { },
options: {},
optionTintColor: Color.optionTintColor,
icon: null,
containerStyle: {},
iconTextStyle: {},
wrapperStyle: {},
onPressActionButton: () => {},
onPressActionButton: () => { },
};
Actions.propTypes = {
View
@@ -7,6 +7,7 @@ import GiftedAvatar from './GiftedAvatar';
import { isSameUser, isSameDay, warnDeprecated } from './utils';
export default class Avatar extends React.Component {
renderAvatar() {
if (this.props.renderAvatar) {
const { renderAvatar, ...avatarProps } = this.props;
@@ -27,7 +28,7 @@ export default class Avatar extends React.Component {
}
render() {
const renderAvatarOnTop = this.props.renderAvatarOnTop;
const { renderAvatarOnTop } = this.props;
const messageToCompare = renderAvatarOnTop
? this.props.previousMessage
: this.props.nextMessage;
@@ -70,6 +71,7 @@ export default class Avatar extends React.Component {
</View>
);
}
}
const styles = {
@@ -114,7 +116,7 @@ Avatar.defaultProps = {
nextMessage: {},
containerStyle: {},
imageStyle: {},
onPressAvatar: () => {},
onPressAvatar: () => { },
// TODO: remove in next major release
isSameDay: warnDeprecated(isSameDay),
isSameUser: warnDeprecated(isSameUser),
View
@@ -19,6 +19,7 @@ import Color from './Color';
import { isSameUser, isSameDay, warnDeprecated } from './utils';
export default class Bubble extends React.Component {
constructor(props) {
super(props);
this.onLongPress = this.onLongPress.bind(this);
@@ -35,15 +36,15 @@ export default class Bubble extends React.Component {
options,
cancelButtonIndex,
},
buttonIndex => {
(buttonIndex) => {
switch (buttonIndex) {
case 0:
Clipboard.setString(this.props.currentMessage.text);
break;
default:
break;
}
}
},
);
}
}
@@ -168,6 +169,7 @@ export default class Bubble extends React.Component {
</View>
);
}
}
const styles = {
View
@@ -8,8 +8,9 @@ import { MIN_COMPOSER_HEIGHT, DEFAULT_PLACEHOLDER } from './Constant';
import Color from './Color';
export default class Composer extends React.Component {
onContentSizeChange(e) {
const contentSize = e.nativeEvent.contentSize;
const { contentSize } = e.nativeEvent;
// Support earlier versions of React Native on Android.
if (!contentSize) return;
@@ -34,9 +35,9 @@ export default class Composer extends React.Component {
placeholder={this.props.placeholder}
placeholderTextColor={this.props.placeholderTextColor}
multiline={this.props.multiline}
onChange={e => this.onContentSizeChange(e)}
onContentSizeChange={e => this.onContentSizeChange(e)}
onChangeText={text => this.onChangeText(text)}
onChange={(e) => this.onContentSizeChange(e)}
onContentSizeChange={(e) => this.onContentSizeChange(e)}
onChangeText={(text) => this.onChangeText(text)}
style={[styles.textInput, this.props.textInputStyle, { height: this.props.composerHeight }]}
autoFocus={this.props.textInputAutoFocus}
value={this.props.text}
@@ -47,6 +48,7 @@ export default class Composer extends React.Component {
/>
);
}
}
const styles = StyleSheet.create({
@@ -75,8 +77,8 @@ Composer.defaultProps = {
multiline: true,
textInputStyle: {},
textInputAutoFocus: false,
onTextChanged: () => {},
onInputSizeChanged: () => {},
onTextChanged: () => { },
onInputSizeChanged: () => { },
};
Composer.propTypes = {
View
@@ -12,7 +12,7 @@ import { DATE_FORMAT } from './Constant';
export default function Day(
{ dateFormat, currentMessage, previousMessage, containerStyle, wrapperStyle, textStyle },
context
context,
) {
if (!isSameDay(currentMessage, previousMessage)) {
return (
View
@@ -11,6 +11,7 @@ const { carot, emerald, peterRiver, wisteria, alizarin, turquoise, midnightBlue
// handle only alpha numeric chars
export default class GiftedAvatar extends React.Component {
setAvatarColor() {
const userName = this.props.user.name || '';
const name = userName.toUpperCase().split(' ');
@@ -106,6 +107,7 @@ export default class GiftedAvatar extends React.Component {
</TouchableOpacity>
);
}
}
const styles = {
View
@@ -40,6 +40,7 @@ import {
} from './Constant';
class GiftedChat extends React.Component {
static append(currentMessages = [], messages, inverted = true) {
if (!Array.isArray(messages)) {
messages = [messages];
@@ -200,10 +201,10 @@ class GiftedChat extends React.Component {
onInputSizeChanged(size) {
const newComposerHeight = Math.max(
MIN_COMPOSER_HEIGHT,
Math.min(MAX_COMPOSER_HEIGHT, size.height)
Math.min(MAX_COMPOSER_HEIGHT, size.height),
);
const newMessagesContainerHeight = this.getMessagesContainerHeightWithKeyboard(
newComposerHeight
newComposerHeight,
);
this.setState({
composerHeight: newComposerHeight,
@@ -225,15 +226,15 @@ class GiftedChat extends React.Component {
}
onInitialLayoutViewLayout(e) {
const layout = e.nativeEvent.layout;
const { layout } = e.nativeEvent;
if (layout.height <= 0) {
return;
}
this.notifyInputTextReset();
this.setMaxHeight(layout.height);
const newComposerHeight = MIN_COMPOSER_HEIGHT;
const newMessagesContainerHeight = this.getMessagesContainerHeightWithKeyboard(
newComposerHeight
newComposerHeight,
);
this.setState({
isInitialized: true,
@@ -245,12 +246,12 @@ class GiftedChat extends React.Component {
onMainViewLayout(e) {
// fix an issue when keyboard is dismissing during the initialization
const layout = e.nativeEvent.layout;
const { layout } = e.nativeEvent;
if (this.getMaxHeight() !== layout.height || this.getIsFirstLayout() === true) {
this.setMaxHeight(layout.height);
this.setState({
messagesContainerHeight: this.prepareMessagesContainerHeight(
this.getBasicMessagesContainerHeight()
this.getBasicMessagesContainerHeight(),
),
});
}
@@ -409,7 +410,7 @@ class GiftedChat extends React.Component {
this.notifyInputTextReset();
const newComposerHeight = MIN_COMPOSER_HEIGHT;
const newMessagesContainerHeight = this.getMessagesContainerHeightWithKeyboard(
newComposerHeight
newComposerHeight,
);
this.setState({
text: this.getTextFromProp(''),
@@ -506,6 +507,7 @@ class GiftedChat extends React.Component {
</View>
);
}
}
const styles = StyleSheet.create({
@@ -525,7 +527,7 @@ GiftedChat.defaultProps = {
placeholder: DEFAULT_PLACEHOLDER,
messageIdGenerator: () => uuid.v4(),
user: {},
onSend: () => {},
onSend: () => { },
locale: null,
timeFormat: TIME_FORMAT,
dateFormat: DATE_FORMAT,
@@ -534,7 +536,7 @@ GiftedChat.defaultProps = {
android: false,
}),
loadEarlier: false,
onLoadEarlier: () => {},
onLoadEarlier: () => { },
isLoadingEarlier: false,
renderLoading: null,
renderLoadEarlier: null,
View
@@ -10,6 +10,7 @@ import Actions from './Actions';
import Color from './Color';
export default class InputToolbar extends React.Component {
constructor(props) {
super(props);
@@ -92,6 +93,7 @@ export default class InputToolbar extends React.Component {
</View>
);
}
}
const styles = StyleSheet.create({
View
@@ -14,6 +14,7 @@ import {
import Color from './Color';
export default class LoadEarlier extends React.Component {
renderLoading() {
if (this.props.isLoadingEarlier === false) {
return <Text style={[styles.text, this.props.textStyle]}>{this.props.label}</Text>;
@@ -45,6 +46,7 @@ export default class LoadEarlier extends React.Component {
</TouchableOpacity>
);
}
}
const styles = StyleSheet.create({
View
@@ -12,6 +12,7 @@ import Day from './Day';
import { isSameUser, isSameDay } from './utils';
export default class Message extends React.Component {
getInnerComponentProps() {
const { containerStyle, ...props } = this.props;
return {
@@ -84,6 +85,7 @@ export default class Message extends React.Component {
</View>
);
}
}
const styles = {
Oops, something went wrong.

0 comments on commit 4571dda

Please sign in to comment.