Skip to content

Commit c59e569

Browse files
authored
chore: ESLint overhaul (#186)
* chore: upgrade to ESLint v9, re-use repo-wide configuration * refactor: comply with eslint rules * chore: add import ordering and prefer node imports to eslint config * refactor: fix eslint problems in project files * chore: migrate RN config * refactor: comply with eslint rules * chore: update yarn.lock
1 parent a75d5b2 commit c59e569

37 files changed

Lines changed: 712 additions & 301 deletions

.eslintrc.json

Lines changed: 0 additions & 6 deletions
This file was deleted.

apps/RNApp/.eslintrc.json

Lines changed: 0 additions & 5 deletions
This file was deleted.

apps/RNApp/eslint.config.mjs

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/RNApp/metro.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1+
const path = require('node:path');
12
const { getDefaultConfig, mergeConfig } = require('@react-native/metro-config');
2-
const path = require('path');
33

44
const root = path.resolve(__dirname, '..', '..');
55

apps/RNApp/package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,9 @@
4040
"@types/jest": "^29.5.13",
4141
"@types/react": "^19.1.1",
4242
"@types/react-test-renderer": "^19.1.0",
43-
"eslint": "^8.19.0",
43+
"eslint": "^9.28.0",
44+
"globals": "^16.2.0",
45+
"import": "^0.0.6",
4446
"jest": "^29.6.3",
4547
"prettier": "2.8.8",
4648
"react-native-safe-area-context": "^5.3.0",

apps/RNApp/react-native.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
const path = require('path');
1+
const path = require('node:path');
22
const pkg = require('../../packages/react-native-brownfield/package.json');
33

44
module.exports = {

apps/TesterIntegrated/App.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
1+
import { useStore } from '@callstack/brownie';
12
import { useEffect } from 'react';
3+
import './BrownfieldStore.brownie';
24
import { StyleSheet, Text, View, Button, TextInput } from 'react-native';
3-
import { useStore } from '@callstack/brownie';
5+
46
import {
57
createNativeStackNavigator,
68
type NativeStackScreenProps,
79
} from '@react-navigation/native-stack';
810
import ReactNativeBrownfield from '@callstack/react-native-brownfield';
911
import { NavigationContainer } from '@react-navigation/native';
10-
import './BrownfieldStore.brownie';
1112

1213
const getRandomValue = () => Math.round(Math.random() * 255);
1314
const getRandomTheme = () => {
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/metro.config.cjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
const path = require('path');
1+
const path = require('node:path');
22
const { getDefaultConfig } = require('@react-native/metro-config'); // Import from `@expo/metro-config` if using Expo CLI
33
const { withMetroConfig } = require('react-native-monorepo-config');
44

apps/TesterIntegrated/package.json

Lines changed: 3 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": "*",
@@ -30,6 +31,7 @@
3031
"@react-native/metro-config": "0.82.1",
3132
"@react-native/typescript-config": "0.82.1",
3233
"@types/react": "^19.1.1",
34+
"eslint": "^9.28.0",
3335
"react-native-monorepo-config": "^0.3.1"
3436
},
3537
"engines": {

0 commit comments

Comments
 (0)