Skip to content

Commit 091c846

Browse files
committed
Fix lint issues
1 parent 5d0c823 commit 091c846

File tree

40 files changed

+334
-321
lines changed

40 files changed

+334
-321
lines changed

src/commons/__tests__/modifiers.spec.js

Lines changed: 22 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -45,19 +45,18 @@ describe('Modifiers', () => {
4545
expect(uut.extractTypographyValue({
4646
text40: true,
4747
text70: false
48-
}),).toEqual(Typography.text40);
48+
})).toEqual(Typography.text40);
4949
});
5050

5151
it('should prioritize last typography modifier prop in case there is more than one', () => {
5252
expect(uut.extractTypographyValue({
5353
text40: true,
5454
text70: true
55-
}),).toEqual(Typography.text70);
55+
})).toEqual(Typography.text70);
5656
expect(uut.extractTypographyValue({
5757
text70: true,
5858
text40: true
59-
}),).toEqual(Typography.text40);
60-
59+
})).toEqual(Typography.text40);
6160
});
6261

6362
it('should return value of the custom made typography', () => {
@@ -67,17 +66,20 @@ describe('Modifiers', () => {
6766
expect(uut.extractTypographyValue({
6867
text40: true,
6968
customTypography: true
70-
}),).toEqual({...Typography.text40, ...customTypography});
69+
})).toEqual({...Typography.text40, ...customTypography});
7170
expect(uut.extractTypographyValue({
7271
customTypography: true,
7372
text40: true
74-
}),).toEqual({...customTypography, ...Typography.text40});
73+
})).toEqual({...customTypography, ...Typography.text40});
7574
});
7675

7776
it('should merge typography modifiers', () => {
7877
const bold = {fontWeight: 'bold'};
7978
Typography.loadTypographies({bold});
80-
expect(uut.extractTypographyValue({text70: true, bold: true})).toEqual({...Typography.text70, fontWeight: 'bold'});
79+
expect(uut.extractTypographyValue({text70: true, bold: true})).toEqual({
80+
...Typography.text70,
81+
fontWeight: 'bold'
82+
});
8183
});
8284
});
8385

