Skip to content

Commit

Permalink
chore: Global lint.
Browse files Browse the repository at this point in the history
  • Loading branch information
kinyoklion committed Nov 13, 2024
1 parent 99a38ae commit 4a57227
Show file tree
Hide file tree
Showing 14 changed files with 58 additions and 62 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 |
| ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------- | ----------------------------------------------------------- | ------------------------------------------------------------------------------- |
Expand Down
2 changes: 0 additions & 2 deletions packages/sdk/browser/README.md
Original file line number Diff line number Diff line change
@@ -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]
Expand Down
12 changes: 2 additions & 10 deletions packages/sdk/cloudflare/jsr.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
}
}
13 changes: 7 additions & 6 deletions packages/sdk/server-ai/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
1 change: 0 additions & 1 deletion packages/sdk/server-ai/examples/openai/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down
6 changes: 5 additions & 1 deletion packages/shared/common/rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
],
},
];
7 changes: 6 additions & 1 deletion packages/shared/sdk-client/rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
],
},
];
3 changes: 1 addition & 2 deletions packages/telemetry/browser-telemetry/setup-jest.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,15 +64,14 @@ Object.defineProperty(global, 'Request', {
cache: this.cache,
redirect: this.redirect,
referrer: this.referrer,
integrity: this.integrity
integrity: this.integrity,
});
}
},
writable: true,
configurable: true,
});


// Based on:
// https://stackoverflow.com/a/71750830

Expand Down
6 changes: 4 additions & 2 deletions packages/tooling/jest/example/react-native-example/App.tsx
Original file line number Diff line number Diff line change
@@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,5 @@ module.exports = function (api) {
api.cache(true);
return {
presets: ['babel-preset-expo', '@babel/preset-typescript'],

};
};
Original file line number Diff line number Diff line change
@@ -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(<Welcome />);
expect(screen.getByText('Flag value is true')).toBeTruthy();
});
test('mock boolean flag correctly', () => {
mockFlags({ 'my-boolean-flag': true });
render(<Welcome />);
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);
});
});
Original file line number Diff line number Diff line change
@@ -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);
Expand Down
Original file line number Diff line number Diff line change
@@ -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"]
}
21 changes: 12 additions & 9 deletions release-please-config.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": [
Expand Down

0 comments on commit 4a57227

Please sign in to comment.