Skip to content

Commit

Permalink
Run lint:fix
Browse files Browse the repository at this point in the history
  • Loading branch information
KiwiKilian committed Apr 26, 2022
1 parent 1c1bda1 commit fb71420
Show file tree
Hide file tree
Showing 152 changed files with 1,334 additions and 1,117 deletions.
6 changes: 3 additions & 3 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,9 @@ module.exports = {
'no-underscore-dangle': [0],
'no-await-in-loop': 0,
'no-restricted-syntax': 0,
'no-use-before-define': ['error', {functions: false}],
'no-unused-expressions': ['error', {allowTaggedTemplates: true}],
'no-plusplus': ['error', {allowForLoopAfterthoughts: true}],
'no-use-before-define': ['error', { functions: false }],
'no-unused-expressions': ['error', { allowTaggedTemplates: true }],
'no-plusplus': ['error', { allowForLoopAfterthoughts: true }],
'fp/no-mutating-methods': 'warn',
},
overrides: [
Expand Down
2 changes: 1 addition & 1 deletion __tests__/__mocks__/react-native.mock.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
jest.mock('react-native/Libraries/Image/resolveAssetSource', () => {
return () => ({uri: 'asset://test.png'});
return () => ({ uri: 'asset://test.png' });
});

jest.mock('react-native/Libraries/EventEmitter/NativeEventEmitter', () => {
Expand Down
14 changes: 7 additions & 7 deletions __tests__/components/BackgroundLayer.test.js
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
import React from 'react';
import {render} from '@testing-library/react-native';
import { render } from '@testing-library/react-native';

import BackgroundLayer from '../../javascript/components/BackgroundLayer';

export const NATIVE_MODULE_NAME = 'RCTMGLBackgroundLayer';

describe('BackgroundLayer', () => {
test('renders correctly with default props', () => {
const {queryByTestId} = render(
const { queryByTestId } = render(
<BackgroundLayer id="requiredBackgroundLayerID" />,
);

const backgroundLayer = queryByTestId('rctmglBackgroundLayer');
const {props} = backgroundLayer;
const { props } = backgroundLayer;

expect(props.sourceID).toStrictEqual('DefaultSourceID');
});
Expand All @@ -28,12 +28,12 @@ describe('BackgroundLayer', () => {
filter: ['==', 'arbitraryFilter', true],
minZoomLevel: 3,
maxZoomLevel: 8,
style: {visibility: 'none'},
style: { visibility: 'none' },
};

const {queryByTestId} = render(<BackgroundLayer {...testProps} />);
const { queryByTestId } = render(<BackgroundLayer {...testProps} />);
const backgroundLayer = queryByTestId('rctmglBackgroundLayer');
const {props} = backgroundLayer;
const { props } = backgroundLayer;

expect(props.id).toStrictEqual(testProps.id);
expect(props.sourceID).toStrictEqual(testProps.sourceID);
Expand All @@ -47,7 +47,7 @@ describe('BackgroundLayer', () => {
expect(props.reactStyle).toStrictEqual({
visibility: {
styletype: 'constant',
stylevalue: {type: 'string', value: testProps.style.visibility},
stylevalue: { type: 'string', value: testProps.style.visibility },
},
});
});
Expand Down
28 changes: 14 additions & 14 deletions __tests__/components/Callout.test.js
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
import React from 'react';
import {render} from '@testing-library/react-native';
import {Text, View} from 'react-native';
import { render } from '@testing-library/react-native';
import { Text, View } from 'react-native';

import Callout from '../../javascript/components/Callout';

describe('Callout', () => {
test('renders with custom title', () => {
const testTitle = 'test title';
const {getByText} = render(<Callout {...{title: testTitle}} />);
const { getByText } = render(<Callout {...{ title: testTitle }} />);

expect(getByText(testTitle)).toBeDefined();
});

describe('_renderDefaultCallout', () => {
test('renders default children', () => {
const {UNSAFE_getByType, UNSAFE_getAllByType} = render(<Callout />);
const { UNSAFE_getByType, UNSAFE_getAllByType } = render(<Callout />);
const callout = UNSAFE_getByType('RCTMGLCallout');

expect(callout).toBeDefined();
Expand All @@ -24,13 +24,13 @@ describe('Callout', () => {

test('renders with custom styles', () => {
const testProps = {
style: {height: 1},
containerStyle: {height: 2},
contentStyle: {height: 3},
tipStyle: {height: 4},
textStyle: {height: 5},
style: { height: 1 },
containerStyle: { height: 2 },
contentStyle: { height: 3 },
tipStyle: { height: 4 },
textStyle: { height: 5 },
};
const {UNSAFE_getByType, UNSAFE_getAllByType} = render(
const { UNSAFE_getByType, UNSAFE_getAllByType } = render(
<Callout {...testProps} />,
);

Expand All @@ -56,7 +56,7 @@ describe('Callout', () => {

describe('_renderCustomCallout', () => {
test('renders custom children', () => {
const {getByTestId, UNSAFE_queryByType} = render(
const { getByTestId, UNSAFE_queryByType } = render(
<Callout>
<View testID="TestChild">{'Foo Bar'}</View>
</Callout>,
Expand All @@ -68,10 +68,10 @@ describe('Callout', () => {

test('renders with custom styles', () => {
const testProps = {
style: {width: 1},
containerStyle: {width: 2},
style: { width: 1 },
containerStyle: { width: 2 },
};
const {UNSAFE_getByType, UNSAFE_getAllByType} = render(
const { UNSAFE_getByType, UNSAFE_getAllByType } = render(
<Callout {...testProps}>
<View>{'Foo Bar'}</View>
</Callout>,
Expand Down
38 changes: 19 additions & 19 deletions __tests__/components/Camera.test.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';
import {render} from '@testing-library/react-native';
import { render } from '@testing-library/react-native';

import Camera from '../../javascript/components/Camera';

Expand Down Expand Up @@ -53,13 +53,13 @@ const cameraWithBounds = {
describe('Camera', () => {
describe('render', () => {
test('renders correctly', () => {
const {getByTestId} = render(<Camera />);
const { getByTestId } = render(<Camera />);

expect(getByTestId('Camera')).toBeDefined();
});

test('has proper default props', () => {
const {getByTestId} = render(<Camera />);
const { getByTestId } = render(<Camera />);

expect(getByTestId('Camera').props).toStrictEqual({
children: undefined,
Expand Down Expand Up @@ -200,7 +200,7 @@ describe('Camera', () => {
expect(camera._setCamera).toHaveBeenCalledWith({
animationDuration: 2000,
animationMode: 'easeTo',
bounds: {ne: [-74.12641, 40.797968], sw: [-74.143727, 40.772177]},
bounds: { ne: [-74.12641, 40.797968], sw: [-74.143727, 40.772177] },
heading: undefined,
pitch: undefined,
zoomLevel: undefined,
Expand Down Expand Up @@ -231,7 +231,7 @@ describe('Camera', () => {

test('returns true if "hasDefaultPropsChanged"', () => {
const testCases = [
[{heading: 120}, {heading: 121}],
[{ heading: 120 }, { heading: 121 }],
[
{
centerCoordinate: [-111.8678, 40.2866],
Expand Down Expand Up @@ -281,32 +281,32 @@ describe('Camera', () => {
],
];

testCases.forEach(c => {
testCases.forEach((c) => {
expect(camera._hasCameraChanged(c[0], c[1])).toBe(true);
});
});

test('returns true if "hasFollowPropsChanged"', () => {
const testCases = [
[{followUserLocation: false}, {followUserLocation: true}],
[{followUserMode: 'normal'}, {followUserMode: 'course'}],
[{followZoomLevel: 10}, {followZoomLevel: 13}],
[{followHeading: 100}, {followHeading: 110}],
[{followPitch: 40}, {followPitch: 49}],
[{ followUserLocation: false }, { followUserLocation: true }],
[{ followUserMode: 'normal' }, { followUserMode: 'course' }],
[{ followZoomLevel: 10 }, { followZoomLevel: 13 }],
[{ followHeading: 100 }, { followHeading: 110 }],
[{ followPitch: 40 }, { followPitch: 49 }],
];

testCases.forEach(c => {
testCases.forEach((c) => {
expect(camera._hasCameraChanged(c[0], c[1])).toBe(true);
});
});

test('returns true if "hasAnimationPropsChanged"', () => {
const testCases = [
[{animationDuration: 3000}, {animationDuration: 1000}],
[{animationMode: 'flyTo'}, {animationMode: 'easeTo'}],
[{ animationDuration: 3000 }, { animationDuration: 1000 }],
[{ animationMode: 'flyTo' }, { animationMode: 'easeTo' }],
];

testCases.forEach(c => {
testCases.forEach((c) => {
expect(camera._hasCameraChanged(c[0], c[1])).toBe(true);
});
});
Expand Down Expand Up @@ -1027,7 +1027,7 @@ describe('Camera', () => {
// with centerCoordinate
expect(
camera._createStopConfig(
{...configWithoutBounds, centerCoordinate: [-111.8678, 40.2866]},
{ ...configWithoutBounds, centerCoordinate: [-111.8678, 40.2866] },
true,
),
).toStrictEqual({
Expand Down Expand Up @@ -1067,7 +1067,7 @@ describe('Camera', () => {
// with centerCoordinate
expect(
camera._createStopConfig(
{...configWithBounds, centerCoordinate: [-111.8678, 40.2866]},
{ ...configWithBounds, centerCoordinate: [-111.8678, 40.2866] },
true,
),
).toStrictEqual({
Expand All @@ -1093,13 +1093,13 @@ describe('Camera', () => {

test('returns "Flight" for "flyTo"', () => {
expect(
camera._getNativeCameraMode({animationMode: 'flyTo'}),
camera._getNativeCameraMode({ animationMode: 'flyTo' }),
).toStrictEqual('Flight');
});

test('returns "None" for "moveTo"', () => {
expect(
camera._getNativeCameraMode({animationMode: 'moveTo'}),
camera._getNativeCameraMode({ animationMode: 'moveTo' }),
).toStrictEqual('Move');
});

Expand Down
16 changes: 9 additions & 7 deletions __tests__/components/CircleLayer.test.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
import React from 'react';
import {render} from '@testing-library/react-native';
import { render } from '@testing-library/react-native';

import CircleLayer from '../../javascript/components/CircleLayer';

describe('CircleLayer', () => {
test('renders correctly with default props', () => {
const {queryByTestId} = render(<CircleLayer id="requiredCircleLayerID" />);
const { queryByTestId } = render(
<CircleLayer id="requiredCircleLayerID" />,
);
const circleLayer = queryByTestId('rctmglCircleLayer');
const {props} = circleLayer;
const { props } = circleLayer;

expect(props.sourceID).toStrictEqual('DefaultSourceID');
});
Expand All @@ -23,12 +25,12 @@ describe('CircleLayer', () => {
filter: ['==', 'arbitraryFilter', true],
minZoomLevel: 3,
maxZoomLevel: 8,
style: {visibility: 'none'},
style: { visibility: 'none' },
};

const {queryByTestId} = render(<CircleLayer {...customProps} />);
const { queryByTestId } = render(<CircleLayer {...customProps} />);
const circleLayer = queryByTestId('rctmglCircleLayer');
const {props} = circleLayer;
const { props } = circleLayer;

expect(props.id).toStrictEqual(customProps.id);
expect(props.sourceID).toStrictEqual(customProps.sourceID);
Expand All @@ -42,7 +44,7 @@ describe('CircleLayer', () => {
expect(props.reactStyle).toStrictEqual({
visibility: {
styletype: 'constant',
stylevalue: {type: 'string', value: customProps.style.visibility},
stylevalue: { type: 'string', value: customProps.style.visibility },
},
});
});
Expand Down
14 changes: 7 additions & 7 deletions __tests__/components/HeatmapLayer.test.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import React from 'react';
import {render} from '@testing-library/react-native';
import { render } from '@testing-library/react-native';

import HeatmapLayer from '../../javascript/components/HeatmapLayer';

describe('HeatmapLayer', () => {
test('renders correctly with default props', () => {
const {UNSAFE_getByType} = render(
const { UNSAFE_getByType } = render(
<HeatmapLayer id="requiredHeatmapLayerID" />,
);
const heatmapLayer = UNSAFE_getByType('RCTMGLHeatmapLayer');
const {props} = heatmapLayer;
const { props } = heatmapLayer;
expect(props.sourceID).toStrictEqual('DefaultSourceID');
});

Expand All @@ -24,10 +24,10 @@ describe('HeatmapLayer', () => {
filter: ['==', 'arbitraryFilter', true],
minZoomLevel: 3,
maxZoomLevel: 8,
style: {visibility: 'none'},
style: { visibility: 'none' },
};
const {UNSAFE_getByType} = render(<HeatmapLayer {...testProps} />);
const {props} = UNSAFE_getByType('RCTMGLHeatmapLayer');
const { UNSAFE_getByType } = render(<HeatmapLayer {...testProps} />);
const { props } = UNSAFE_getByType('RCTMGLHeatmapLayer');

expect(props.id).toStrictEqual(testProps.id);
expect(props.sourceID).toStrictEqual(testProps.sourceID);
Expand All @@ -41,7 +41,7 @@ describe('HeatmapLayer', () => {
expect(props.reactStyle).toStrictEqual({
visibility: {
styletype: 'constant',
stylevalue: {type: 'string', value: testProps.style.visibility},
stylevalue: { type: 'string', value: testProps.style.visibility },
},
});
});
Expand Down
14 changes: 7 additions & 7 deletions __tests__/components/Light.test.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import React from 'react';
import {render} from '@testing-library/react-native';
import { render } from '@testing-library/react-native';

import Light from '../../javascript/components/Light';

export const NATIVE_MODULE_NAME = 'RCTMGLLight';

describe('Light', () => {
test('renders correctly', () => {
const {queryByTestId} = render(<Light />);
const { queryByTestId } = render(<Light />);
const light = queryByTestId('rctmglLight');
expect(light).toBeDefined();
});
Expand All @@ -21,13 +21,13 @@ describe('Light', () => {
};
const processedTestColor = 4294574080;

const {queryByTestId} = render(<Light style={testStyles} />);
const { queryByTestId } = render(<Light style={testStyles} />);

const customStyles = queryByTestId('rctmglLight').props.reactStyle;
const {anchor} = customStyles;
const {color} = customStyles;
const {position} = customStyles;
const {intensity} = customStyles;
const { anchor } = customStyles;
const { color } = customStyles;
const { position } = customStyles;
const { intensity } = customStyles;

expect(anchor.stylevalue.value).toStrictEqual(testStyles.anchor);
expect(color.stylevalue.value).toStrictEqual(processedTestColor);
Expand Down
4 changes: 2 additions & 2 deletions __tests__/components/MapView.test.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import * as React from 'react';
import {render} from '@testing-library/react-native';
import { render } from '@testing-library/react-native';

import MapView from '../../javascript/components/MapView';

describe('MapView', () => {
test('renders with testID', () => {
const expectedTestId = 'im used for identification in tests';

const {getByTestId} = render(<MapView testID={expectedTestId} />);
const { getByTestId } = render(<MapView testID={expectedTestId} />);

expect(() => {
getByTestId(expectedTestId);
Expand Down
Loading

0 comments on commit fb71420

Please sign in to comment.