Skip to content

Commit a4570b0

Browse files
authored
format & lint (#1115)
Run formatter to fix ci lint checks
1 parent 140c457 commit a4570b0

89 files changed

Lines changed: 1070 additions & 1206 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.eslintrc.js

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
module.exports = {
22
extends: [
3-
"@react-native",
3+
'@react-native',
44
'plugin:@typescript-eslint/recommended',
55
// 'plugin:@typescript-eslint/recommended-requiring-type-checking',
66
],
@@ -15,18 +15,18 @@ module.exports = {
1515
useTabs: false,
1616
},
1717
],
18-
"no-void": [
19-
"error",
20-
{ "allowAsStatement": true }
18+
'no-void': ['error', { allowAsStatement: true }],
19+
'@typescript-eslint/restrict-template-expressions': [
20+
'warn',
21+
{
22+
allowNumber: true,
23+
allowBoolean: true,
24+
allowAny: true,
25+
allowNullish: true,
26+
},
2127
],
22-
"@typescript-eslint/restrict-template-expressions": ["warn", {
23-
allowNumber: true,
24-
allowBoolean: true,
25-
allowAny: true,
26-
allowNullish: true
27-
}],
28-
"@typescript-eslint/no-explicit-any": "error",
29-
"@typescript-eslint/strict-boolean-expressions": "error"
28+
'@typescript-eslint/no-explicit-any': 'error',
29+
'@typescript-eslint/strict-boolean-expressions': 'error',
3030
},
3131
overrides: [
3232
// Detox tests
@@ -36,21 +36,21 @@ module.exports = {
3636
jest: true,
3737
},
3838
},
39-
// Jest
39+
// Jest
4040
{
4141
files: ['**/__tests__/**', '**/__mocks__/**', '**/__helpers__/**'],
4242
plugins: ['jest'],
4343
env: {
4444
jest: true,
4545
},
4646
rules: {
47-
"no-unused-vars": "off",
48-
"@typescript-eslint/no-unsafe-call": "warn",
49-
"@typescript-eslint/no-unused-vars": "error",
50-
"@typescript-eslint/unbound-method": "off",
51-
"@typescript-eslint/no-unsafe-assignment": "warn",
52-
"@typescript-eslint/no-unsafe-member-access": "warn",
53-
"@typescript-eslint/ban-ts-comment": "warn"
47+
'no-unused-vars': 'off',
48+
'@typescript-eslint/no-unsafe-call': 'warn',
49+
'@typescript-eslint/no-unused-vars': 'error',
50+
'@typescript-eslint/unbound-method': 'off',
51+
'@typescript-eslint/no-unsafe-assignment': 'warn',
52+
'@typescript-eslint/no-unsafe-member-access': 'warn',
53+
'@typescript-eslint/ban-ts-comment': 'warn',
5454
},
5555
},
5656
],

AGENTS.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
# Repository Guidelines
22

33
## Project Structure & Module Organization
4+
45
- Yarn workspaces live under `packages`: `core` (SDK runtime), `sovran` (state store), `shared` (cross-package utilities), and `plugins/*` (destination and helper plugins). Native iOS/Android sources reside in each package’s `ios` and `android` folders.
56
- Example apps sit in `examples/AnalyticsReactNativeExample` (manual QA) and `examples/E2E` (Detox). Scripts are in `scripts/`; configuration lives alongside packages (e.g., `tsconfig.json`, `babel.config.js`, `jest.config.js`).
67

78
## Build, Test, and Development Commands
9+
810
- `yarn bootstrap`: install root + workspace deps and pod install for example/e2e apps.
911
- `yarn build`: run workspace builds in topo order.
1012
- `yarn testAll` / `yarn test`: workspace Jest suite or root Jest run.
@@ -13,17 +15,21 @@
1315
- Example app: `yarn example start | ios | android`. Detox: `yarn e2e start:e2e` then platform builds/tests (e.g., `yarn e2e e2e:build:ios` + `yarn e2e e2e:test:ios`).
1416

1517
## Coding Style & Naming Conventions
18+
1619
- TypeScript-first; native code should mirror existing Swift/Obj-C/Kotlin style. Two-space indentation and Prettier formatting via ESLint rules.
1720
- Prefer camelCase for variables/functions, PascalCase for React components/classes, and UPPER_SNAKE for constants. Plugin packages follow `plugin-*` folder naming and publish as scoped `@segment/*`.
1821
- Keep public APIs typed and documented; colocate utilities with their feature module (e.g., `src/plugins`, `src/__tests__`).
1922

