From 4a5722788daa138048b9d9a150b495938099371d Mon Sep 17 00:00:00 2001
From: Ryan Lamb <4955475+kinyoklion@users.noreply.github.com>
Date: Wed, 13 Nov 2024 10:31:14 -0800
Subject: [PATCH] chore: Global lint.
---
README.md | 4 +--
packages/sdk/browser/README.md | 2 --
packages/sdk/cloudflare/jsr.json | 12 ++-----
packages/sdk/server-ai/README.md | 13 ++++----
.../sdk/server-ai/examples/openai/README.md | 1 -
packages/shared/common/rollup.config.js | 6 +++-
packages/shared/sdk-client/rollup.config.js | 7 ++++-
.../telemetry/browser-telemetry/setup-jest.js | 3 +-
.../jest/example/react-native-example/App.tsx | 6 ++--
.../react-native-example/babel.config.js | 1 -
.../react-native-example/src/welcome.test.tsx | 31 +++++++++----------
.../react-native-example/src/welcome.tsx | 2 +-
.../react-native-example/tsconfig.eslint.json | 11 ++-----
release-please-config.json | 21 +++++++------
14 files changed, 58 insertions(+), 62 deletions(-)
diff --git a/README.md b/README.md
index 441ba6ff9..42eddb660 100644
--- a/README.md
+++ b/README.md
@@ -13,8 +13,8 @@ This includes shared libraries, used by SDKs and other tools, as well as SDKs.
| [@launchdarkly/node-server-sdk](packages/sdk/server-node/README.md) | [![NPM][sdk-server-node-npm-badge]][sdk-server-node-npm-link] | [Node.js Server][package-sdk-server-node-issues] | [![Actions Status][sdk-server-node-ci-badge]][sdk-server-node-ci] |
| [@launchdarkly/vercel-server-sdk](packages/sdk/vercel/README.md) | [![NPM][sdk-vercel-npm-badge]][sdk-vercel-npm-link] | [Vercel][package-sdk-vercel-issues] | [![Actions Status][sdk-vercel-ci-badge]][sdk-vercel-ci] |
| [@launchdarkly/react-native-client-sdk](packages/sdk/react-native/README.md) | [![NPM][sdk-react-native-npm-badge]][sdk-react-native-npm-link] | [React-Native][package-sdk-react-native-issues] | [![Actions Status][sdk-react-native-ci-badge]][sdk-react-native-ci] |
-| [@launchdarkly/js-client-sdk](packages/sdk/browser/README.md) | [![NPM][sdk-browser-npm-badge]][sdk-browser-npm-link] | [Browser][package-sdk-browser-issues] | [![Actions Status][sdk-browser-ci-badge]][sdk-browser-ci] |
-| [@launchdarkly/server-sdk-ai](packages/sdk/server-ai/README.md) | [![NPM][sdk-server-ai-npm-badge]][sdk-server-ai-npm-link] | [server-ai][package-sdk-server-ai-issues] | [![Actions Status][sdk-server-ai-ci-badge]][sdk-server-ai-ci] |
+| [@launchdarkly/js-client-sdk](packages/sdk/browser/README.md) | [![NPM][sdk-browser-npm-badge]][sdk-browser-npm-link] | [Browser][package-sdk-browser-issues] | [![Actions Status][sdk-browser-ci-badge]][sdk-browser-ci] |
+| [@launchdarkly/server-sdk-ai](packages/sdk/server-ai/README.md) | [![NPM][sdk-server-ai-npm-badge]][sdk-server-ai-npm-link] | [server-ai][package-sdk-server-ai-issues] | [![Actions Status][sdk-server-ai-ci-badge]][sdk-server-ai-ci] |
| Shared packages | npm | issues | tests |
| ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------- | ----------------------------------------------------------- | ------------------------------------------------------------------------------- |
diff --git a/packages/sdk/browser/README.md b/packages/sdk/browser/README.md
index b31b0a300..b26aac523 100644
--- a/packages/sdk/browser/README.md
+++ b/packages/sdk/browser/README.md
@@ -1,13 +1,11 @@
# LaunchDarkly JavaScript SDK for Browsers
-
[![NPM][browser-sdk-npm-badge]][browser-sdk-npm-link]
[![Actions Status][browser-sdk-ci-badge]][browser-sdk-ci]
[![Documentation][browser-sdk-ghp-badge]][browser-sdk-ghp-link]
[![NPM][browser-sdk-dm-badge]][browser-sdk-npm-link]
[![NPM][browser-sdk-dt-badge]][browser-sdk-npm-link]
-
# ⛔️⛔️⛔️⛔️
> [!CAUTION]
diff --git a/packages/sdk/cloudflare/jsr.json b/packages/sdk/cloudflare/jsr.json
index b092c83ee..4b0c8164d 100644
--- a/packages/sdk/cloudflare/jsr.json
+++ b/packages/sdk/cloudflare/jsr.json
@@ -3,15 +3,7 @@
"version": "2.6.1",
"exports": "./src/index.ts",
"publish": {
- "include": [
- "LICENSE",
- "README.md",
- "package.json",
- "jsr.json",
- "src/**/*.ts"
- ],
- "exclude": [
- "src/**/*.test.ts"
- ]
+ "include": ["LICENSE", "README.md", "package.json", "jsr.json", "src/**/*.ts"],
+ "exclude": ["src/**/*.test.ts"]
}
}
diff --git a/packages/sdk/server-ai/README.md b/packages/sdk/server-ai/README.md
index 40ee29090..27468467f 100644
--- a/packages/sdk/server-ai/README.md
+++ b/packages/sdk/server-ai/README.md
@@ -38,13 +38,14 @@ const aiClient = initAi(ldClient);
```
3. Evaluate a model configuration:
+
```typescript
- const config = await aiClient.modelConfig(
- aiConfigKey!,
- context,
- { enabled: false },
- { myVariable: 'My User Defined Variable' },
- );
+const config = await aiClient.modelConfig(
+ aiConfigKey!,
+ context,
+ { enabled: false },
+ { myVariable: 'My User Defined Variable' },
+);
```
For an example of how to use the config please refer to the examples folder.
diff --git a/packages/sdk/server-ai/examples/openai/README.md b/packages/sdk/server-ai/examples/openai/README.md
index 0126c332a..ca285018d 100644
--- a/packages/sdk/server-ai/examples/openai/README.md
+++ b/packages/sdk/server-ai/examples/openai/README.md
@@ -4,7 +4,6 @@ This package demonstrates the integration of LaunchDarkly's AI SDK with OpenAI,
## Installation and Build
-
When running as part of the js-core mono-repo the project will use local dependencies.
As such those dependencies need built.
diff --git a/packages/shared/common/rollup.config.js b/packages/shared/common/rollup.config.js
index 5514151c2..d3eb05b64 100644
--- a/packages/shared/common/rollup.config.js
+++ b/packages/shared/common/rollup.config.js
@@ -36,6 +36,10 @@ export default [
},
{
...getSharedConfig('cjs', 'dist/cjs/index.cjs'),
- plugins: [typescript({ tsconfig: './tsconfig.json', outputToFilesystem: true, }), common(), json()],
+ plugins: [
+ typescript({ tsconfig: './tsconfig.json', outputToFilesystem: true }),
+ common(),
+ json(),
+ ],
},
];
diff --git a/packages/shared/sdk-client/rollup.config.js b/packages/shared/sdk-client/rollup.config.js
index 81b9cde6e..093c7fe4b 100644
--- a/packages/shared/sdk-client/rollup.config.js
+++ b/packages/shared/sdk-client/rollup.config.js
@@ -38,6 +38,11 @@ export default [
},
{
...getSharedConfig('cjs', 'dist/cjs/index.cjs'),
- plugins: [typescript({ tsconfig: './tsconfig.json', outputToFilesystem: true, }), common(), resolve(), json()],
+ plugins: [
+ typescript({ tsconfig: './tsconfig.json', outputToFilesystem: true }),
+ common(),
+ resolve(),
+ json(),
+ ],
},
];
diff --git a/packages/telemetry/browser-telemetry/setup-jest.js b/packages/telemetry/browser-telemetry/setup-jest.js
index 14fd78a6b..d09f7399e 100644
--- a/packages/telemetry/browser-telemetry/setup-jest.js
+++ b/packages/telemetry/browser-telemetry/setup-jest.js
@@ -64,7 +64,7 @@ Object.defineProperty(global, 'Request', {
cache: this.cache,
redirect: this.redirect,
referrer: this.referrer,
- integrity: this.integrity
+ integrity: this.integrity,
});
}
},
@@ -72,7 +72,6 @@ Object.defineProperty(global, 'Request', {
configurable: true,
});
-
// Based on:
// https://stackoverflow.com/a/71750830
diff --git a/packages/tooling/jest/example/react-native-example/App.tsx b/packages/tooling/jest/example/react-native-example/App.tsx
index 8521ffd2c..a5473cb51 100644
--- a/packages/tooling/jest/example/react-native-example/App.tsx
+++ b/packages/tooling/jest/example/react-native-example/App.tsx
@@ -1,15 +1,17 @@
import { StyleSheet } from 'react-native';
+
import {
AutoEnvAttributes,
+ LDOptions,
LDProvider,
ReactNativeLDClient,
- LDOptions,
} from '@launchdarkly/react-native-client-sdk';
+
import Welcome from './src/welcome';
const options: LDOptions = {
debug: true,
-}
+};
//TODO Set MOBILE_KEY in .env file to a mobile key in your project/environment.
const MOBILE_KEY = 'YOUR_MOBILE_KEY';
const featureClient = new ReactNativeLDClient(MOBILE_KEY, AutoEnvAttributes.Enabled, options);
diff --git a/packages/tooling/jest/example/react-native-example/babel.config.js b/packages/tooling/jest/example/react-native-example/babel.config.js
index 28dcb83ba..2fa5a5274 100644
--- a/packages/tooling/jest/example/react-native-example/babel.config.js
+++ b/packages/tooling/jest/example/react-native-example/babel.config.js
@@ -2,6 +2,5 @@ module.exports = function (api) {
api.cache(true);
return {
presets: ['babel-preset-expo', '@babel/preset-typescript'],
-
};
};
diff --git a/packages/tooling/jest/example/react-native-example/src/welcome.test.tsx b/packages/tooling/jest/example/react-native-example/src/welcome.test.tsx
index 8bd9f4e21..790ebead2 100644
--- a/packages/tooling/jest/example/react-native-example/src/welcome.test.tsx
+++ b/packages/tooling/jest/example/react-native-example/src/welcome.test.tsx
@@ -1,29 +1,28 @@
/**
* @jest-environment jsdom
*/
+import { render, screen } from '@testing-library/react-native';
import { mockFlags, resetLDMocks } from '@launchdarkly/jest/react-native';
-import { screen, render } from '@testing-library/react-native';
import { useLDClient } from '@launchdarkly/react-native-client-sdk';
+
import Welcome from './welcome';
describe('Welcome component test', () => {
+ afterEach(() => {
+ resetLDMocks();
+ });
- afterEach(() => {
- resetLDMocks();
- });
-
- test('mock boolean flag correctly', () => {
- mockFlags({ 'my-boolean-flag': true });
- render();
- expect(screen.getByText('Flag value is true')).toBeTruthy();
- });
+ test('mock boolean flag correctly', () => {
+ mockFlags({ 'my-boolean-flag': true });
+ render();
+ expect(screen.getByText('Flag value is true')).toBeTruthy();
+ });
- test('mock ldClient correctly', () => {
- const current = useLDClient();
-
- current?.track('event');
- expect(current.track).toHaveBeenCalledTimes(1);
- });
+ test('mock ldClient correctly', () => {
+ const current = useLDClient();
+ current?.track('event');
+ expect(current.track).toHaveBeenCalledTimes(1);
+ });
});
diff --git a/packages/tooling/jest/example/react-native-example/src/welcome.tsx b/packages/tooling/jest/example/react-native-example/src/welcome.tsx
index f167b11fc..0b28a7260 100644
--- a/packages/tooling/jest/example/react-native-example/src/welcome.tsx
+++ b/packages/tooling/jest/example/react-native-example/src/welcome.tsx
@@ -1,8 +1,8 @@
import { StyleSheet, Text, View } from 'react-native';
+
import { useLDClient } from '@launchdarkly/react-native-client-sdk';
export default function Welcome() {
-
const ldClient = useLDClient();
const flagValue = ldClient.boolVariation('my-boolean-flag', false);
diff --git a/packages/tooling/jest/example/react-native-example/tsconfig.eslint.json b/packages/tooling/jest/example/react-native-example/tsconfig.eslint.json
index 9101efe40..18ba58fe8 100644
--- a/packages/tooling/jest/example/react-native-example/tsconfig.eslint.json
+++ b/packages/tooling/jest/example/react-native-example/tsconfig.eslint.json
@@ -1,10 +1,5 @@
{
- "extends": "./tsconfig.json",
- "include": [
- "/**/*.ts",
- "/**/*.tsx",
- "/*.js",
- "/*.tsx"
- ],
- "exclude": ["node_modules"]
+ "extends": "./tsconfig.json",
+ "include": ["/**/*.ts", "/**/*.tsx", "/*.js", "/*.tsx"],
+ "exclude": ["node_modules"]
}
diff --git a/release-please-config.json b/release-please-config.json
index 10d0a8a92..faf16b947 100644
--- a/release-please-config.json
+++ b/release-please-config.json
@@ -34,15 +34,18 @@
},
"packages/sdk/server-ai": {
"bump-minor-pre-major": true,
- "extra-files": [{
- "type": "json",
- "path": "examples/bedrock/package.json",
- "jsonpath": "$.dependencies['@launchdarkly/server-sdk-ai']"
- },{
- "type": "json",
- "path": "examples/openai/package.json",
- "jsonpath": "$.dependencies['@launchdarkly/server-sdk-ai']"
- }]
+ "extra-files": [
+ {
+ "type": "json",
+ "path": "examples/bedrock/package.json",
+ "jsonpath": "$.dependencies['@launchdarkly/server-sdk-ai']"
+ },
+ {
+ "type": "json",
+ "path": "examples/openai/package.json",
+ "jsonpath": "$.dependencies['@launchdarkly/server-sdk-ai']"
+ }
+ ]
}
},
"plugins": [