Skip to content

Commit

Permalink
Merge pull request #217 from Skyscanner/bpk-964-eslint-again
Browse files Browse the repository at this point in the history
[BPK-964] eslint upgrades
  • Loading branch information
shaundon authored Oct 25, 2017
2 parents 86ff571 + cd10e24 commit f711d34
Show file tree
Hide file tree
Showing 175 changed files with 1,121 additions and 865 deletions.
26 changes: 25 additions & 1 deletion .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,30 @@
"max-len": [2, 120],
"react/jsx-filename-extension": 0,
"import/no-extraneous-dependencies": 0,
"react/prefer-stateless-function": [2, { "ignorePureComponents": true }]
"react/prefer-stateless-function": [2, { "ignorePureComponents": true }],

// We've decided we don't want this for now as it makes writing JSX more painful.
// See https://github.com/airbnb/javascript/issues/1584#issuecomment-335667272
"function-paren-newline": 0,

// False positive on custom propTypes + isRequired. https://github.com/yannickcr/eslint-plugin-react/issues/1389
"react/no-typos": 0,

// See https://github.com/evcohen/eslint-plugin-jsx-a11y/issues/339
"jsx-a11y/anchor-is-valid": ["error", {
"components": ["Link"],
"specialLink": ["to"],
"aspects": ["noHref", "invalidHref", "preferButton"],
}],

// See https://github.com/evcohen/eslint-plugin-jsx-a11y/issues/282
// We should probably change our code to adhere to the standard here.
"jsx-a11y/label-has-for": [ 2, {
"components": [ "Label" ],
"required": {
"some": [ "nesting", "id" ]
},
"allowChildren": false
}]
}
}
6 changes: 5 additions & 1 deletion changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,11 @@ _Nothing Yet_

**Added:**
- react-native-bpk-component-button: react-native-bpk-component-button: 4.1.0 => 4.2.0
- Add Android support
- Add Android support

**Fixed:**
- bpk-component-nudger:
- Removed redundant `role="alert"` from nudger input

## 2017-10-20 - Icon support for native buttons and focused prop for native cards

Expand Down
10 changes: 10 additions & 0 deletions native/package-lock.json

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

Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ const commonTests = () => {
Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean
commodo ligula eget dolor. Aenean massa. Cum sociis natoque penatibus
et magnis dis parturient montes, nascetur ridiculus mus.
</BpkText>
</BpkText>
);

it('should render correctly collapsed', () => {
Expand Down Expand Up @@ -59,7 +59,7 @@ const commonTests = () => {
{animateHeightContent}
{animateHeightContent}
</BpkAnimateHeight>,
).toJSON();
).toJSON();
expect(tree).toMatchSnapshot();
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ class BpkAnimateHeight extends React.Component {
}

BpkAnimateHeight.propTypes = {
animationDuration: PropTypes.number.isRequired,
animationDuration: PropTypes.number,
expanded: PropTypes.bool.isRequired,
children: PropTypes.node.isRequired,
style: ViewPropTypes.style,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,11 +98,11 @@ AnimateHeightDemo.defaultProps = {
};

storiesOf('BpkAnimateHeight', module)
.addDecorator(getStory =>
.addDecorator(getStory => (
<View style={styles.centered}>
{getStory()}
</View>,
)
</View>
))
.add('docs:default', () => (
<AnimateHeightDemo>{animateHeightContent}</AnimateHeightDemo>
));
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
* limitations under the License.
*/

import BpkBannerAlert, { ALERT_TYPES } from './src/BpkBannerAlert';
import BpkBannerAlert, { ALERT_TYPES } from './src/BpkBannerAlert';

export default BpkBannerAlert;
export { ALERT_TYPES };
export default BpkBannerAlert;
export { ALERT_TYPES };
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ import commonTests from './BpkBannerAlert-test.common';
jest.mock('react-native', () => {
const reactNative = require.requireActual('react-native');
jest
.spyOn(reactNative.Platform, 'select')
.mockImplementation(obj => obj.android || obj.default);
.spyOn(reactNative.Platform, 'select')
.mockImplementation(obj => obj.android || obj.default);
reactNative.Platform.OS = 'android';

return reactNative;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ const commonTests = () => {
message="Error alert."
/>
</View>,
).toJSON();
).toJSON();
expect(tree).toMatchSnapshot();
});

Expand Down Expand Up @@ -72,7 +72,7 @@ const commonTests = () => {
dismissable
/>
</View>,
).toJSON();
).toJSON();
expect(tree).toMatchSnapshot();
});

