Update formatter and linter tools

This commit is contained in:
Nicolas Gallagher
2017-09-10 10:35:07 -07:00
parent d185d81560
commit a9f1afc07c
117 changed files with 536 additions and 495 deletions
+2 -2
View File
@@ -36,9 +36,9 @@ export function getApplication(RootComponent: ReactClass<Object>, initialProps:
<RootComponent {...initialProps} />
</AppContainer>
);
const stylesheets = StyleSheet.getStyleSheets().map(sheet =>
const stylesheets = StyleSheet.getStyleSheets().map(sheet => (
// ensure that CSS text is not escaped
<style dangerouslySetInnerHTML={{ __html: sheet.textContent }} id={sheet.id} />
);
));
return { element, stylesheets };
}
+3 -1
View File
@@ -29,6 +29,8 @@ const createDeclarationString = (prop, val) => {
* // => 'color:blue;width:20px'
*/
const generateCss = style =>
mapKeyValue(prefixStyles(style), createDeclarationString).sort().join(';');
mapKeyValue(prefixStyles(style), createDeclarationString)
.sort()
.join(';');
export default generateCss;
+1 -3
View File
@@ -43,9 +43,7 @@ class Button extends Component {
]}
testID={testID}
>
<Text style={[styles.text, disabled && styles.textDisabled]}>
{title}
</Text>
<Text style={[styles.text, disabled && styles.textDisabled]}>{title}</Text>
</TouchableOpacity>
);
}
+12 -2
View File
@@ -119,12 +119,22 @@ describe('components/Image', () => {
// initial render
const component = mount(<Image source={{ uri: uriOne }} />);
ImageUriCache.remove(uriOne);
expect(component.render().find('img').attr('src')).toBe(uriOne);
expect(
component
.render()
.find('img')
.attr('src')
).toBe(uriOne);
// props update
component.setProps({ source: { uri: uriTwo } });
ImageUriCache.remove(uriTwo);
expect(component.render().find('img').attr('src')).toBe(uriTwo);
expect(
component
.render()
.find('img')
.attr('src')
).toBe(uriTwo);
});
test('is set immediately when rendered on the server', () => {
+3 -1
View File
@@ -339,7 +339,9 @@ class TextInput extends Component {
if (e.shiftKey) {
keyValue = String.fromCharCode(e.which).trim();
} else {
keyValue = String.fromCharCode(e.which).toLowerCase().trim();
keyValue = String.fromCharCode(e.which)
.toLowerCase()
.trim();
}
}
}
+1 -5
View File
@@ -30,11 +30,7 @@ class UnimplementedView extends Component {
}
render() {
return (
<View style={[unimplementedViewStyles, this.props.style]}>
{this.props.children}
</View>
);
return <View style={[unimplementedViewStyles, this.props.style]}>{this.props.children}</View>;
}
}
+1 -5
View File
@@ -14,11 +14,7 @@ describe('components/View', () => {
test('prop "children"', () => {
const children = <View testID="1" />;
const component = shallow(
<View>
{children}
</View>
);
const component = shallow(<View>{children}</View>);
expect(component.contains(children)).toEqual(true);
});