@@ -91,7 +93,7 @@ describe('Modifiers', () => {
9193
'paddingB-15': true,
9294
'paddingH-20': true,
9395
'paddingV-15': true
94-
}),).toEqual({
96+
})).toEqual({
9597
padding: 25,
9698
paddingLeft: 15,
9799
paddingTop: 10,
@@ -125,7 +127,7 @@ describe('Modifiers', () => {
125127
'marginB-15': true,
126128
'marginH-20': true,
127129
'marginV-15': true
128-
}),).toEqual({
130+
})).toEqual({
129131
margin: 25,
130132
marginLeft: 15,
131133
marginTop: 10,
@@ -221,7 +223,13 @@ describe('Modifiers', () => {
221223
expect(uut.extractPositionStyle({abs: true})).toEqual({position: 'absolute'});
222224
});
223225
it('should return absolute fill object style', () => {
224-
expect(uut.extractPositionStyle({absF: true})).toEqual({position: 'absolute', top: 0, left: 0, right: 0, bottom: 0});
226+
expect(uut.extractPositionStyle({absF: true})).toEqual({
227+
position: 'absolute',
228+
top: 0,
229+
left: 0,
230+
right: 0,
231+
bottom: 0
232+
});
225233
});
226234
it('should return absolute with top value', () => {
227235
expect(uut.extractPositionStyle({absT: true})).toEqual({position: 'absolute', top: 0});
@@ -241,7 +249,6 @@ describe('Modifiers', () => {
241249
it('should return absolute with horizontal values', () => {
242250
expect(uut.extractPositionStyle({absH: true})).toEqual({position: 'absolute', left: 0, right: 0});
243251
});
244-
245252
});
246253

247254
describe('extractFlexStyle - flex modifier', () => {
@@ -299,7 +306,7 @@ describe('Modifiers', () => {
299306
'paddingL-20': true,
300307
'bg-red30': true,
301308
other: 'some-value'
302-
}),).toEqual({
309+
})).toEqual({
303310
'paddingL-20': true,
304311
'bg-red30': true
305312
});
@@ -308,7 +315,7 @@ describe('Modifiers', () => {
308315
'margin-50': true,
309316
'background-blue20': true,
310317
other: 'some-value'
311-
}),).toEqual({
318+
})).toEqual({
312319
'margin-50': true,
313320
'background-blue20': true
314321
});
@@ -364,9 +371,9 @@ describe('Modifiers', () => {
364371
expect(uut.getThemeProps.call(SampleComponent, {test: true})).toEqual({prop1: 'yes', test: true});
365372
expect(uut.getThemeProps.call(SampleComponent, {test: false})).toEqual({prop1: 'no', test: false});
366373
});
367-
374+
368375
it('should prioritize forced theme props over user props', () => {
369-
ThemeManager.setComponentForcedTheme('SampleComponent', (props) => ({foo: 'forced'}));
376+
ThemeManager.setComponentForcedTheme('SampleComponent', () => ({foo: 'forced'}));
370377
expect(uut.getThemeProps.call(SampleComponent, {foo: 'user-value', other: 'other'})).toEqual({
371378
foo: 'forced',
372379
other: 'other'

src/commons/asBaseComponent.tsx

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import React from 'react';
2-
import _ from 'lodash';
32
//@ts-ignore
43
import hoistStatics from 'hoist-non-react-statics';
54
//@ts-ignore
@@ -17,7 +16,7 @@ export interface BaseComponentInjectedProps {
1716
// TODO: find a proper way to inject this type in the private repo
1817
type ThemeComponent = {
1918
useCustomTheme?: boolean;
20-
}
19+
};
2120

2221
function asBaseComponent<PROPS, STATICS = {}>(WrappedComponent: React.ComponentType<any>): React.ComponentClass<PROPS & ThemeComponent> & STATICS {
2322
class BaseComponent extends UIComponent {
@@ -31,7 +30,7 @@ function asBaseComponent<PROPS, STATICS = {}>(WrappedComponent: React.ComponentT
3130

3231
static getThemeProps = (props: any, context: any) => {
3332
return Modifiers.getThemeProps.call(WrappedComponent, props, context);
34-
}
33+
};
3534

3635
static getDerivedStateFromError(error: any) {
3736
UIComponent.defaultProps?.onError(error, WrappedComponent.defaultProps);
@@ -46,9 +45,9 @@ function asBaseComponent<PROPS, STATICS = {}>(WrappedComponent: React.ComponentT
4645
const {forwardedRef, ...others} = themeProps;
4746
return (
4847
(this.state.error && UIComponent.defaultProps?.renderError) || (
49-
<WrappedComponent {...others} modifiers={modifiers} ref={forwardedRef} />
48+
<WrappedComponent {...others} modifiers={modifiers} ref={forwardedRef}/>
5049
)
51-
)
50+
);
5251
}
5352
}
5453

src/commons/baseComponent.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ export default function baseComponent(usePure) {
7474
extractContainerStyle(props) {
7575
let containerStyle = {};
7676
if (props.containerStyle) {
77-
containerStyle = _.pickBy(props.containerStyle, (value, key) => {
77+
containerStyle = _.pickBy(props.containerStyle, (_value, key) => {
7878
return key.includes('margin') || _.includes(['alignSelf', 'transform'], key);
7979
});
8080
}

src/commons/modifiers.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,7 @@ export function extractFlexStyle(props: Dictionary<any>): Partial<Record<NativeF
245245
const keys = Object.keys(props);
246246
const flexProp = keys.find(item => FLEX_KEY_PATTERN.test(item));
247247
if (flexProp && props[flexProp] === true) {
248-
let [flexKey, flexValue] = flexProp.split('-') as [keyof typeof STYLE_KEY_CONVERTERS, string];
248+
const [flexKey, flexValue] = flexProp.split('-') as [keyof typeof STYLE_KEY_CONVERTERS, string];
249249
const convertedFlexKey = STYLE_KEY_CONVERTERS[flexKey];
250250
const flexValueAsNumber = _.isEmpty(flexValue) ? 1 : Number(flexValue);
251251

src/components/KeyboardAwareScrollView/KeyboardAwareBase.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ export default class KeyboardAwareBase extends Component {
100100
_scrollToFocusedTextInput() {
101101
if (this.props.getTextInputRefs) {
102102
const textInputRefs = this.props.getTextInputRefs();
103-
textInputRefs.some((textInputRef, index, array) => {
103+
textInputRefs.some((textInputRef) => {
104104
const isFocusedFunc = textInputRef.isFocused();
105105
const isFocused = isFocusedFunc && typeof isFocusedFunc === 'function' ? isFocusedFunc() : isFocusedFunc;
106106
if (isFocused) {
@@ -132,7 +132,7 @@ export default class KeyboardAwareBase extends Component {
132132
}
133133
}
134134

135-
_onKeyboardWillHide(event) {
135+
_onKeyboardWillHide() {
136136
const keyboardHeight = this.state.keyboardHeight;
137137
this.setState({keyboardHeight: 0});
138138

src/components/actionBar/index.tsx

Lines changed: 30 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
11
import _ from 'lodash';
2-
import React, { Component } from 'react';
2+
import React, {Component} from 'react';
33
import {StyleSheet, ViewStyle} from 'react-native';
44
import {Colors, Shadows} from '../../style';
55
import {asBaseComponent} from '../../commons/new';
66
import View from '../view';
77
import Button, {ButtonProps} from '../button';
88

9-
109
/**
1110
* @description: Quick actions bar, each action support Button component props
1211
* @modifiers: margin, padding
@@ -15,34 +14,34 @@ import Button, {ButtonProps} from '../button';
1514
*/
1615

1716
export type ActionBarProps = {
18-
/**
19-
* action bar height
20-
*/
21-
height?: number;
22-
/**
23-
* action bar background color
24-
*/
25-
backgroundColor?: string;
26-
/**
27-
* actions for the action bar
28-
*/
29-
actions: ButtonProps[];
30-
/**
31-
* should action be equally centered
32-
*/
33-
centered?: boolean;
34-
/**
35-
* use safe area, in case action bar attached to the bottom (default: true)
36-
*/
37-
useSafeArea?: boolean;
38-
/**
39-
* keep the action bar position relative instead of it absolute position
40-
*/
41-
keepRelative?: boolean;
42-
/**
43-
* style the action bar
44-
*/
45-
style?: ViewStyle;
17+
/**
18+
* action bar height
19+
*/
20+
height?: number;
21+
/**
22+
* action bar background color
23+
*/
24+
backgroundColor?: string;
25+
/**
26+
* actions for the action bar
27+
*/
28+
actions: ButtonProps[];
29+
/**
30+
* should action be equally centered
31+
*/
32+
centered?: boolean;
33+
/**
34+
* use safe area, in case action bar attached to the bottom (default: true)
35+
*/
36+
useSafeArea?: boolean;
37+
/**
38+
* keep the action bar position relative instead of it absolute position
39+
*/
40+
keepRelative?: boolean;
41+
/**
42+
* style the action bar
43+
*/
44+
style?: ViewStyle;
4645
};
4746

4847
class ActionBar extends Component<ActionBarProps> {
@@ -54,10 +53,6 @@ class ActionBar extends Component<ActionBarProps> {
5453
useSafeArea: true
5554
};
5655

57-
constructor(props: ActionBarProps) {
58-
super(props);
59-
}
60-
6156
styles = createStyles(this.props);
6257

6358
getAlignment(actionIndex: number) {
@@ -90,7 +85,7 @@ class ActionBar extends Component<ActionBarProps> {
9085

9186
export default asBaseComponent<ActionBarProps>(ActionBar);
9287

93-
function createStyles({height, backgroundColor} : any) {
88+
function createStyles({height, backgroundColor}: any) {
9489
return StyleSheet.create({
9590
container: {
9691
height

src/components/actionSheet/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ export default class ActionSheet extends BaseComponent {
161161

162162
renderActions() {
163163
const {title, options, cancelButtonIndex, renderAction, optionsStyle} = this.props;
164-
const optionsToRender = _.filter(options, (option, index) => index !== cancelButtonIndex);
164+
const optionsToRender = _.filter(options, (_option, index) => index !== cancelButtonIndex);
165165

166166
return (
167167
<View style={[_.isEmpty(title) ? styles.listNoTitle : styles.listWithTitle, optionsStyle]}>

0 commit comments

Comments
 (0)