2023
## Testing Guidelines
24+
2125
- Unit tests use Jest with tests under `__tests__` near source; snapshots live in `__tests__/__snapshots__`.
2226
- End-to-end coverage uses Detox in `examples/E2E`; build and run per platform before pushing. Add regression tests for new behaviors and keep existing snapshots updated only when intentional.
2327

2428
## Commit & Pull Request Guidelines
29+
2530
- Commit messages follow Conventional Commits (`feat`, `fix`, `chore`, etc.); enforced by commitlint and release automation.
2631
- For PRs, keep scope narrow, link issues when relevant, and note user-facing changes. Ensure `yarn lint`, `yarn typescript`, and the relevant `yarn test*`/Detox flows pass. Include screenshots only when UI changes affect the example app.
2732

2833
## Security & Configuration Tips
34+
2935
- Do not commit real Segment write keys or private endpoints; use placeholder values in examples and tests. Keep secrets out of `examples/` and CI config. When testing proxies/CDN settings, prefer environment-driven config rather than hardcoding.

MIGRATION_GUIDE.md

Lines changed: 28 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
# Migrating to 2.0
22

3-
Analytics-React-Native 2.0 currently supports [these destinations](https://github.com/segmentio/analytics-react-native/tree/master/packages/plugins) with Segment actively adding more to the list.
4-
If you’re using `analytics-react-native 1.5.1` or older, follow these steps to migrate to the `analytics-react-native 2.0`. You can continue to use your React Native source write key for the migration to view historical events.
3+
Analytics-React-Native 2.0 currently supports [these destinations](https://github.com/segmentio/analytics-react-native/tree/master/packages/plugins) with Segment actively adding more to the list.
4+
If you’re using `analytics-react-native 1.5.1` or older, follow these steps to migrate to the `analytics-react-native 2.0`. You can continue to use your React Native source write key for the migration to view historical events.
55

66
---
77

8-
🚨 **Important Note**: Analytics React Native 2.0 implements a new storage framework, [@segment/sovran-react-native](https://github.com/segmentio/sovran-react-native), **which makes it impossible to determine if your app has been previously installed**.
8+
🚨 **Important Note**: Analytics React Native 2.0 implements a new storage framework, [@segment/sovran-react-native](https://github.com/segmentio/sovran-react-native), **which makes it impossible to determine if your app has been previously installed**.
99

1010
**Migrating to Analytics React Native 2.0 results in new `Application Installed` events for your existing users**. To filter these events out you can either create an Enrichment Plugin to drop events or filter them using your Segment workspace.
1111

@@ -20,10 +20,13 @@ yarn upgrade @segment/analytics-react-native
2020
If you are using any device mode destinations from V1 you will have to remove them and add their [equivalent plugin package for V2](#plugins).
2121

2222
2. Add/Update pods
23+
2324
```sh
2425
npx pod-install
2526
```
27+
2628
3. Add permission to `AndroidManifest.xml`
29+
2730
```sh
2831
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
2932
```
@@ -35,6 +38,7 @@ You will have to remove your current configuration and replace it with the `crea
3538
**Example client configuration for `analytics-react-native 1.5.1`**
3639

3740
App.js:
41+
3842
```sh
3943
import analytics from '@segment/analytics-react-native'
4044

@@ -47,7 +51,9 @@ analytics.setup('WRITE_KEY', {
4751
});
4852

4953
```
54+
5055
package.json
56+
5157
```sh
5258
"dependencies": {
5359
...
@@ -56,6 +62,7 @@ package.json
5662
```
5763

5864
podfile.lock
65+
5966
```sh
6067
PODS:
6168
...
@@ -65,6 +72,7 @@ PODS:
6572

6673
**Example client configuration for `analytics-react-native 2.0.0`**
6774
App.tsx (or .js):
75+
6876
```sh
6977
import {
7078
createClient,
@@ -87,7 +95,9 @@ const App = () => {
8795
);
8896
};
8997
```
98+
9099
package.json
100+
91101
```sh
92102
"dependencies": {
93103
...
@@ -97,6 +107,7 @@ package.json
97107
```
98108

99109
podfile.lock
110+
100111
```sh
101112
PODS:
102113
...
@@ -110,6 +121,7 @@ PODS:
110121
**Example tracking implementation for `analytics-react-native 1.5.1`**
111122

112123
Home.js
124+
113125
```sh
114126
import analytics from '@segment/analytics-react-native';
115127

@@ -128,6 +140,7 @@ onSendEvent = async() => {
128140
**Example tracking implementation for `analytics-react-native 2.0.0`**
129141

130142
Home.tsx
143+
131144
```sh
132145
import { useAnalytics } from '@segment/analytics-react-native';
133146

@@ -146,21 +159,21 @@ const Home = ({ navigation }: { navigation: any }) => {
146159
147160
### Plugins
148161
149-
**The plugins for V2 have changed from V1**.
162+
**The plugins for V2 have changed from V1**.
150163
151-
The plugins have been re-released with different names. These are the equivalent packages for V2. Not all packages in V1 have yet been released for V2 but Segment is actively adding more packages to the list.
164+
The plugins have been re-released with different names. These are the equivalent packages for V2. Not all packages in V1 have yet been released for V2 but Segment is actively adding more packages to the list.
152165
153166
Also review [the main package list](README.md#supported-plugins) for new V2 plugins.
154167
155-
| Plugin | V1 Package | V2 Package |
156-
| ----------- | ----------- | ----------- |
157-
| [Adjust](https://github.com/segmentio/analytics-react-native/tree/master/packages/plugins/plugin-adjust) | `@segment/analytics-react-native-adjust`| `@segment/analytics-react-native-plugin-adjust` |
158-
| [Amplitude Sessions](https://github.com/segmentio/analytics-react-native/tree/master/packages/plugins/plugin-amplitudeSession) | `@segment/analytics-react-native-amplitude`| `@segment/analytics-react-native-plugin-amplitude-session`|
159-
| [AppsFlyer](https://github.com/segmentio/analytics-react-native/tree/master/packages/plugins/plugin-appsflyer) | `@segment/analytics-react-native-appsflyer` | `@segment/analytics-react-native-plugin-appsflyer`|
160-
| [Facebook App Events](https://github.com/segmentio/analytics-react-native/tree/master/packages/plugins/plugin-facebook-app-events) | `@segment/analytics-react-native-facebook-app-events-ios` | `@segment/analytics-react-native-plugin-facebook-app-events` |
161-
| [Firebase](https://github.com/segmentio/analytics-react-native/tree/master/packages/plugins/plugin-firebase) | `@segment/analytics-react-native-firebase` | `@segment/analytics-react-native-plugin-firebase`|
162-
| [Mixpanel](https://github.com/segmentio/analytics-react-native/tree/master/packages/plugins/plugin-mixpanel) | `@segment/analytics-react-native-mixpanel` | `@segment/analytics-react-native-plugin-mixpanel` |
163-
| [Taplytics](https://github.com/taplytics/segment-react-native-plugin-taplytics) | `@segment/analytics-react-native-taplytics-ios` | `@taplytics/segment-react-native-plugin-taplytics` |
168+
| Plugin | V1 Package | V2 Package |
169+
| ---------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------- | ------------------------------------------------------------ |
170+
| [Adjust](https://github.com/segmentio/analytics-react-native/tree/master/packages/plugins/plugin-adjust) | `@segment/analytics-react-native-adjust` | `@segment/analytics-react-native-plugin-adjust` |
171+
| [Amplitude Sessions](https://github.com/segmentio/analytics-react-native/tree/master/packages/plugins/plugin-amplitudeSession) | `@segment/analytics-react-native-amplitude` | `@segment/analytics-react-native-plugin-amplitude-session` |
172+
| [AppsFlyer](https://github.com/segmentio/analytics-react-native/tree/master/packages/plugins/plugin-appsflyer) | `@segment/analytics-react-native-appsflyer` | `@segment/analytics-react-native-plugin-appsflyer` |
173+
| [Facebook App Events](https://github.com/segmentio/analytics-react-native/tree/master/packages/plugins/plugin-facebook-app-events) | `@segment/analytics-react-native-facebook-app-events-ios` | `@segment/analytics-react-native-plugin-facebook-app-events` |
174+
| [Firebase](https://github.com/segmentio/analytics-react-native/tree/master/packages/plugins/plugin-firebase) | `@segment/analytics-react-native-firebase` | `@segment/analytics-react-native-plugin-firebase` |
175+
| [Mixpanel](https://github.com/segmentio/analytics-react-native/tree/master/packages/plugins/plugin-mixpanel) | `@segment/analytics-react-native-mixpanel` | `@segment/analytics-react-native-plugin-mixpanel` |
176+
| [Taplytics](https://github.com/taplytics/segment-react-native-plugin-taplytics) | `@segment/analytics-react-native-taplytics-ios` | `@taplytics/segment-react-native-plugin-taplytics` |
164177
165178
### Context Traits
166179
@@ -176,7 +189,7 @@ import { createClient } from '@segment/analytics-react-native';
176189
import { InjectTraits } from './InjectTraits';
177190
178191
const segmentClient = createClient({
179-
writeKey: 'SEGMENT_KEY'
192+
writeKey: 'SEGMENT_KEY',
180193
});
181194
182195
segmentClient.add({ plugin: new InjectTraits() });

0 commit comments

Comments
 (0)