Expand All @@ -89,7 +89,7 @@ const commonTests = () => {
Pellentesque nec diam nec erat condimentum dapibus.
Nunc diam augue, egestas id egestas ut, facilisis nec mi. Donec et congue odio, nec laoreet est.
Integer rhoncus varius arcu, a fringilla libero laoreet at.
</BpkText>
</BpkText>
</BpkBannerAlert>
<BpkBannerAlert
type={ALERT_TYPES.SUCCESS}
Expand All @@ -101,7 +101,7 @@ const commonTests = () => {
Pellentesque nec diam nec erat condimentum dapibus.
Nunc diam augue, egestas id egestas ut, facilisis nec mi. Donec et congue odio, nec laoreet est.
Integer rhoncus varius arcu, a fringilla libero laoreet at.
</BpkText>
</BpkText>
</BpkBannerAlert>
<BpkBannerAlert
type={ALERT_TYPES.WARN}
Expand All @@ -113,7 +113,7 @@ const commonTests = () => {
Pellentesque nec diam nec erat condimentum dapibus.
Nunc diam augue, egestas id egestas ut, facilisis nec mi. Donec et congue odio, nec laoreet est.
Integer rhoncus varius arcu, a fringilla libero laoreet at.
</BpkText>
</BpkText>
</BpkBannerAlert>
<BpkBannerAlert
type={ALERT_TYPES.ERROR}
Expand All @@ -125,10 +125,10 @@ const commonTests = () => {
Pellentesque nec diam nec erat condimentum dapibus.
Nunc diam augue, egestas id egestas ut, facilisis nec mi. Donec et congue odio, nec laoreet est.
Integer rhoncus varius arcu, a fringilla libero laoreet at.
</BpkText>
</BpkText>
</BpkBannerAlert>
</View>,
).toJSON();
).toJSON();
expect(tree).toMatchSnapshot();
});

Expand All @@ -146,7 +146,7 @@ const commonTests = () => {
Pellentesque nec diam nec erat condimentum dapibus.
Nunc diam augue, egestas id egestas ut, facilisis nec mi. Donec et congue odio, nec laoreet est.
Integer rhoncus varius arcu, a fringilla libero laoreet at.
</BpkText>
</BpkText>
</BpkBannerAlert>
<BpkBannerAlert
type={ALERT_TYPES.SUCCESS}
Expand All @@ -159,7 +159,7 @@ const commonTests = () => {
Pellentesque nec diam nec erat condimentum dapibus.
Nunc diam augue, egestas id egestas ut, facilisis nec mi. Donec et congue odio, nec laoreet est.
Integer rhoncus varius arcu, a fringilla libero laoreet at.
</BpkText>
</BpkText>
</BpkBannerAlert>
<BpkBannerAlert
type={ALERT_TYPES.WARN}
Expand All @@ -172,7 +172,7 @@ const commonTests = () => {
Pellentesque nec diam nec erat condimentum dapibus.
Nunc diam augue, egestas id egestas ut, facilisis nec mi. Donec et congue odio, nec laoreet est.
Integer rhoncus varius arcu, a fringilla libero laoreet at.
</BpkText>
</BpkText>
</BpkBannerAlert>
<BpkBannerAlert
type={ALERT_TYPES.ERROR}
Expand All @@ -185,10 +185,10 @@ const commonTests = () => {
Pellentesque nec diam nec erat condimentum dapibus.
Nunc diam augue, egestas id egestas ut, facilisis nec mi. Donec et congue odio, nec laoreet est.
Integer rhoncus varius arcu, a fringilla libero laoreet at.
</BpkText>
</BpkText>
</BpkBannerAlert>
</View>,
).toJSON();
).toJSON();
expect(tree).toMatchSnapshot();
});

