issue #111 - update lint to ensure no improper trailing errors are in code

This commit is contained in:
Stanislav Miklik 2018-06-24 12:47:38 +02:00
parent 6b9672ff4e
commit 1409974686
31 changed files with 78 additions and 81 deletions

View File

@ -6,13 +6,10 @@
"sourceType": "module",
"ecmaFeatures": {
"jsx": true,
"modules": true,
"experimentalObjectRestSpread": true
"modules": true
}
},
"plugins": [
"react"
],
"plugins": ["react"],
"env": {
"node": true,
@ -22,7 +19,7 @@
"rules": {
"no-console": 0,
"comma-dangle": 0,
"comma-dangle": ["error", "always-multiline"],
"no-unused-vars": ["error", { "ignoreRestSiblings": true }],
"react/prop-types": 0,
"react/no-did-mount-set-state": 0,

View File

@ -4,7 +4,7 @@ const ReactNative = React;
ReactNative.StyleSheet = {
create: function create(styles) {
return styles;
}
},
};
class View extends React.Component {
@ -12,7 +12,7 @@ class View extends React.Component {
}
View.propTypes = {
style: () => null
style: () => null,
};
class ListView extends React.Component {
@ -28,7 +28,7 @@ class AppRegistry {
const Animated = {
timing: () => ({ start: () => undefined }),
Value: () => ({ interpolate: () => false }),
View: View
View: View,
};
const I18nManager = {

View File

@ -32,7 +32,7 @@ describe('Menu', () => {
},
menuActions: {
_notify: createSpy(),
}
},
}
}
@ -64,8 +64,8 @@ describe('Menu', () => {
expect(output.props.children[1]).toEqual(objectContaining({
type: MenuTrigger,
props: objectContaining({
onRef: any(Function)
})
onRef: any(Function),
}),
}));
expect(output.props.children[2]).toEqual(expectedChildren[3]);
});
@ -99,7 +99,7 @@ describe('Menu', () => {
]);
expect(output.props.children[0]).toEqual(
objectContaining({
type: MenuTrigger
type: MenuTrigger,
})
);
expect(output.props.children[1]).toEqual(expectedChildren[1]);

View File

@ -13,7 +13,7 @@ describe('MenuOption', () => {
menuActions: {
_getOpenedMenu: () => ({
optionsCustomStyles: optionsCustomStyles || {},
instance: { props: { onSelect: onSelect } }
instance: { props: { onSelect: onSelect } },
}),
closeMenu: closeMenu || createSpy(),
},

View File

@ -12,7 +12,7 @@ describe('MenuOptions', () => {
return {
menuActions: {
_getOpenedMenu: () => ({
instance: { getName: () => 'menu1' }
instance: { getName: () => 'menu1' },
}),
},
menuRegistry: {

View File

@ -18,8 +18,8 @@ jest.mock('../src/helpers', () => ({
x: 0,
y: 0,
width: 100,
height: 50
})
height: 50,
}),
}),
lo: x => x,
iterator2array: it => [...it],
@ -53,9 +53,9 @@ describe('MenuProvider', () => {
nativeEvent: {
layout: {
width: 400,
height: 600
}
}
height: 600,
},
},
};
let menu1;
@ -128,7 +128,7 @@ describe('MenuProvider', () => {
expect(placeholder.type).toEqual(MenuPlaceholder);
expect(components.props.children).toEqual([
<View />,
<Text>Some text</Text>
<Text>Some text</Text>,
]);
});
@ -227,16 +227,16 @@ describe('MenuProvider', () => {
nativeEvent: {
layout: {
width: 22,
height: 33
}
}
height: 33,
},
},
});
expect(menuRegistry.getMenu('menu1')).toEqual(objectContaining({
optionsLayout: {
width: 22,
isOutside: true,
height: 33
}
height: 33,
},
}));
});
});

View File

