Skip to content

Commit

Permalink
chore: update dev deps & fix eslint (#2561)
Browse files Browse the repository at this point in the history
## Description

This PR bumps RN developement version in the library from 0.72 to 0.76 &
updates eslint configuration & few other development packages. Please
note the changes in gesture-handler related types from Screen Transition
API.

These changes are motivated by the fact that I've recently bumped
versions of language servers in my editor & eslint language server
started throwing errors in our example apps (when editing `apps/**`
files) that is does not know anything about `@react-native` config we
try to extend in `apps/.eslintrc.js`. This makes absolute sense, as it
had tried to found the `@react-native` config with "standard module
resolution algorithm", and there were no node_modules containing the
config above `apps` directory. During fixing this I've also noticed
errors in configuration of our root-level `.eslintrc` file.

I've decided to fix this and bump dependencies, so that my eyes don't
hurt from red screen when developing.

## Changes

☝🏻 

I've also described important changes in "review" below 👇🏻 

## Test code and steps to reproduce

I've modified only development dependencies, therefore behaviour for
end-user should not change in any way. Our apps should now work & eslint
config should be improved.

## Checklist

- [ ] Ensured that CI passes
  • Loading branch information
kkafar authored Dec 9, 2024
1 parent 20808ee commit d9dfe1a
Show file tree
Hide file tree
Showing 10 changed files with 4,249 additions and 3,914 deletions.
10 changes: 1 addition & 9 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,10 @@
module.exports = {
extends: [
'@react-native',
'standard',
'plugin:import/errors',
'plugin:import/warnings',
'plugin:react/recommended',
'prettier',
],

plugins: ['react-native', 'react-hooks'],

env: {
'react-native/react-native': true,
},
Expand Down Expand Up @@ -43,10 +39,6 @@ module.exports = {
},

overrides: [
{
files: ['*.{js,jsx}'],
parser: 'babel-eslint',
},
{
files: ['*.{ts,tsx}'],
parser: '@typescript-eslint/parser',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ public void setProperty(T view, String propName, @Nullable Object value) {
}

@Override
public void receiveCommand(T view, String commandName, ReadableArray args) {
public void receiveCommand(T view, String commandName, @Nullable ReadableArray args) {
switch (commandName) {
case "blur":
mViewManager.blur(view);
Expand Down
2 changes: 1 addition & 1 deletion babel.config.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module.exports = {
presets: ['module:metro-react-native-babel-preset'],
presets: ['module:@react-native/babel-preset'],
};
27 changes: 12 additions & 15 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -75,11 +75,15 @@
"react-native": "*"
},
"devDependencies": {
"@babel/core": "^7.20.0",
"@babel/core": "^7.25.2",
"@babel/eslint-parser": "7.22.15",
"@react-native-community/cli": "^11.3.6",
"@react-native-community/cli-platform-android": "^11.3.6",
"@react-native-community/cli-platform-ios": "^11.3.6",
"@react-native-community/cli": "15.0.1",
"@react-native-community/cli-platform-android": "15.0.1",
"@react-native-community/cli-platform-ios": "15.0.1",
"@react-native/babel-preset": "0.76.4",
"@react-native/eslint-config": "0.76.4",
"@react-native/metro-config": "0.76.4",
"@react-native/typescript-config": "0.76.4",
"@react-navigation/native": "^5.8.0",
"@react-navigation/stack": "^5.10.0",
"@types/jest": "^29.3.1",
Expand All @@ -89,24 +93,20 @@
"@typescript-eslint/parser": "^6.5.0",
"babel-jest": "^29.6.4",
"clang-format": "^1.8.0",
"eslint": "^8.19.0",
"eslint": "^8.56.0",
"eslint-config-prettier": "^8.10.0",
"eslint-config-standard": "^17.1.0",
"eslint-plugin-import": "^2.28.1",
"eslint-plugin-jest": "^27.2.3",
"eslint-plugin-jest": "^27.9.0",
"eslint-plugin-n": "^16.0.2",
"eslint-plugin-promise": "^6.1.1",
"eslint-plugin-react": "^7.33.2",
"eslint-plugin-react-hooks": "^4.6.0",
"eslint-plugin-react-native": "^4.0.0",
"husky": "^8.0.3",
"jest": "^29.3.1",
"jest": "^29.6.3",
"lint-staged": "^14.0.1",
"metro-react-native-babel-preset": "^0.76.8",
"prettier": "^2.8.8",
"react": "18.2.0",
"react-dom": "^18.2.0",
"react-native": "0.72.4",
"react-native": "0.76.4",
"react-native-builder-bob": "^0.23.2",
"react-native-gesture-handler": "^2.13.3",
"react-native-reanimated": "3.9.0-nightly-20240402-12717cdb5",
Expand All @@ -117,9 +117,6 @@
"typescript": "5.4.3"
},
"resolutions": {
"@react-native-community/cli-platform-android": "^11.3.6",
"@react-native-community/cli": "^11.3.6",
"@react-native-community/cli-platform-ios": "^11.3.6",
"@types/react": "^18.2.72"
},
"lint-staged": {
Expand Down
3 changes: 1 addition & 2 deletions src/components/DebugContainer.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import * as React from 'react';
import { Platform, type ViewProps } from 'react-native';
// @ts-expect-error importing private component
// eslint-disable-next-line import/namespace, import/default, import/no-named-as-default, import/no-named-as-default-member

import AppContainer from 'react-native/Libraries/ReactNative/AppContainer';
import ScreenContentWrapper from './ScreenContentWrapper';
import { StackPresentationTypes } from '../types';
Expand All @@ -21,7 +21,6 @@ let DebugContainer: React.ComponentType<ContainerProps> = props => {
};

if (process.env.NODE_ENV !== 'production') {
// eslint-disable-next-line react/display-name
DebugContainer = (props: ContainerProps) => {
const { stackPresentation, ...rest } = props;

Expand Down
1 change: 0 additions & 1 deletion src/fabric/NativeScreensModule.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
'use client';

/* eslint-disable @typescript-eslint/ban-types */
import type { TurboModule } from 'react-native';
import { TurboModuleRegistry } from 'react-native';

Expand Down
8 changes: 8 additions & 0 deletions src/gesture-handler/defaults.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import {
GestureUpdateEvent,
PanGestureHandlerEventPayload,
PointerType,
} from 'react-native-gesture-handler';
import { ScreenTransition } from 'react-native-reanimated';

Expand All @@ -16,6 +17,13 @@ export const DefaultEvent: GestureUpdateEvent<PanGestureHandlerEventPayload> = {
velocityY: 0,
x: 0,
y: 0,

// These two were added in recent versions of gesture handler
// and they are required to specify. This should be backward
// compatible unless they strictly parse the objects, which seems
// not likely. PointerType is present since 2.16.0, StylusData since 2.20.0
pointerType: PointerType.TOUCH,
stylusData: undefined,
};

export const DefaultScreenDimensions = {
Expand Down
2 changes: 1 addition & 1 deletion src/native-stack/views/FontProcessor.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// @ts-ignore: No declaration available
// eslint-disable-next-line import/no-named-as-default, import/default, import/no-named-as-default-member, import/namespace

import ReactNativeStyleAttributes from 'react-native/Libraries/Components/View/ReactNativeStyleAttributes';

export function processFonts(
Expand Down
2 changes: 1 addition & 1 deletion src/native-stack/views/NativeStackView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {
ViewStyle,
} from 'react-native';
// @ts-ignore Getting private component
// eslint-disable-next-line import/no-named-as-default, import/default, import/no-named-as-default-member, import/namespace

import AppContainer from 'react-native/Libraries/ReactNative/AppContainer';
import warnOnce from 'warn-once';
import { StackPresentationTypes, ScreensRefsHolder } from '../../types';
Expand Down
Loading

0 comments on commit d9dfe1a

Please sign in to comment.