Expand All @@ -206,7 +206,7 @@ const commonTests = () => {
Pellentesque nec diam nec erat condimentum dapibus.
Nunc diam augue, egestas id egestas ut, facilisis nec mi. Donec et congue odio, nec laoreet est.
Integer rhoncus varius arcu, a fringilla libero laoreet at.
</BpkText>
</BpkText>
</BpkBannerAlert>
<BpkBannerAlert
type={ALERT_TYPES.SUCCESS}
Expand All @@ -219,7 +219,7 @@ const commonTests = () => {
Pellentesque nec diam nec erat condimentum dapibus.
Nunc diam augue, egestas id egestas ut, facilisis nec mi. Donec et congue odio, nec laoreet est.
Integer rhoncus varius arcu, a fringilla libero laoreet at.
</BpkText>
</BpkText>
</BpkBannerAlert>
<BpkBannerAlert
type={ALERT_TYPES.WARN}
Expand All @@ -232,7 +232,7 @@ const commonTests = () => {
Pellentesque nec diam nec erat condimentum dapibus.
Nunc diam augue, egestas id egestas ut, facilisis nec mi. Donec et congue odio, nec laoreet est.
Integer rhoncus varius arcu, a fringilla libero laoreet at.
</BpkText>
</BpkText>
</BpkBannerAlert>
<BpkBannerAlert
type={ALERT_TYPES.ERROR}
Expand All @@ -245,10 +245,10 @@ const commonTests = () => {
Pellentesque nec diam nec erat condimentum dapibus.
Nunc diam augue, egestas id egestas ut, facilisis nec mi. Donec et congue odio, nec laoreet est.
Integer rhoncus varius arcu, a fringilla libero laoreet at.
</BpkText>
</BpkText>
</BpkBannerAlert>
</View>,
).toJSON();
).toJSON();
expect(tree).toMatchSnapshot();
});

Expand Down Expand Up @@ -276,7 +276,7 @@ const commonTests = () => {
message="Error alert."
/>
</View>,
).toJSON();
).toJSON();
expect(tree).toMatchSnapshot();
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ import commonTests from './BpkBannerAlert-test.common';
jest.mock('react-native', () => {
const reactNative = require.requireActual('react-native');
jest
.spyOn(reactNative.Platform, 'select')
.mockImplementation(obj => obj.ios || obj.default);
.spyOn(reactNative.Platform, 'select')
.mockImplementation(obj => obj.ios || obj.default);
reactNative.Platform.OS = 'ios';

return reactNative;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,9 @@ const styles = StyleSheet.create({
});

const BpkBannerAlert = (props) => {
const { type, message, onAction, dismissable, expanded, actionButtonLabel, style, children, ...rest } = props;
const {
type, message, onAction, dismissable, expanded, actionButtonLabel, style, children, ...rest
} = props;

const expandable = children !== null;

Expand Down Expand Up @@ -239,20 +241,19 @@ const BpkBannerAlert = (props) => {
>
{actionComponent}
</TouchableHighlight>
);
);

const contentPaddedStyle = [styles.bannerContainerPadded];
if (dismissable) {
contentPaddedStyle.push(styles.bannerContainerPaddedDismissable);
}

let banner = (<View
style={[contentPaddedStyle]}
>
{iconComponent}
{textComponent}
{expandable && actionComponent}
</View>
let banner = (
<View style={[contentPaddedStyle]}>
{iconComponent}
{textComponent}
{expandable && actionComponent}
</View>
);

if (expandable) {
Expand Down
Loading

0 comments on commit f711d34

Please sign in to comment.