@ -23,12 +23,12 @@ describe('helpers test', () => {
it('should promisify measure callback', done => {
const ref = {
measure: callback => callback(0, 0, 100, 200, 50, 20)
measure: callback => callback(0, 0, 100, 200, 50, 20),
};
measure(ref).then(layout => {
expect(layout).to.be.an('object');
expect(layout).to.eql({
x: 50, y: 20, width: 100, height: 200
x: 50, y: 20, width: 100, height: 200,
});
done();
}).catch((err = 'promise rejected') => done(err));

View File

@ -41,7 +41,7 @@ Creates a mock of react instance
*/
export function mockReactInstance() {
const instance = {
state: {}
state: {},
};
instance.setState = (newState, after) => {
Object.assign(instance.state, newState);

View File

@ -24,7 +24,7 @@ describe('menuRegistry tests', () => {
describe('getMenu', () => {
it('should return menu', () => {
const menus = new Map([
['menu1', {instance: menu1}]
['menu1', {instance: menu1}],
]);
const registry = makeMenuRegistry(menus);
expect(registry.getMenu('menu1').instance).to.eql(menu1);
@ -43,7 +43,7 @@ describe('menuRegistry tests', () => {
it('should unsubscribe menu', () => {
const menus = new Map([
['menu1', {name:'menu1', instance: menu1}],
['menu2', {name:'menu2', instance: menu2}]
['menu2', {name:'menu2', instance: menu2}],
]);
const registry = makeMenuRegistry(menus);
registry.unsubscribe(menu1);
@ -109,7 +109,7 @@ describe('menuRegistry tests', () => {
it('should return all registered menus with its associated data', () => {
const menus = new Map([
['menu1', {name: 'menu1', instance: menu1}],
['menu2', {name: 'menu2', instance: menu2, triggerLayout: 5}]
['menu2', {name: 'menu2', instance: menu2, triggerLayout: 5}],
]);
const registry = makeMenuRegistry(menus);
const allMenus = registry.getAll();

View File

@ -25,7 +25,7 @@ describe('ContextMenu', () => {
expect(output.type).toEqual(Animated.View);
expect(output.props.children).toEqual([
<Text>Some text</Text>,
<Text>Other text</Text>
<Text>Other text</Text>,
]);
});
});
@ -40,7 +40,7 @@ describe('ContextMenu', () => {
const optionsLayout = { width: 50, height: 50 };
const layouts = { windowLayout, triggerLayout, optionsLayout };
expect(computePosition(layouts)).toEqual({
top: 100, left: 100
top: 100, left: 100,
});
});
@ -49,7 +49,7 @@ describe('ContextMenu', () => {
const optionsLayout = { width: 50, height: 50 };
const layouts = { windowLayout, triggerLayout, optionsLayout };
expect(computePosition(layouts)).toEqual({
top: 10, left: 10
top: 10, left: 10,
});
});
@ -58,7 +58,7 @@ describe('ContextMenu', () => {
const optionsLayout = { width: 150, height: 100 };
const layouts = { windowLayout, triggerLayout, optionsLayout };
expect(computePosition(layouts)).toEqual({
top: 0, left: 250
top: 0, left: 250,
});
});
@ -67,7 +67,7 @@ describe('ContextMenu', () => {
const optionsLayout = { width: 150, height: 150 };
const layouts = { windowLayout, triggerLayout, optionsLayout };
expect(computePosition(layouts)).toEqual({
top: 450, left: 10
top: 450, left: 10,
});
});
@ -76,7 +76,7 @@ describe('ContextMenu', () => {
const optionsLayout = { width: 150, height: 150 };
const layouts = { windowLayout, triggerLayout, optionsLayout };
expect(computePosition(layouts)).toEqual({
top: 450, left: 250
top: 450, left: 250,
});
});
@ -85,7 +85,7 @@ describe('ContextMenu', () => {
const optionsLayout = { width: 150, height: 500 };
const layouts = { windowLayout, triggerLayout, optionsLayout };
expect(computePosition(layouts)).toEqual({
top: 50, left: 10
top: 50, left: 10,
});
});
@ -94,7 +94,7 @@ describe('ContextMenu', () => {
const optionsLayout = { width: 300, height: 100 };
const layouts = { windowLayout, triggerLayout, optionsLayout };
expect(computePosition(layouts)).toEqual({
top: 10, left: 50
top: 10, left: 50,
});
});
@ -103,7 +103,7 @@ describe('ContextMenu', () => {
const optionsLayout = { width: 150, height: 700 };
const layouts = { windowLayout, triggerLayout, optionsLayout };
expect(computePosition(layouts)).toEqual({
top: 0, left: 10
top: 0, left: 10,
});
});
@ -112,7 +112,7 @@ describe('ContextMenu', () => {
const optionsLayout = { width: 500, height: 100 };
const layouts = { windowLayout, triggerLayout, optionsLayout };
expect(computePosition(layouts)).toEqual({
top: 10, left: 0
top: 10, left: 0,
});
});
@ -121,7 +121,7 @@ describe('ContextMenu', () => {
const optionsLayout = { width: 150, height: 500 };
const layouts = { windowLayout, triggerLayout, optionsLayout };
expect(computePosition(layouts)).toEqual({
top: 0, left: 10
top: 0, left: 10,
});
});
@ -130,7 +130,7 @@ describe('ContextMenu', () => {
const optionsLayout = { width: 150, height: 500 };
const layouts = { windowLayout, triggerLayout, optionsLayout };
expect(computePosition(layouts)).toEqual({
top: 100, left: 10
top: 100, left: 10,
});
});
@ -139,7 +139,7 @@ describe('ContextMenu', () => {
const optionsLayout = { width: 350, height: 50 };
const layouts = { windowLayout, triggerLayout, optionsLayout };
expect(computePosition(layouts)).toEqual({
top: 10, left: 0
top: 10, left: 0,
});
});
@ -149,7 +149,7 @@ describe('ContextMenu', () => {
const optionsLayout = { width: 50, height: 50 };
const layouts = { windowLayout, triggerLayout, optionsLayout };
expect(computePosition(layouts)).toEqual({
top: 70, left: 80
top: 70, left: 80,
});
});

View File

@ -24,7 +24,7 @@ describe('MenuOutside', () => {
expect(output.type).toEqual(View);
expect(output.props.children).toEqual([
<Text>Some text</Text>,
<Text>Other text</Text>
<Text>Other text</Text>,
]);
});
});
@ -34,7 +34,7 @@ describe('MenuOutside', () => {
const windowLayout = { width: 400, height: 600 };
const layouts = { windowLayout };
expect(computePosition(layouts)).toEqual({
top: 600, left: 400
top: 600, left: 400,
});
});
});

View File

@ -24,7 +24,7 @@ describe('NotAnimatedContextMenu', () => {
expect(output.type).toEqual(View);
expect(output.props.children).toEqual([
<Text>Some text</Text>,
<Text>Other text</Text>
<Text>Other text</Text>,
]);
});
});

View File

@ -28,7 +28,7 @@ describe('Popover', () => {
expect(content.type).toEqual(View);
expect(content.props.children).toEqual([
<Text>Some text</Text>,
<Text>Other text</Text>
<Text>Other text</Text>,
]);
});
});

View File

@ -22,7 +22,7 @@ describe('SlideInMenu', () => {
expect(output.type).toEqual(Animated.View);
expect(output.props.children).toEqual([
<Text>Some text</Text>,
<Text>Other text</Text>
<Text>Other text</Text>,
]);
});
@ -32,7 +32,7 @@ describe('SlideInMenu', () => {
const optionsLayout = { width: 400, height: 100 };
const layouts = { windowLayout, optionsLayout };
expect(computePosition(layouts)).toEqual({
top: 500, left: 0
top: 500, left: 0,
});
});
});

View File

@ -5,7 +5,7 @@ import {
MenuProvider,
MenuOptions,
MenuOption,
MenuTrigger
MenuTrigger,
} from 'react-native-popup-menu';
const BasicExample = () => (

View File

@ -5,7 +5,7 @@ import {
MenuProvider,
MenuOptions,
MenuOption,
MenuTrigger
MenuTrigger,
} from 'react-native-popup-menu';
class CloseOnBackExample extends Component {

View File

@ -4,7 +4,7 @@ import Menu, {
MenuProvider,
MenuOptions,
MenuOption,
MenuTrigger
MenuTrigger,
} from 'react-native-popup-menu';
export default class ControlledExample extends Component {

View File

@ -5,7 +5,7 @@ import Menu, {
MenuTrigger,
MenuOptions,
MenuOption,
renderers
renderers,
} from 'react-native-popup-menu';
let unique = 0;
@ -32,8 +32,8 @@ export default class Example extends Component {
this.setState({
log: [...this.state.log, {
value,
id: ++unique
}]
id: ++unique,
}],
});
}
@ -142,7 +142,7 @@ const styles = StyleSheet.create({
marginVertical: 5,
marginHorizontal: 2,
borderBottomWidth: 1,
borderColor: '#ccc'
borderColor: '#ccc',
},
logView: {
flex: 1,
@ -157,5 +157,5 @@ const styles = StyleSheet.create({
},
text: {
fontSize: 18,
}
},
});

View File

@ -4,7 +4,7 @@ import Menu, {
MenuProvider,
MenuOptions,
MenuOption,
MenuTrigger
MenuTrigger,
} from 'react-native-popup-menu';
class ModalExample extends Component {

View File

@ -1,10 +1,10 @@
import React from 'react';
import { Text, View, } from 'react-native';
import { Text, View } from 'react-native';
import Menu, {
MenuProvider,
MenuOptions,
MenuOption,
MenuTrigger
MenuTrigger,
} from 'react-native-popup-menu';
import {Scene, Router, Actions} from 'react-native-router-flux';

View File

@ -4,7 +4,7 @@ import Menu, {
MenuProvider,
MenuOptions,
MenuOption,
MenuTrigger
MenuTrigger,
} from 'react-native-popup-menu';
const NonRootExample = () => (

View File

@ -16,7 +16,7 @@ class TouchableExample extends React.Component {
constructor(props) {
super(props);
this.state = {
Touchable: Button
Touchable: Button,
};
}
@ -30,7 +30,7 @@ class TouchableExample extends React.Component {
<MenuTrigger
customStyles={{
TriggerTouchableComponent: Button,
triggerTouchable: { title: 'Select (Custom Touchables)' }
triggerTouchable: { title: 'Select (Custom Touchables)' },
}}
/>
<MenuOptions>
@ -54,7 +54,7 @@ class TouchableExample extends React.Component {
/>
<MenuOption customStyles={{
OptionTouchableComponent: Button,
optionTouchable: { title: 'Button' }
optionTouchable: { title: 'Button' },
}}
value={Button}
/>
@ -65,7 +65,7 @@ class TouchableExample extends React.Component {
<MenuTrigger
customStyles={{
TriggerTouchableComponent: Touchable,
triggerTouchable: { title: buttonText }
triggerTouchable: { title: buttonText },
}}
text={buttonText}
/>

View File

@ -7,6 +7,6 @@ require('jasmine-reporters');
const reporters = require('jasmine-reporters');
const junitReporter = new reporters.JUnitXmlReporter({
savePath: __dirname + '/target/',
consolidateAll: false
consolidateAll: false,
});
jasmine.getEnv().addReporter(junitReporter);

View File

@ -79,7 +79,7 @@ export class Menu extends Component {
r.push(React.cloneElement(child, {
key: null,
menuName: this._name,
onRef: (t => this._trigger = t)
onRef: (t => this._trigger = t),
}));
}
if (isRegularComponent(child)) {

View File

@ -43,5 +43,5 @@ const styles = StyleSheet.create({
left: 0,
right: 0,
bottom: 0,
}
},
});

View File

@ -8,7 +8,7 @@ export const measure = ref => new Promise((resolve) => {
ref.measure((x, y, width, height, pageX, pageY) => {
resolve({
x: pageX, y: pageY,
width, height
width, height,
})
});
});

View File

@ -53,7 +53,7 @@ export default class ContextMenu extends React.Component {
duration: OPEN_ANIM_DURATION,
toValue: 1,
easing: Easing.out(Easing.cubic),
useNativeDriver: true
useNativeDriver: true,
}).start();
}
@ -63,7 +63,7 @@ export default class ContextMenu extends React.Component {
duration: CLOSE_ANIM_DURATION,
toValue: 0,
easing: Easing.in(Easing.cubic),
useNativeDriver: true
useNativeDriver: true,
}).start(resolve);
});
}

View File

@ -3,7 +3,7 @@ import { View, StyleSheet } from 'react-native';
export const computePosition = ({ windowLayout }) => ({
top: windowLayout.height,
left: windowLayout.width
left: windowLayout.width,
});

View File

@ -235,7 +235,7 @@ export default class Popover extends React.Component {
anchorStyle,
preferredPlacement,
placement: userPlacement,
...other,
...other
} = this.props;
const isRTL = I18nManager.isRTL;
const animation = {

View File

@ -24,7 +24,7 @@ export default class SlideInMenu extends React.Component {
duration: OPEN_ANIM_DURATION,
toValue: 1,
easing: Easing.out(Easing.cubic),
useNativeDriver: true
useNativeDriver: true,
}).start();
}
@ -34,7 +34,7 @@ export default class SlideInMenu extends React.Component {
duration: CLOSE_ANIM_DURATION,
toValue: 0,
easing: Easing.in(Easing.cubic),
useNativeDriver: true
useNativeDriver: true,
}).start(resolve);
});
}
@ -47,9 +47,9 @@ export default class SlideInMenu extends React.Component {
transform: [{
translateY: this.state.slide.interpolate({
inputRange: [0, 1],
outputRange: [oHeight, 0]
outputRange: [oHeight, 0],
}),
}]
}],
};
const position = computePosition(layouts);
return (

View File

@ -11,7 +11,7 @@ export function withContext(Context, propName = "context") {
{value => {
const custom = {
[propName]: value,
ref: forwardedRef
ref: forwardedRef,
};
return <Component {...custom} {...rest} />;
}}