Skip to content

Commit

Permalink
fix(): eslint fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
sankhadeeproy007 committed Jul 6, 2019
1 parent 7472ba3 commit de81ef2
Show file tree
Hide file tree
Showing 121 changed files with 889 additions and 958 deletions.
4 changes: 3 additions & 1 deletion .eslintignore
@@ -1,3 +1,5 @@
vendor/
Components/Styles/
dist/
dist/
src/basic/Tabs/
src/basic/SwipeRow.js
13 changes: 12 additions & 1 deletion .eslintrc.json
@@ -1,7 +1,18 @@
{
"extends": ["airbnb", "prettier"],
"parser": "babel-eslint",
"rules": {
"indent": ["warn", 2]
"indent": ["error", 2],
"react/require-extension": "off",
"import/order": ["error", { "newlines-between": "always" }],
"func-names": "off",
"import/prefer-default-export": "off",
"no-prototype-builtins": "off",
"no-nested-ternary": "warn",
"no-underscore-dangle": "off",
"no-unused-expressions": "off",
"react/jsx-filename-extension": "off",
"react/prop-types": "off"
},
"plugins": ["react", "jsx-a11y", "import", "react-native"]
}
53 changes: 7 additions & 46 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 4 additions & 2 deletions package.json
Expand Up @@ -34,6 +34,8 @@
"blueimp-md5": "^2.5.0",
"clamp": "^1.0.1",
"color": "~1.0.3",
"create-react-class": "^15.6.3",
"eslint-config-prettier": "^6.0.0",
"fs-extra": "^2.0.0",
"jest-react-native": "^18.0.0",
"lodash": "4.17.11",
Expand All @@ -44,9 +46,9 @@
"react-native-easy-grid": "0.2.1",
"react-native-keyboard-aware-scroll-view": "0.8.0",
"react-native-vector-icons": "6.1.0",
"react-timer-mixin": "^0.13.4",
"react-tween-state": "^0.1.5",
"tween-functions": "^1.0.1",
"react-timer-mixin": "^0.13.4"
"tween-functions": "^1.0.1"
},
"devDependencies": {
"babel-cli": "^6.18.0",
Expand Down
25 changes: 16 additions & 9 deletions src/basic/Accordion.js
@@ -1,14 +1,18 @@
import React, { Component } from 'react';
/* eslint-disable react/no-multi-comp */
/* eslint-disable react/prefer-stateless-function */
import React from 'react';
import {
Animated,
TouchableWithoutFeedback,
FlatList,
StyleSheet,
View
} from 'react-native';

import variable from '../theme/variables/platform';

import { Text } from './Text';
import { Icon } from './Icon';
import variable from '../theme/variables/platform';

class DefaultHeader extends React.Component {
render() {
Expand All @@ -18,6 +22,7 @@ class DefaultHeader extends React.Component {
return (
<View
style={[
// eslint-disable-next-line no-use-before-define
styles.defaultHeader,
this.props.headerStyle
? this.props.headerStyle
Expand Down Expand Up @@ -83,7 +88,7 @@ class AccordionSubItem extends React.Component {
}).start();
}
render() {
let { fadeAnim } = this.state;
const { fadeAnim } = this.state;
return (
<Animated.View style={{ ...this.props.style, opacity: fadeAnim }}>
{this.props.children}
Expand Down Expand Up @@ -133,7 +138,13 @@ class AccordionItem extends React.Component {
}

export class Accordion extends React.Component {
state = { selected: undefined };
constructor(props) {
super(props);
this.state = {
selected: props.expanded
};
}

setSelected(index) {
if (this.state.selected === index) {
this.setState({ selected: undefined });
Expand All @@ -142,10 +153,6 @@ export class Accordion extends React.Component {
}
}

componentDidMount() {
this.setState({ selected: this.props.expanded });
}

render() {
const variables = this.context.theme
? this.context.theme['@@shoutem.theme/themeStyle'].variables
Expand All @@ -168,7 +175,7 @@ export class Accordion extends React.Component {
item={item}
expanded={this.state.selected === index}
index={index}
setSelected={this.setSelected.bind(this)}
setSelected={i => this.setSelected(i)}
headerStyle={this.props.headerStyle}
contentStyle={this.props.contentStyle}
renderHeader={this.props.renderHeader}
Expand Down

0 comments on commit de81ef2

Please sign in to comment.