Skip to content

Commit 16c08ae

Browse files
committed
chore: migrate RN config
1 parent 90fbd31 commit 16c08ae

9 files changed

Lines changed: 38 additions & 40 deletions

File tree

apps/RNApp/package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@
3333
"@react-native-community/cli-platform-android": "20.0.0",
3434
"@react-native-community/cli-platform-ios": "20.0.0",
3535
"@react-native/babel-preset": "0.82.1",
36-
"@react-native/eslint-config": "^0.83.1",
3736
"@react-native/metro-config": "0.82.1",
3837
"@react-native/typescript-config": "0.82.1",
3938
"@react-navigation/native": "^7.0.15",
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
import eslintRnConfig from '../../eslint.config.rn.mjs';
2+
3+
/** @type {import('eslint').Linter.Config[]} */
4+
export default eslintRnConfig;

apps/TesterIntegrated/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@
66
"start": "react-native start",
77
"build:tester-integrated:android": "cd kotlin && ./gradlew assembleDebug",
88
"build:tester-integrated:ios": "cd swift && xcodebuild -workspace SwiftExample.xcworkspace -scheme SwiftExample -configuration Release -sdk iphonesimulator build CODE_SIGNING_ALLOWED=NO -derivedDataPath ./build",
9-
"brownfield:codegen": "brownfield codegen"
9+
"brownfield:codegen": "brownfield codegen",
10+
"lint": "eslint ."
1011
},
1112
"dependencies": {
1213
"@callstack/brownie": "*",

eslint.config.base.mjs

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import eslintConfigPrettier from 'eslint-config-prettier';
33
import eslintPluginNodeImport from 'eslint-plugin-node-import';
44

55
/**
6-
* ESLint base configuration for JS/TS packages in the monorepo
6+
* ESLint base configuration shared for other re-usable configs
77
* @type {import('eslint').Linter.Config[]}
88
*/
99
export default [
@@ -19,20 +19,6 @@ export default [
1919
],
2020
},
2121

22-
// below: tseslint integration
23-
...tseslint.configs.recommended,
24-
{
25-
rules: {
26-
'@typescript-eslint/no-empty-object-type': [
27-
'error',
28-
{
29-
allowInterfaces: 'always',
30-
},
31-
],
32-
'@typescript-eslint/no-explicit-any': 'warn',
33-
},
34-
},
35-
3622
// below: prettier integration
3723
eslintConfigPrettier,
3824
{

eslint.config.rn.mjs

Lines changed: 4 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,28 @@
11
import globals from 'globals';
2-
import reactPlugin from 'eslint-plugin-react';
3-
import reactHooksPlugin from 'eslint-plugin-react-hooks';
2+
import { fixupConfigRules } from '@eslint/compat';
3+
import { FlatCompat } from '@eslint/eslintrc';
44

55
import baseEslintConfig from './eslint.config.base.mjs';
66

7+
const flatCompat = new FlatCompat();
8+
79
/**
810
* ESLint configuration for React Native packages in the monorepo
911
* @type {import('eslint').Linter.Config[]}
1012
*/
1113
export default [
1214
...fixupConfigRules(flatCompat.extends('@react-native/eslint-config')),
1315
...baseEslintConfig,
14-
1516
{
1617
languageOptions: {
1718
ecmaVersion: 'latest',
1819
sourceType: 'module',
1920
globals: {
2021
...globals.node,
2122
},
22-
parserOptions: {
23-
ecmaFeatures: {
24-
jsx: true,
25-
},
26-
},
27-
},
28-
plugins: {
29-
react: reactPlugin,
30-
'react-hooks': reactHooksPlugin,
31-
},
32-
settings: {
33-
react: {
34-
version: 'detect',
35-
},
3623
},
3724
rules: {
3825
'@typescript-eslint/no-require-imports': 'off',
39-
...reactHooksPlugin.configs.recommended.rules,
4026
},
4127
},
4228
];

package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@
3939
"devDependencies": {
4040
"@commitlint/cli": "^20.1.0",
4141
"@commitlint/config-conventional": "^20.0.0",
42+
"@eslint/compat": "^2.0.1",
43+
"@react-native/eslint-config": "^0.83.1",
4244
"babel-plugin-module-resolver": "5.0.2",
4345
"eslint": "^9.28.0",
4446
"eslint-config-prettier": "^10.1.8",

packages/brownie/package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,6 @@
7272
"@babel/preset-typescript": "^7.27.1",
7373
"@babel/runtime": "^7.25.0",
7474
"@react-native/babel-preset": "0.82.1",
75-
"@react-native/eslint-config": "^0.83.1",
7675
"@types/node": "^22.0.0",
7776
"@types/react": "^19.1.1",
7877
"eslint": "^9.28.0",

packages/react-native-brownfield/package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,6 @@
7171
"@babel/preset-env": "^7.25.3",
7272
"@babel/runtime": "^7.25.0",
7373
"@react-native/babel-preset": "0.82.1",
74-
"@react-native/eslint-config": "^0.83.1",
7574
"@types/jest": "^30.0.0",
7675
"@types/react": "^19.1.1",
7776
"eslint": "^9.28.0",

yarn.lock

Lines changed: 25 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1739,7 +1739,6 @@ __metadata:
17391739
"@react-native-community/cli-platform-android": "npm:20.0.0"
17401740
"@react-native-community/cli-platform-ios": "npm:20.0.0"
17411741
"@react-native/babel-preset": "npm:0.82.1"
1742-
"@react-native/eslint-config": "npm:^0.83.1"
17431742
"@react-native/metro-config": "npm:0.82.1"
17441743
"@react-native/new-app-screen": "npm:0.82.1"
17451744
"@react-native/typescript-config": "npm:0.82.1"
@@ -1776,6 +1775,8 @@ __metadata:
17761775
"@changesets/cli": "npm:^2.29.8"
17771776
"@commitlint/cli": "npm:^20.1.0"
17781777
"@commitlint/config-conventional": "npm:^20.0.0"
1778+
"@eslint/compat": "npm:^2.0.1"
1779+
"@react-native/eslint-config": "npm:^0.83.1"
17791780
babel-plugin-module-resolver: "npm:5.0.2"
17801781
eslint: "npm:^9.28.0"
17811782
eslint-config-prettier: "npm:^10.1.8"
@@ -1805,7 +1806,6 @@ __metadata:
18051806
"@babel/runtime": "npm:^7.25.0"
18061807
"@callstack/brownfield-cli": "workspace:^"
18071808
"@react-native/babel-preset": "npm:0.82.1"
1808-
"@react-native/eslint-config": "npm:^0.83.1"
18091809
"@types/node": "npm:^22.0.0"
18101810
"@types/react": "npm:^19.1.1"
18111811
eslint: "npm:^9.28.0"
@@ -1862,7 +1862,6 @@ __metadata:
18621862
"@babel/runtime": "npm:^7.25.0"
18631863
"@callstack/brownfield-cli": "workspace:^"
18641864
"@react-native/babel-preset": "npm:0.82.1"
1865-
"@react-native/eslint-config": "npm:^0.83.1"
18661865
"@types/jest": "npm:^30.0.0"
18671866
"@types/react": "npm:^19.1.1"
18681867
eslint: "npm:^9.28.0"
@@ -2609,6 +2608,20 @@ __metadata:
26092608
languageName: node
26102609
linkType: hard
26112610

2611+
"@eslint/compat@npm:^2.0.1":
2612+
version: 2.0.1
2613+
resolution: "@eslint/compat@npm:2.0.1"
2614+
dependencies:
2615+
"@eslint/core": "npm:^1.0.1"
2616+
peerDependencies:
2617+
eslint: ^8.40 || 9
2618+
peerDependenciesMeta:
2619+
eslint:
2620+
optional: true
2621+
checksum: 10/3ae4af6faba4a1191fc42f51675e1e8a78f9133e980133e2a6b86acd7d9d79bb8692afbeef283c4359a611874cd6bd4583464ae656f9a64d7dcecbbdb7afaa08
2622+
languageName: node
2623+
linkType: hard
2624+
26122625
"@eslint/config-array@npm:^0.21.1":
26132626
version: 0.21.1
26142627
resolution: "@eslint/config-array@npm:0.21.1"
@@ -2638,6 +2651,15 @@ __metadata:
26382651
languageName: node
26392652
linkType: hard
26402653

2654+
"@eslint/core@npm:^1.0.1":
2655+
version: 1.0.1
2656+
resolution: "@eslint/core@npm:1.0.1"
2657+
dependencies:
2658+
"@types/json-schema": "npm:^7.0.15"
2659+
checksum: 10/442b54d50adee1681672596abc538cba1a57d108d28e39aeed64e4beaee23aa6f9f029c7bc0b39e26d8c4754de16305fbfce7f6539e7df266163c0c49fbaa4af
2660+
languageName: node
2661+
linkType: hard
2662+
26412663
"@eslint/eslintrc@npm:^3.3.1":
26422664
version: 3.3.3
26432665
resolution: "@eslint/eslintrc@npm:3.3.3"

0 commit comments

Comments
 (0)