Skip to content
This repository was archived by the owner on May 15, 2024. It is now read-only.

Commit de81ef2

Browse files
fix(): eslint fixes
1 parent 7472ba3 commit de81ef2

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

121 files changed

+889
-958
lines changed

.eslintignore

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
vendor/
22
Components/Styles/
3-
dist/
3+
dist/
4+
src/basic/Tabs/
5+
src/basic/SwipeRow.js

.eslintrc.json

+12-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,18 @@
11
{
2+
"extends": ["airbnb", "prettier"],
23
"parser": "babel-eslint",
34
"rules": {
4-
"indent": ["warn", 2]
5+
"indent": ["error", 2],
6+
"react/require-extension": "off",
7+
"import/order": ["error", { "newlines-between": "always" }],
8+
"func-names": "off",
9+
"import/prefer-default-export": "off",
10+
"no-prototype-builtins": "off",
11+
"no-nested-ternary": "warn",
12+
"no-underscore-dangle": "off",
13+
"no-unused-expressions": "off",
14+
"react/jsx-filename-extension": "off",
15+
"react/prop-types": "off"
516
},
617
"plugins": ["react", "jsx-a11y", "import", "react-native"]
718
}

package-lock.json

+7-46
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+4-2
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@
3434
"blueimp-md5": "^2.5.0",
3535
"clamp": "^1.0.1",
3636
"color": "~1.0.3",
37+
"create-react-class": "^15.6.3",
38+
"eslint-config-prettier": "^6.0.0",
3739
"fs-extra": "^2.0.0",
3840
"jest-react-native": "^18.0.0",
3941
"lodash": "4.17.11",
@@ -44,9 +46,9 @@
4446
"react-native-easy-grid": "0.2.1",
4547
"react-native-keyboard-aware-scroll-view": "0.8.0",
4648
"react-native-vector-icons": "6.1.0",
49+
"react-timer-mixin": "^0.13.4",
4750
"react-tween-state": "^0.1.5",
48-
"tween-functions": "^1.0.1",
49-
"react-timer-mixin": "^0.13.4"
51+
"tween-functions": "^1.0.1"
5052
},
5153
"devDependencies": {
5254
"babel-cli": "^6.18.0",

src/basic/Accordion.js

+16-9
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,18 @@
1-
import React, { Component } from 'react';
1+
/* eslint-disable react/no-multi-comp */
2+
/* eslint-disable react/prefer-stateless-function */
3+
import React from 'react';
24
import {
35
Animated,
46
TouchableWithoutFeedback,
57
FlatList,
68
StyleSheet,
79
View
810
} from 'react-native';
11+
12+
import variable from '../theme/variables/platform';
13+
914
import { Text } from './Text';
1015
import { Icon } from './Icon';
11-
import variable from '../theme/variables/platform';
1216

1317
class DefaultHeader extends React.Component {
1418
render() {
@@ -18,6 +22,7 @@ class DefaultHeader extends React.Component {
1822
return (
1923
<View
2024
style={[
25+
// eslint-disable-next-line no-use-before-define
2126
styles.defaultHeader,
2227
this.props.headerStyle
2328
? this.props.headerStyle
@@ -83,7 +88,7 @@ class AccordionSubItem extends React.Component {
8388
}).start();
8489
}
8590
render() {
86-
let { fadeAnim } = this.state;
91+
const { fadeAnim } = this.state;
8792
return (
8893
<Animated.View style={{ ...this.props.style, opacity: fadeAnim }}>
8994
{this.props.children}
@@ -133,7 +138,13 @@ class AccordionItem extends React.Component {
133138
}
134139

135140
export class Accordion extends React.Component {
136-
state = { selected: undefined };
141+
constructor(props) {
142+
super(props);
143+
this.state = {
144+
selected: props.expanded
145+
};
146+
}
147+
137148
setSelected(index) {
138149
if (this.state.selected === index) {
139150
this.setState({ selected: undefined });
@@ -142,10 +153,6 @@ export class Accordion extends React.Component {
142153
}
143154
}
144155

145-
componentDidMount() {
146-
this.setState({ selected: this.props.expanded });
147-
}
148-
149156
render() {
150157
const variables = this.context.theme
151158
? this.context.theme['@@shoutem.theme/themeStyle'].variables
@@ -168,7 +175,7 @@ export class Accordion extends React.Component {
168175
item={item}
169176
expanded={this.state.selected === index}
170177
index={index}
171-
setSelected={this.setSelected.bind(this)}
178+
setSelected={i => this.setSelected(i)}
172179
headerStyle={this.props.headerStyle}
173180
contentStyle={this.props.contentStyle}
174181
renderHeader={this.props.renderHeader}

0 commit comments

Comments
 (0)