Skip to content

Commit

Permalink
[eslint-config] bump dependencies and minimum required lint tools ver…
Browse files Browse the repository at this point in the history
…sions (expo#13858)

Co-authored-by: James Ide <[email protected]>
  • Loading branch information
Simek and ide authored Aug 27, 2021
1 parent 3bbce7c commit 6da1532
Show file tree
Hide file tree
Showing 101 changed files with 873 additions and 731 deletions.
15 changes: 12 additions & 3 deletions .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,23 @@

# Autogenerated files

**/.expo/**
**/.next/**
**/__generated__/**
**/build/**

# Git submodules

/react-native-lab/react-native/**
/docs/react-native-website/**

# Other

/android/**
/fastlane/**
/ios/**
**/android/**
**/assets/**
**/bin/**
**/fastlane/**
**/ios/**
**/providers/**
**/vendored/**
/docs/public/static/**
3 changes: 2 additions & 1 deletion apps/native-component-list/plugins/withDevMenu.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ const withDevMenu = config => {
}

// Make the extraModules mutable
const modulesRegex = /NSArray<id<RCTBridgeModule>>\s?\*extraModules\s?=\s?\[_moduleRegistryAdapter extraModulesForBridge:bridge\];/;
const modulesRegex =
/NSArray<id<RCTBridgeModule>>\s?\*extraModules\s?=\s?\[_moduleRegistryAdapter extraModulesForBridge:bridge\];/;
if (contents.match(modulesRegex)) {
contents = contents.replace(
modulesRegex,
Expand Down
3 changes: 2 additions & 1 deletion apps/native-component-list/plugins/withExpoAsyncStorage.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ const withExpoAsyncStorage = config => {
}

// Make the extraModules mutable
const modulesRegex = /NSArray<id<RCTBridgeModule>>\s?\*extraModules\s?=\s?\[_moduleRegistryAdapter extraModulesForBridge:bridge\];/;
const modulesRegex =
/NSArray<id<RCTBridgeModule>>\s?\*extraModules\s?=\s?\[_moduleRegistryAdapter extraModulesForBridge:bridge\];/;
if (contents.match(modulesRegex)) {
contents = contents.replace(
modulesRegex,
Expand Down
52 changes: 25 additions & 27 deletions apps/native-component-list/src/components/Face.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,33 +4,31 @@ import { StyleSheet, Text, View } from 'react-native';

const landmarkSize = 2;

export const scaledFace = (scale: number) => ({
faceID,
bounds,
rollAngle,
yawAngle,
}: FaceFeature) => (
<View
key={faceID}
style={[
styles.face,
{
width: bounds.size.width * scale,
height: bounds.size.height * scale,
left: bounds.origin.x * scale,
top: bounds.origin.y * scale,
transform: [
{ perspective: 600 },
{ rotateZ: `${rollAngle!.toFixed(0)}deg` },
{ rotateY: `${yawAngle!.toFixed(0)}deg` },
],
},
]}>
<Text style={styles.faceText}>ID: {faceID}</Text>
<Text style={styles.faceText}>rollAngle: {rollAngle!.toFixed(0)}</Text>
<Text style={styles.faceText}>yawAngle: {yawAngle!.toFixed(0)}</Text>
</View>
);
export const scaledFace =
(scale: number) =>
({ faceID, bounds, rollAngle, yawAngle }: FaceFeature) =>
(
<View
key={faceID}
style={[
styles.face,
{
width: bounds.size.width * scale,
height: bounds.size.height * scale,
left: bounds.origin.x * scale,
top: bounds.origin.y * scale,
transform: [
{ perspective: 600 },
{ rotateZ: `${rollAngle!.toFixed(0)}deg` },
{ rotateY: `${yawAngle!.toFixed(0)}deg` },
],
},
]}>
<Text style={styles.faceText}>ID: {faceID}</Text>
<Text style={styles.faceText}>rollAngle: {rollAngle!.toFixed(0)}</Text>
<Text style={styles.faceText}>yawAngle: {yawAngle!.toFixed(0)}</Text>
</View>
);

export const scaledLandmarks = (scale: number) => (face: FaceFeature) => {
const renderLandmark = (position?: { x: number; y: number }) =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@ import {
} from 'react-native';

const googleIcon = {
uri:
'https://upload.wikimedia.org/wikipedia/commons/thumb/5/53/Google_%22G%22_Logo.svg/200px-Google_%22G%22_Logo.svg.png',
uri: 'https://upload.wikimedia.org/wikipedia/commons/thumb/5/53/Google_%22G%22_Logo.svg/200px-Google_%22G%22_Logo.svg.png',
};

export default class GoogleSignInButton extends React.PureComponent<{
Expand Down
21 changes: 8 additions & 13 deletions apps/native-component-list/src/screens/BatteryScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,14 @@ export default function BatteryScreen() {

React.useEffect(() => {
(async () => {
const [
isAvailable,
batteryLevel,
batteryState,
lowPowerMode,
batteryOptimizationState,
] = await Promise.all([
Battery.isAvailableAsync(),
Battery.getBatteryLevelAsync(),
Battery.getBatteryStateAsync(),
Battery.isLowPowerModeEnabledAsync(),
Battery.isBatteryOptimizationEnabledAsync(),
]);
const [isAvailable, batteryLevel, batteryState, lowPowerMode, batteryOptimizationState] =
await Promise.all([
Battery.isAvailableAsync(),
Battery.getBatteryLevelAsync(),
Battery.getBatteryStateAsync(),
Battery.isLowPowerModeEnabledAsync(),
Battery.isBatteryOptimizationEnabledAsync(),
]);

setIsAvailable(isAvailable || false);
setBatteryLevel(batteryLevel);
Expand Down
5 changes: 2 additions & 3 deletions apps/native-component-list/src/screens/BrightnessScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,8 @@ function BrightnessView() {
const [systemBrightness] = useResolvedValue(Brightness.getSystemBrightnessAsync);
const [sliderBrightness, setBrightness] = React.useState<Record<string, number>>({});

const [systemBrightnessPermissionGranted, setSystemBrightnessPermissionGranted] = React.useState(
false
);
const [systemBrightnessPermissionGranted, setSystemBrightnessPermissionGranted] =
React.useState(false);

React.useEffect(() => {
async function initialize() {
Expand Down
8 changes: 4 additions & 4 deletions apps/native-component-list/src/screens/CalendarsScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -97,10 +97,10 @@ export default class CalendarsScreen extends React.Component<
const calendarGranted = await this._askForCalendarPermissions();
const reminderGranted = await this._askForReminderPermissions();
if (calendarGranted && reminderGranted) {
const eventCalendars = ((await Calendar.getCalendarsAsync('event')) as unknown) as any[];
const reminderCalendars = (Platform.OS === 'ios'
? await Calendar.getCalendarsAsync('reminder')
: []) as any[];
const eventCalendars = (await Calendar.getCalendarsAsync('event')) as unknown as any[];
const reminderCalendars = (
Platform.OS === 'ios' ? await Calendar.getCalendarsAsync('reminder') : []
) as any[];
this.setState({ calendars: [...eventCalendars, ...reminderCalendars] });
}
};
Expand Down
4 changes: 1 addition & 3 deletions apps/native-component-list/src/screens/GL/GLWrap.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,7 @@ import { Colors } from '../../constants';
// eslint-disable-next-line @typescript-eslint/ban-types
export default <P extends { style?: StyleProp<ViewStyle> } = {}>(
title: string,
onContextCreate: (
gl: GL.ExpoWebGLRenderingContext
) => Promise<{
onContextCreate: (gl: GL.ExpoWebGLRenderingContext) => Promise<{
onLayout?: (event: LayoutChangeEvent) => void;
onTick?: (gl: GL.ExpoWebGLRenderingContext) => void;
} | void>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@ const images = {
uri_gif: { uri: 'https://docs.expo.io/static/images/flappy_03.gif' },
uri_ico: { uri: 'https://docs.expo.io/static/images/favicon.ico' },
uri_youtube_svg: {
uri:
'https://www.youtube.com/about/static/svgs/icons/brand-resources/YouTube-logo-full_color_light.svg?cache=72a5d9c',
uri: 'https://www.youtube.com/about/static/svgs/icons/brand-resources/YouTube-logo-full_color_light.svg?cache=72a5d9c',
},
};

Expand Down
4 changes: 1 addition & 3 deletions apps/native-component-list/src/screens/QRCodeScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,7 @@ function useCameraTypes(): CameraType[] | null {
return types;
}

function useToggleCameraType(
preferredInitialType: CameraType
): {
function useToggleCameraType(preferredInitialType: CameraType): {
// The current camera type, null when loading types.
type: CameraType | null;
// Available camera types, null when loading types.
Expand Down
16 changes: 2 additions & 14 deletions apps/native-component-list/src/screens/SVG/examples/Clipping.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,8 @@ import * as Svg from 'react-native-svg';

import Example from './Example';

const {
ClipPath,
Defs,
RadialGradient,
Stop,
Rect,
Text,
Ellipse,
G,
Polygon,
Path,
Circle,
Use,
} = Svg;
const { ClipPath, Defs, RadialGradient, Stop, Rect, Text, Ellipse, G, Polygon, Path, Circle, Use } =
Svg;

class ClipPathElement extends React.Component {
static title = 'Clip by set clip-path with a path data';
Expand Down

Large diffs are not rendered by default.

15 changes: 2 additions & 13 deletions apps/native-component-list/src/screens/SVG/examples/Reusable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,8 @@ import * as Svg from 'react-native-svg';

import Example from './Example';

const {
Defs,
G,
Path,
Use,
Symbol,
Circle,
ClipPath,
LinearGradient,
RadialGradient,
Stop,
Rect,
} = Svg;
const { Defs, G, Path, Use, Symbol, Circle, ClipPath, LinearGradient, RadialGradient, Stop, Rect } =
Svg;

class UseExample extends React.Component {
static title = 'Reuse svg code';
Expand Down
8 changes: 5 additions & 3 deletions apps/native-component-list/src/screens/TextToSpeechScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,11 @@ const EXAMPLES = [
{ language: 'en', text: 'Adam Perry ate a pear in pairs in Paris' },
];

const AmountControlButton: React.FunctionComponent<React.ComponentProps<typeof TouchableOpacity> & {
title: string;
}> = props => (
const AmountControlButton: React.FunctionComponent<
React.ComponentProps<typeof TouchableOpacity> & {
title: string;
}
> = props => (
<TouchableOpacity
disabled={props.disabled}
onPress={props.onPress}
Expand Down
2 changes: 1 addition & 1 deletion apps/native-component-list/src/screens/ViewShotScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ export default class ViewShotScreen extends React.Component<{}, State> {
handleScreenCapturePress = async () => {
if (Platform.OS === 'web') {
try {
const screenUri = await takeSnapshotAsync((undefined as unknown) as number, {
const screenUri = await takeSnapshotAsync(undefined as unknown as number, {
format: 'jpg',
quality: 0.8,
result: 'data-uri',
Expand Down
2 changes: 1 addition & 1 deletion docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@
"cross-env": "^5.2.0",
"danger": "^9.2.10",
"esbuild-loader": "^2.13.1",
"eslint": "^7.29.0",
"eslint": "^7.31.0",
"eslint-config-next": "^10.2.3",
"eslint-config-universe": "^7.0.1",
"eslint-plugin-lodash": "^7.2.0",
Expand Down
33 changes: 24 additions & 9 deletions docs/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -535,10 +535,10 @@
resolved "https://registry.yarnpkg.com/@emotion/weak-memoize/-/weak-memoize-0.2.5.tgz#8eed982e2ee6f7f4e44c253e12962980791efd46"
integrity sha512-6U71C2Wp7r5XtFtQzYrW5iKFT67OixrSxjI4MptCHzdSVlgabczzqLe0ZSgnub/5Kp4hSbpDB1tMytZY9pwxxA==

"@eslint/eslintrc@^0.4.2":
version "0.4.2"
resolved "https://registry.yarnpkg.com/@eslint/eslintrc/-/eslintrc-0.4.2.tgz#f63d0ef06f5c0c57d76c4ab5f63d3835c51b0179"
integrity sha512-8nmGq/4ycLpIwzvhI4tNDmQztZ8sp+hI7cyG8i1nQDhkAbRzHpXPidRAHlNvCZQpJTKw5ItIpMw9RSToGF00mg==
"@eslint/eslintrc@^0.4.3":
version "0.4.3"
resolved "https://registry.yarnpkg.com/@eslint/eslintrc/-/eslintrc-0.4.3.tgz#9e42981ef035beb3dd49add17acb96e8ff6f394c"
integrity sha512-J6KFFz5QCYUJq3pf0mjEcCJVERbzv71PUIDczuh9JkwGEzced6CO5ADLHB1rbf/+oPBtoPfMYNOpGDzCANlbXw==
dependencies:
ajv "^6.12.4"
debug "^4.1.1"
Expand Down Expand Up @@ -582,6 +582,20 @@
resolved "https://registry.yarnpkg.com/@hapi/hoek/-/hoek-9.1.1.tgz#9daf5745156fd84b8e9889a2dc721f0c58e894aa"
integrity sha512-CAEbWH7OIur6jEOzaai83jq3FmKmv4PmX1JYfs9IrYcGEVI/lyL1EXJGCj7eFVJ0bg5QR8LMxBlEtA+xKiLpFw==

"@humanwhocodes/config-array@^0.5.0":
version "0.5.0"
resolved "https://registry.yarnpkg.com/@humanwhocodes/config-array/-/config-array-0.5.0.tgz#1407967d4c6eecd7388f83acf1eaf4d0c6e58ef9"
integrity sha512-FagtKFz74XrTl7y6HCzQpwDfXP0yhxe9lHLD1UZxjvZIcbyRz8zTFF/yYNfSfzU414eDwZ1SrO0Qvtyf+wFMQg==
dependencies:
"@humanwhocodes/object-schema" "^1.2.0"
debug "^4.1.1"
minimatch "^3.0.4"

"@humanwhocodes/object-schema@^1.2.0":
version "1.2.0"
resolved "https://registry.yarnpkg.com/@humanwhocodes/object-schema/-/object-schema-1.2.0.tgz#87de7af9c231826fdd68ac7258f77c429e0e5fcf"
integrity sha512-wdppn25U8z/2yiaT6YGquE6X8sSv7hNMWSXYSSU1jGv/yd6XqjXgTDJ8KP4NgjTXfJ3GbRjeeb8RTV7a/VpM+w==

"@istanbuljs/load-nyc-config@^1.0.0":
version "1.1.0"
resolved "https://registry.yarnpkg.com/@istanbuljs/load-nyc-config/-/load-nyc-config-1.1.0.tgz#fd3db1d59ecf7cf121e80650bb86712f9b55eced"
Expand Down Expand Up @@ -3636,13 +3650,14 @@ eslint-visitor-keys@^2.0.0:
resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-2.0.0.tgz#21fdc8fbcd9c795cc0321f0563702095751511a8"
integrity sha512-QudtT6av5WXels9WjIM7qz1XD1cWGvX4gGXvp/zBn9nXG02D0utdU3Em2m/QjTnrsk6bBjmCygl3rmj118msQQ==

eslint@^7.29.0:
version "7.29.0"
resolved "https://registry.yarnpkg.com/eslint/-/eslint-7.29.0.tgz#ee2a7648f2e729485e4d0bd6383ec1deabc8b3c0"
integrity sha512-82G/JToB9qIy/ArBzIWG9xvvwL3R86AlCjtGw+A29OMZDqhTybz/MByORSukGxeI+YPCR4coYyITKk8BFH9nDA==
eslint@^7.31.0:
version "7.31.0"
resolved "https://registry.yarnpkg.com/eslint/-/eslint-7.31.0.tgz#f972b539424bf2604907a970860732c5d99d3aca"
integrity sha512-vafgJpSh2ia8tnTkNUkwxGmnumgckLh5aAbLa1xRmIn9+owi8qBNGKL+B881kNKNTy7FFqTEkpNkUvmw0n6PkA==
dependencies:
"@babel/code-frame" "7.12.11"
"@eslint/eslintrc" "^0.4.2"
"@eslint/eslintrc" "^0.4.3"
"@humanwhocodes/config-array" "^0.5.0"
ajv "^6.10.0"
chalk "^4.0.0"
cross-spawn "^7.0.2"
Expand Down
12 changes: 5 additions & 7 deletions home/api/ApolloClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,12 @@ const httpLink = new HttpLink({
uri: `${Config.api.origin}/--/graphql`,
});

const connectivityLink = setContext(
async (): Promise<any> => {
const isConnected = await Connectivity.isAvailableAsync();
if (!isConnected) {
throw new Error('No connection available');
}
const connectivityLink = setContext(async (): Promise<any> => {
const isConnected = await Connectivity.isAvailableAsync();
if (!isConnected) {
throw new Error('No connection available');
}
);
});

const authMiddlewareLink = setContext((): any => {
const { sessionSecret } = Store.getState().session;
Expand Down
8 changes: 2 additions & 6 deletions home/components/ListItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -125,9 +125,7 @@ export default class ListItem extends React.PureComponent<Props> {
{title}
</StyledText>
</View>
) : (
undefined
);
) : undefined;
}

private renderSubtitle() {
Expand All @@ -145,9 +143,7 @@ export default class ListItem extends React.PureComponent<Props> {
numberOfLines={title ? 1 : 2}>
{subtitle}
</Text>
) : (
undefined
);
) : undefined;
}

private renderCheck() {
Expand Down
3 changes: 1 addition & 2 deletions home/screens/AudioDiagnosticsScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,7 @@ export default function AudioDiagnosticsScreen() {
<AudioPlayer
isAudioEnabled={isAudioEnabled}
source={{
uri:
'https://p.scdn.co/mp3-preview/f7a8ab9c5768009b65a30e9162555e8f21046f46?cid=162b7dc01f3a4a2ca32ed3cec83d1e02',
uri: 'https://p.scdn.co/mp3-preview/f7a8ab9c5768009b65a30e9162555e8f21046f46?cid=162b7dc01f3a4a2ca32ed3cec83d1e02',
}}
/>
<StyledText style={[styles.title, { marginTop: 16 }]}>Audio Modes</StyledText>
Expand Down
2 changes: 1 addition & 1 deletion home/screens/LocationDiagnosticsScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ export default class LocationDiagnosticsScreen extends React.Component<Props, St
onAccuracyChange = () => {
const next = Location.Accuracy[this.state.accuracy + 1];
const accuracy = next
? ((Location.Accuracy[next as any] as any) as Location.Accuracy)
? (Location.Accuracy[next as any] as any as Location.Accuracy)
: Location.Accuracy.Lowest;

this.setState({ accuracy });
Expand Down
Loading

0 comments on commit 6da1532

Please sign in to comment.