Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 0 additions & 6 deletions .eslintrc.json

This file was deleted.

5 changes: 0 additions & 5 deletions apps/RNApp/.eslintrc.json

This file was deleted.

4 changes: 4 additions & 0 deletions apps/RNApp/eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import eslintRnConfig from '../../eslint.config.rn.mjs';

/** @type {import('eslint').Linter.Config[]} */
export default eslintRnConfig;
2 changes: 1 addition & 1 deletion apps/RNApp/metro.config.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const path = require('node:path');
const { getDefaultConfig, mergeConfig } = require('@react-native/metro-config');
const path = require('path');

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

Expand Down
4 changes: 3 additions & 1 deletion apps/RNApp/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,9 @@
"@types/jest": "^29.5.13",
"@types/react": "^19.1.1",
"@types/react-test-renderer": "^19.1.0",
"eslint": "^8.19.0",
"eslint": "^9.28.0",
"globals": "^16.2.0",
"import": "^0.0.6",
"jest": "^29.6.3",
"prettier": "2.8.8",
"react-native-safe-area-context": "^5.3.0",
Expand Down
2 changes: 1 addition & 1 deletion apps/RNApp/react-native.config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const path = require('path');
const path = require('node:path');
const pkg = require('../../packages/react-native-brownfield/package.json');

