Skip to content
Open
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
3 changes: 2 additions & 1 deletion packages/browser-sdk/eslint.config.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
const base = require("@reflag/eslint-config");
const preactConfig = require("eslint-config-preact");

const preactConfig = import("eslint-config-preact");

const compatPlugin = require("eslint-plugin-compat");
const reactPlugin = require("eslint-plugin-react");
Expand Down
6 changes: 3 additions & 3 deletions packages/browser-sdk/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +43,14 @@
},
"devDependencies": {
"@playwright/test": "^1.49.1",
"@reflag/eslint-config": "0.0.2",
"@reflag/eslint-config": "0.0.3",
"@reflag/tsconfig": "0.0.2",
"@types/js-cookie": "^3.0.6",
"@types/node": "^22.12.0",
"@vitest/coverage-v8": "^2.0.4",
"c8": "~10.1.3",
"eslint": "^9.21.0",
"eslint-config-preact": "^1.5.0",
"eslint": "^9.34.0",
"eslint-config-preact": "^2.0.0",
"http-server": "^14.1.1",
"jsdom": "^24.1.0",
"msw": "^2.3.4",
Expand Down
1 change: 0 additions & 1 deletion packages/browser-sdk/src/ui/Dialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,6 @@ export const Dialog: FunctionComponent<OpenDialogOptions> = ({
window.removeEventListener("keydown", escapeHandler);
observer.disconnect();
};
// eslint-disable-next-line react-hooks/exhaustive-deps -- anchor only exists in popover
}, [position.type, close, (position as any).anchor, dismiss, containerId]);

function setDiagRef(node: HTMLDialogElement | null) {
Expand Down
32 changes: 16 additions & 16 deletions packages/cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,32 +41,32 @@
"preversion": "yarn lint && yarn prettier && yarn vitest run -c vite.config.js && yarn build"
},
"dependencies": {
"@inquirer/prompts": "^5.3.8",
"@inquirer/prompts": "^7.8.4",
"ajv": "^8.17.1",
"chalk": "^5.3.0",
"chalk": "^5.6.0",
"change-case": "^5.4.4",
"commander": "^12.1.0",
"commander": "^14.0.0",
"comment-json": "^4.2.5",
"express": "^4.21.2",
"express": "^5.1.0",
"fast-deep-equal": "^3.1.3",
"find-up": "^7.0.0",
"open": "^10.1.0",
"ora": "^8.1.0",
"open": "^10.2.0",
"ora": "^8.2.0",
"semver": "^7.7.2",
"slug": "^10.0.0",
"zod": "^3.24.2"
"slug": "^11.0.0",
"zod": "^4.1.5"
},
"devDependencies": {
"@reflag/eslint-config": "^0.0.2",
"@reflag/eslint-config": "^0.0.3",
"@reflag/tsconfig": "^0.0.2",
"@types/express": "^5.0.0",
"@types/node": "^22.5.1",
"@types/express": "^5.0.3",
"@types/node": "^24.3.0",
"@types/semver": "^7.7.0",
"@types/slug": "^5.0.9",
"eslint": "^9.21.0",
"prettier": "^3.5.2",
"shx": "^0.3.4",
"typescript": "^5.5.4",
"vitest": "^3.0.8"
"eslint": "^9.34.0",
"prettier": "^3.6.2",
"shx": "^0.4.0",
"typescript": "^5.9.2",
"vitest": "^3.2.4"
}
}
4 changes: 3 additions & 1 deletion packages/cli/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@
"outDir": "./dist/",
"target": "ESNext",
"module": "NodeNext",
"moduleResolution": "NodeNext"
"moduleResolution": "NodeNext",
"skipLibCheck": true,
"types": []
},
"include": ["**/*.ts"],
"exclude": ["node_modules", "dist", "**/*.spec.ts"]
Expand Down
25 changes: 14 additions & 11 deletions packages/cli/utils/json.ts
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How come we suddenly need all these type casts?

