Skip to content

Commit

Permalink
chore: Global lint. (#685)
Browse files Browse the repository at this point in the history
Various readme and config files are not linted by individual projects
and as a result they end up missed. This PR is just from a global lint.

I've created SDK-892 to address this deficit.
  • Loading branch information
kinyoklion authored Nov 14, 2024
1 parent ca1dd49 commit aafd1a5
Show file tree
Hide file tree
Showing 17 changed files with 82 additions and 67 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: 1 addition & 1 deletion packages/sdk/akamai-base/example/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,6 @@
"typescript": "5.1.6"
},
"dependencies": {
"@launchdarkly/akamai-server-base-sdk": "^1.0.0"
"@launchdarkly/akamai-server-base-sdk": "2.1.19"
}
}
2 changes: 1 addition & 1 deletion packages/sdk/akamai-edgekv/example/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,6 @@
"typescript": "5.1.6"
},
"dependencies": {
"@launchdarkly/akamai-server-edgekv-sdk": "^1.0.0"
"@launchdarkly/akamai-server-edgekv-sdk": "1.2.1"
}
}
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
2 changes: 1 addition & 1 deletion packages/sdk/cloudflare/example/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"module": "./dist/index.mjs",
"packageManager": "[email protected]",
"dependencies": {
"@launchdarkly/cloudflare-server-sdk": "2.2.3"
"@launchdarkly/cloudflare-server-sdk": "2.6.1"
},
"devDependencies": {
"@cloudflare/workers-types": "^4.20230321.0",
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"]
}
44 changes: 33 additions & 11 deletions release-please-config.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@
"path": "jsr.json",
"jsonpath": "$.version"
},
{
"type": "json",
"path": "example/package.json",
"jsonpath": "$.dependencies['@launchdarkly/cloudflare-server-sdk']"
},
"src/createPlatformInfo.ts"
]
},
Expand All @@ -21,10 +26,24 @@
"extra-files": ["src/createPlatformInfo.ts"]
},
"packages/sdk/akamai-base": {
"extra-files": ["src/index.ts"]
"extra-files": [
"src/index.ts",
{
"type": "json",
"path": "example/package.json",
"jsonpath": "$.dependencies['@launchdarkly/akamai-server-base-sdk']"
}
]
},
"packages/sdk/akamai-edgekv": {
"extra-files": ["src/index.ts"]
"extra-files": [
"src/index.ts",
{
"type": "json",
"path": "example/package.json",
"jsonpath": "$.dependencies['@launchdarkly/akamai-server-edgekv-sdk']"
}
]
},
"packages/store/node-server-sdk-dynamodb": {},
"packages/store/node-server-sdk-redis": {},
Expand All @@ -34,15 +53,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 aafd1a5

Please sign in to comment.