module.exports = {
Expand Down
5 changes: 3 additions & 2 deletions apps/TesterIntegrated/App.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
import { useStore } from '@callstack/brownie';
import { useEffect } from 'react';
import './BrownfieldStore.brownie';
import { StyleSheet, Text, View, Button, TextInput } from 'react-native';
import { useStore } from '@callstack/brownie';

import {
createNativeStackNavigator,
type NativeStackScreenProps,
} from '@react-navigation/native-stack';
import ReactNativeBrownfield from '@callstack/react-native-brownfield';
import { NavigationContainer } from '@react-navigation/native';
import './BrownfieldStore.brownie';

const getRandomValue = () => Math.round(Math.random() * 255);
const getRandomTheme = () => {
Expand Down
4 changes: 4 additions & 0 deletions apps/TesterIntegrated/eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import eslintRnConfig from '../../eslint.config.rn.mjs';

/** @type {import('eslint').Linter.Config[]} */
export default eslintRnConfig;
2 changes: 1 addition & 1 deletion apps/TesterIntegrated/metro.config.cjs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const path = require('path');
const path = require('node:path');
const { getDefaultConfig } = require('@react-native/metro-config'); // Import from `@expo/metro-config` if using Expo CLI
const { withMetroConfig } = require('react-native-monorepo-config');

Expand Down
4 changes: 3 additions & 1 deletion apps/TesterIntegrated/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
"start": "react-native start",
"build:tester-integrated:android": "cd kotlin && ./gradlew assembleDebug",
"build:tester-integrated:ios": "cd swift && xcodebuild -workspace SwiftExample.xcworkspace -scheme SwiftExample -configuration Release -sdk iphonesimulator build CODE_SIGNING_ALLOWED=NO -derivedDataPath ./build",
"brownfield:codegen": "brownfield codegen"
"brownfield:codegen": "brownfield codegen",
"lint": "eslint ."
},
"dependencies": {
"@callstack/brownie": "*",
Expand All @@ -30,6 +31,7 @@
"@react-native/metro-config": "0.82.1",
"@react-native/typescript-config": "0.82.1",
"@types/react": "^19.1.1",
"eslint": "^9.28.0",
"react-native-monorepo-config": "^0.3.1"
},
"engines": {
Expand Down
2 changes: 1 addition & 1 deletion apps/TesterIntegrated/react-native.config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const path = require('path');
const path = require('node:path');
const brownfieldPkg = require('../../packages/react-native-brownfield/package.json');
const browniePkg = require('../../packages/brownie/package.json');

Expand Down
42 changes: 42 additions & 0 deletions eslint.config.base.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
import prettier from 'eslint-plugin-prettier';
import eslintConfigPrettier from 'eslint-config-prettier';
import eslintPluginNodeImport from 'eslint-plugin-node-import';

/**
* ESLint base configuration shared for other re-usable configs
* @type {import('eslint').Linter.Config[]}
*/
export default [
{
ignores: [
'**/node_modules/**',
'**/lib/**',
'**/dist/**',
'**/build/**',
'**/.turbo/**',
'**/.cxx/**',
'**/Pods/**',
],
},

// below: prettier integration
eslintConfigPrettier,
{
plugins: {
prettier,
},
rules: {
'prettier/prettier': 'error',
},
},

// below: enforce importing of built-in Node.js modules with the 'node:' prefix
{
plugins: {
'node-import': eslintPluginNodeImport,
},
rules: {
'node-import/prefer-node-protocol': 'error',
},
},
];
28 changes: 28 additions & 0 deletions eslint.config.rn.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import globals from 'globals';
import { fixupConfigRules } from '@eslint/compat';
import { FlatCompat } from '@eslint/eslintrc';

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

const flatCompat = new FlatCompat();

/**
* ESLint configuration for React Native packages in the monorepo
* @type {import('eslint').Linter.Config[]}
*/
export default [
...fixupConfigRules(flatCompat.extends('@react-native/eslint-config')),
...baseEslintConfig,
{
languageOptions: {
ecmaVersion: 'latest',
sourceType: 'module',
globals: {
...globals.node,
},
},
rules: {
'@typescript-eslint/no-require-imports': 'off',
},
},
];
25 changes: 25 additions & 0 deletions eslint.config.ts.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import tseslint from 'typescript-eslint';

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

/**
* ESLint configuration for JS/TS packages in the monorepo
* @type {import('eslint').Linter.Config[]}
*/
export default [
...baseEslintConfig,

// below: tseslint integration
...tseslint.configs.recommended,
{
rules: {
'@typescript-eslint/no-empty-object-type': [
'error',
{
allowInterfaces: 'always',
},
],
'@typescript-eslint/no-explicit-any': 'warn',
},
},
];
14 changes: 10 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,15 +39,21 @@
"devDependencies": {
"@commitlint/cli": "^20.1.0",
"@commitlint/config-conventional": "^20.0.0",
"@react-native/eslint-config": "0.82.1",
"@eslint/compat": "^2.0.1",
"@react-native/eslint-config": "^0.83.1",
"babel-plugin-module-resolver": "5.0.2",
"eslint": "^8.57.1",
"eslint": "^9.28.0",
"eslint-config-prettier": "^10.1.8",
"eslint-plugin-prettier": "^5.1.3",
"eslint-plugin-node-import": "^1.0.5",
"eslint-plugin-prettier": "^5.4.0",
"eslint-plugin-react": "^7.37.5",
"eslint-plugin-react-hooks": "^5.2.0",
"globals": "^16.2.0",
"lefthook": "^2.0.3",
"prettier": "^3.5.3",
"turbo": "^2.7.3",
"typescript": "5.8.3"
"typescript": "5.8.3",
"typescript-eslint": "^8.53.0"
},
"commitlint": {
"extends": [
Expand Down
5 changes: 0 additions & 5 deletions packages/brownie/.eslintrc.json

This file was deleted.

4 changes: 4 additions & 0 deletions packages/brownie/eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import eslintRnConfig from '../../eslint.config.rn.mjs';

/** @type {import('eslint').Linter.Config[]} */
export default eslintRnConfig;
7 changes: 4 additions & 3 deletions packages/brownie/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
"./package.json": "./package.json"
},
"scripts": {
"lint": "eslint \"**/*.{js,ts,tsx}\"",
"lint": "eslint .",
"typecheck": "tsc --noEmit",
"build": "bob build",
"dev": "nodemon --watch src --ext js,ts,json --exec \"bob build\""
Expand Down Expand Up @@ -72,10 +72,11 @@
"@babel/preset-typescript": "^7.27.1",
"@babel/runtime": "^7.25.0",
"@react-native/babel-preset": "0.82.1",
"@react-native/eslint-config": "0.82.1",
"@types/node": "^22.0.0",
"@types/react": "^19.1.1",
"eslint": "^8.57.1",
"eslint": "^9.28.0",
"globals": "^16.2.0",
"import": "^0.0.6",
"nodemon": "^3.1.11",
"react": "19.1.1",
"react-native": "0.82.1",
Expand Down
8 changes: 5 additions & 3 deletions packages/brownie/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,18 @@ export interface BrownieStore {}

type StoreListener = () => void;

type HostObject = any;

interface StoreCache {
hostObject: any;
hostObject: HostObject;
snapshot: Record<string, unknown>;
listeners: Set<StoreListener>;
}

const stores = new Map<string, StoreCache>();

function getHostObject(key: string): any {
// @ts-ignore
function getHostObject(key: string): HostObject {
// @ts-expect-error - untyped global prop set by BrownieInstaller.cpp
return global.__getStore?.(key);
}

Expand Down
5 changes: 0 additions & 5 deletions packages/cli/.eslintrc.json

This file was deleted.

4 changes: 4 additions & 0 deletions packages/cli/eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import eslintBaseConfig from '../../eslint.config.base.mjs';

/** @type {import('eslint').Linter.Config[]} */
export default eslintBaseConfig;
6 changes: 3 additions & 3 deletions packages/cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"./package.json": "./package.json"
},
"scripts": {
"lint": "eslint \"**/*.{js,ts,tsx}\"",
"lint": "eslint .",
"typecheck": "tsc --noEmit",
"build": "tsc -p tsconfig.json",
"dev": "tsc -p tsconfig.json --watch",
Expand Down Expand Up @@ -68,13 +68,13 @@
"@babel/preset-typescript": "^7.28.5",
"@react-native-community/cli-types": "^20.0.0",
"@react-native/babel-preset": "0.82.1",
"@react-native/eslint-config": "0.82.1",
"@types/babel__core": "^7",
"@types/babel__preset-env": "^7",
"@types/lodash.clonedeep": "^4.5.9",
"@types/node": "^25.0.3",
"@vitest/coverage-v8": "^4.0.17",
"eslint": "^8.57.1",
"eslint": "^9.28.0",
"globals": "^16.2.0",
"nodemon": "^3.1.11",
"typescript": "5.8.3",
"vitest": "^4.0.17"
Expand Down
12 changes: 6 additions & 6 deletions packages/cli/src/brownfield/commands/packageAndroid.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
import { packageAarAction } from '@rock-js/plugin-brownfield-android';
import { Command } from 'commander';

import {
packageAarOptions,
type PackageAarFlags,
packageAarOptions,
} from '@rock-js/platform-android';
import { packageAarAction } from '@rock-js/plugin-brownfield-android';

import { Command } from 'commander';

import { getProjectInfo } from '../utils/index.js';
import {
ExampleUsage,
actionRunner,
curryOptions,
ExampleUsage,
} from '../../shared/index.js';
import { getProjectInfo } from '../utils/index.js';

export const packageAndroidCommand = curryOptions(
new Command('package:android').description('Build Android AAR'),
Expand Down
8 changes: 4 additions & 4 deletions packages/cli/src/brownie/__tests__/commands/codegen.test.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import fs from 'fs';
import path from 'path';
import { fileURLToPath } from 'url';
import fs from 'node:fs';
import path from 'node:path';
import { fileURLToPath } from 'node:url';
import { describe, it, expect, beforeEach, afterEach, vi, Mock } from 'vitest';
import * as rockTools from '@rock-js/tools';
import { runCodegen } from '../../commands/codegen.js';
import * as swiftGenerator from '../../generators/swift.js';
import * as kotlinGenerator from '../../generators/kotlin.js';
import * as storeDiscovery from '../../store-discovery.js';
import * as rockTools from '@rock-js/tools';

const __dirname = path.dirname(fileURLToPath(import.meta.url));
const FIXTURES_DIR = path.join(__dirname, '../../__fixtures__');
Expand Down
5 changes: 3 additions & 2 deletions packages/cli/src/brownie/__tests__/config.test.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import { fileURLToPath } from 'node:url';
import fs from 'node:fs';
import path from 'node:path';
import { fileURLToPath } from 'node:url';
import { describe, it, expect, afterEach, vi } from 'vitest';

import { afterEach, describe, expect, it, vi } from 'vitest';

import { loadConfig } from '../config.js';

Expand Down
6 changes: 3 additions & 3 deletions packages/cli/src/brownie/__tests__/store-discovery.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import fs from 'fs';
import path from 'path';
import { fileURLToPath } from 'url';
import fs from 'node:fs';
import path from 'node:path';
import { fileURLToPath } from 'node:url';
import { describe, it, expect, afterEach } from 'vitest';
import { discoverStores } from '../store-discovery.js';

Expand Down
4 changes: 2 additions & 2 deletions packages/cli/src/brownie/commands/codegen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@ import { styleText } from 'node:util';

import { Command, Option } from 'commander';

import { intro, logger, outro } from '@rock-js/tools';
import { QuickTypeError } from 'quicktype-core';
import { actionRunner } from '../../shared/index.js';
import { loadConfig, type BrownieConfig } from '../config.js';
import { generateSwift } from '../generators/swift.js';
import { generateKotlin } from '../generators/kotlin.js';
import { discoverStores, type DiscoveredStore } from '../store-discovery.js';
import { Platform } from '../types.js';
import { intro, logger, outro } from '@rock-js/tools';
import { QuickTypeError } from 'quicktype-core';

function getOutputPath(dir: string, name: string, ext: string): string {
return path.join(dir, `${name}.${ext}`);
Expand Down
4 changes: 2 additions & 2 deletions packages/cli/src/brownie/config.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import fs from 'fs';
import path from 'path';
import fs from 'node:fs';
import path from 'node:path';

export interface BrownieConfig {
swift?: string;
Expand Down
Loading
Loading