Original file line number Diff line number Diff line change
Expand Up @@ -79,15 +79,15 @@ export function mergeTypeASTs(types: TypeAST[]): TypeAST {
if (byKind.union.length > 0) {
// Flatten existing unions and collect types by category
const flattenedTypes: TypeAST[] = [];
const objectsToMerge: ObjectAST[] = [...byKind.object];
const arraysToMerge: ArrayAST[] = [...byKind.array];
const objectsToMerge: ObjectAST[] = [...(byKind.object as ObjectAST[])];
const arraysToMerge: ArrayAST[] = [...(byKind.array as ArrayAST[])];

// Add primitives directly
flattenedTypes.push(...byKind.primitive);

// Process union types
for (const unionType of byKind.union) {
for (const type of unionType.types) {
for (const type of (unionType as UnionAST).types) {
if (type.kind === "object") {
objectsToMerge.push(type);
} else if (type.kind === "array") {
Expand Down Expand Up @@ -115,7 +115,9 @@ export function mergeTypeASTs(types: TypeAST[]): TypeAST {

// Handle primitives
if (byKind.primitive.length === types.length) {
const uniqueTypes = [...new Set(byKind.primitive.map((p) => p.type))];
const uniqueTypes = [
...new Set((byKind.primitive as PrimitiveAST[]).map((p) => p.type)),
];
return uniqueTypes.length === 1
? { kind: "primitive", type: uniqueTypes[0] }
: {
Expand All @@ -128,29 +130,30 @@ export function mergeTypeASTs(types: TypeAST[]): TypeAST {
if (byKind.array.length === types.length) {
return {
kind: "array",
elementType: mergeTypeASTs(byKind.array.map((a) => a.elementType)),
elementType: mergeTypeASTs(
(byKind.array as ArrayAST[]).map((a) => a.elementType),
),
};
}

// Merge objects
if (byKind.object.length === types.length) {
const objects = byKind.object as ObjectAST[];
// Get all unique property keys
const allKeys = [
...new Set(
byKind.object.flatMap((obj) => obj.properties.map((p) => p.key)),
),
...new Set(objects.flatMap((obj) => obj.properties.map((p) => p.key))),
];

// Merge properties with same keys
const mergedProperties = allKeys.map((key) => {
const props = byKind.object
const props = objects
.map((obj) => obj.properties.find((p) => p.key === key))
.filter((obj) => !!obj);
.filter((prop): prop is NonNullable<typeof prop> => !!prop);

return {
key,
type: mergeTypeASTs(props.map((p) => p.type)),
optional: byKind.object.some(
optional: objects.some(
(obj) => !obj.properties.some((p) => p.key === key),
),
};
Expand Down
6 changes: 1 addition & 5 deletions packages/cli/utils/schemas.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,7 @@ export const booleanish = z.preprocess((value) => {
return value === "true" || value === "1";
}
return Boolean(value);
}, z.boolean().describe("Boolean value that can be parsed from strings like 'true' or '1'")) as z.ZodEffects<
z.ZodBoolean,
boolean,
boolean
>;
}, z.boolean().describe("Boolean value that can be parsed from strings like 'true' or '1'"));

export const PaginationQueryBaseSchema = (
{
Expand Down
12 changes: 12 additions & 0 deletions packages/eslint-config/base.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,12 @@ module.exports = [
// Workaround until import supports flat config
// https://github.com/import-js/eslint-plugin-import/issues/2556
espree: [".js", ".cjs", ".mjs", ".jsx"],
"@typescript-eslint/parser": [".ts", ".tsx"],
Comment on lines 56 to +58
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this might have been resolved import-js/eslint-plugin-import#3018

},
"import/ignore": [
"node_modules",
"\\.(coffee|scss|css|less|hbs|svg|json)$",
],
},
rules: {
...jsPlugin.configs.recommended.rules,
Expand Down Expand Up @@ -111,6 +116,13 @@ module.exports = [
languageOptions: {
parser: tsParser,
parserOptions: {
sourceType: "module",
ecmaVersion: "latest",
ecmaFeatures: {
modules: true,
impliedStrict: true,
jsx: true,
},
Comment on lines +119 to +125
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These are already defined higher up in the config for .ts and .tsx

project: "./tsconfig.eslint.json",
},
},
Expand Down
30 changes: 16 additions & 14 deletions packages/eslint-config/package.json
Original file line number Diff line number Diff line change
@@ -1,23 +1,25 @@
{
"name": "@reflag/eslint-config",
"version": "0.0.2",
"version": "0.0.3",
"license": "MIT",
"private": true,
"main": "./base.js",
"dependencies": {
"@eslint/js": "^9.21.0",
"@typescript-eslint/eslint-plugin": "^8.25.0",
"@typescript-eslint/parser": "^8.25.0",
"eslint": "^9.21.0",
"eslint-config-prettier": "^10.0.1",
"eslint-import-resolver-typescript": "^3.8.3",
"eslint-plugin-import": "^2.31.0",
"eslint-plugin-react": "^7.37.4",
"eslint-plugin-react-hooks": "^5.1.0",
"@eslint/js": "^9.34.0",
"@typescript-eslint/eslint-plugin": "^8.42.0",
"@typescript-eslint/parser": "^8.42.0",
"eslint": "^9.34.0",
"eslint-config-prettier": "^10.1.8",
"eslint-import-resolver-typescript": "^4.4.4",
"eslint-plugin-import": "^2.32.0",
"eslint-plugin-react": "^7.37.5",
"eslint-plugin-react-hooks": "^5.2.0",
"eslint-plugin-simple-import-sort": "^12.1.1",
"eslint-plugin-unused-imports": "^4.1.4",
"globals": "^16.2.0",
"prettier": "^3.5.2",
"typescript": "^5.7.3"
"eslint-plugin-unused-imports": "^4.2.0",
"eslint-plugin-vue": "^10.4.0",
"globals": "^16.3.0",
"prettier": "^3.6.2",
"typescript": "^5.9.2",
"vue-eslint-parser": "^10.2.0"
}
}
2 changes: 1 addition & 1 deletion packages/flag-evaluation/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
"main": "./dist/index.js",
"types": "./dist/index.d.ts",
"devDependencies": {
"@reflag/eslint-config": "^0.0.2",
"@reflag/eslint-config": "^0.0.3",
"@reflag/tsconfig": "^0.0.2",
"@types/node": "^22.12.0",
"eslint": "^9.21.0",
Expand Down
4 changes: 2 additions & 2 deletions packages/node-sdk/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,12 @@
"types": "./dist/types/src/index.d.ts",
"devDependencies": {
"@babel/core": "~7.24.7",
"@reflag/eslint-config": "~0.0.2",
"@reflag/eslint-config": "^0.0.3",
"@reflag/tsconfig": "~0.0.2",
"@types/node": "^22.12.0",
"@vitest/coverage-v8": "~1.6.0",
"c8": "~10.1.0",
"eslint": "^9.21.0",
"eslint": "^9.34.0",
"flush-promises": "~1.0.2",
"prettier": "^3.5.2",
"ts-node": "~10.9.2",
Expand Down
2 changes: 1 addition & 1 deletion packages/openfeature-browser-provider/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
"devDependencies": {
"@openfeature/core": "1.5.0",
"@openfeature/web-sdk": "^1.3.0",
"@reflag/eslint-config": "0.0.2",
"@reflag/eslint-config": "^0.0.3",
"@reflag/tsconfig": "0.0.2",
"@types/node": "^22.12.0",
"eslint": "^9.21.0",
Expand Down
4 changes: 2 additions & 2 deletions packages/openfeature-node-provider/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,10 @@
"@babel/core": "~7.24.7",
"@openfeature/core": "^1.5.0",
"@openfeature/server-sdk": ">=1.16.1",
"@reflag/eslint-config": "~0.0.2",
"@reflag/eslint-config": "^0.0.3",
"@reflag/tsconfig": "~0.0.2",
"@types/node": "^22.12.0",
"eslint": "^9.21.0",
"eslint": "^9.34.0",
"flush-promises": "~1.0.2",
"prettier": "^3.5.2",
"ts-node": "~10.9.2",
Expand Down
2 changes: 1 addition & 1 deletion packages/react-sdk/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
"react-dom": "*"
},
"devDependencies": {
"@reflag/eslint-config": "^0.0.2",
"@reflag/eslint-config": "^0.0.3",
"@reflag/tsconfig": "^0.0.2",
"@testing-library/react": "^15.0.7",
"@types/jsdom": "^21.1.6",
Expand Down
5 changes: 1 addition & 4 deletions packages/vue-sdk/eslint.config.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
const base = require("@reflag/eslint-config");
const importsPlugin = require("eslint-plugin-import");
const vuePlugin = require("eslint-plugin-vue");
const vueParser = require("vue-eslint-parser");

Expand All @@ -13,7 +12,6 @@ module.exports = [
files: ["**/*.vue"],
plugins: {
vue: vuePlugin,
import: importsPlugin,
},
languageOptions: {
parser: vueParser,
Expand All @@ -37,8 +35,7 @@ module.exports = [
},
},
rules: {
...vuePlugin.configs.recommended.rules,
...vuePlugin.configs["vue3-recommended"].rules,
...vuePlugin.configs["flat/strongly-recommended"].rules,

// Vue specific rules
"vue/multi-word-component-names": "off",
Expand Down
9 changes: 5 additions & 4 deletions packages/vue-sdk/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,15 @@
"vue": "^3.0.0"
},
"devDependencies": {
"@reflag/eslint-config": "^0.0.2",
"@reflag/eslint-config": "^0.0.3",
"@reflag/tsconfig": "^0.0.2",
"@types/jsdom": "^21.1.6",
"@types/node": "^22.12.0",
"@typescript-eslint/parser": "^8.42.0",
"@vitejs/plugin-vue": "^5.2.4",
"@vue/test-utils": "^2.3.2",
"eslint": "^9.21.0",
"eslint-plugin-vue": "^9.28.0",
"eslint": "^9.34.0",
"eslint-plugin-vue": "^10.4.0",
"jsdom": "^24.1.0",
"msw": "^2.3.5",
"prettier": "^3.5.2",
Expand All @@ -60,6 +61,6 @@
"vite-plugin-dts": "^4.5.4",
"vitest": "^2.0.4",
"vue": "^3.5.16",
"vue-eslint-parser": "^9.4.2"
"vue-eslint-parser": "^10.2.0"
}
}
Loading
Loading